foundry_dev_tools.config.palantir_mcp module#
Read the token cache maintained by Palantir MCP.
Palantir MCP stores Foundry tokens in ~/.palantir/mcp-config.json:
{
"hosts": {
"https://foundry.example.com": {
"token": "eyJ..."
}
}
}
This module only reads that cache. Triggering the MCP re-authorization flow and changing the token scope is deliberately out of scope; re-authorize the token through your Palantir MCP client to refresh or expand its scope.
- foundry_dev_tools.config.palantir_mcp.PALANTIR_MCP_CONFIG_FILE = 'mcp-config.json'#
The config file Palantir MCP writes, relative to the user’s home directory.
- foundry_dev_tools.config.palantir_mcp.TOKEN_CLOCK_SKEW = 30#
Treat tokens that expire within this many seconds as already expired.
- class foundry_dev_tools.config.palantir_mcp.PalantirMCPCredential[source]#
Bases:
objectA host/token pair cached by Palantir MCP.
- token: Token#
- foundry_dev_tools.config.palantir_mcp.palantir_mcp_config_path()[source]#
Return the default Palantir MCP config path.
- Return type:
- foundry_dev_tools.config.palantir_mcp.token_expiry(token)[source]#
Return the JWT
expclaim as a Unix timestamp, if it can be decoded.
- foundry_dev_tools.config.palantir_mcp.host_from_origin(origin)[source]#
Return the
Hostfor an MCP origin likehttps://foundry.example.com.A missing scheme defaults to HTTPS. Raises
ValueErrorfor anything that is not an HTTP(S) origin with a netloc.
- foundry_dev_tools.config.palantir_mcp.read_palantir_mcp_credentials()[source]#
Read all usable host/token pairs from the Palantir MCP config.
A missing, unreadable, or malformed file is treated as an empty cache. Invalid host entries are skipped so that one bad entry cannot break the others.
- Return type:
- foundry_dev_tools.config.palantir_mcp.select_palantir_mcp_credential(credentials, host=None)[source]#
Select the credential for
host, or the only unambiguous cached credential.When
hostis provided, the matching entry is returned even if it is expired;PalantirMCPTokenProviderturns that into a clear error on first use.When
hostis not provided, a single unexpired credential is used. If several hosts have unexpired tokens, the choice is ambiguous and aTokenProviderConfigErroris raised instead of silently picking one.- Parameters:
credentials (list[PalantirMCPCredential])
- Return type:
PalantirMCPCredential | None
- foundry_dev_tools.config.palantir_mcp.discover_palantir_mcp_credential(host=None)[source]#
Return the automatically selectable Palantir MCP credential, if any.
When
hostis provided, only a credential cached for that exact origin is selected. Otherwise a single unambiguous unexpired credential is used.- Parameters:
- Return type:
PalantirMCPCredential | None
- foundry_dev_tools.config.palantir_mcp.print_auto_pickup_notice(credential)[source]#
Print one process-wide notice that the MCP credential was auto-detected.
- Parameters:
credential (PalantirMCPCredential)
- Return type:
None