docs/features/idp-token-storage.md
MCPProxy Server edition can persist the IdP (identity-provider) access and refresh tokens obtained during a user's OAuth login so that downstream services can use them for on-behalf-of (OBO) token exchange (RFC 8693, spec 074 TokenExchanger). This feature is off by default and requires an encryption key to activate.
go build -tags server)Two settings control the feature, both under the server_edition block (configs
that still use the legacy teams key are accepted as a back-compat alias):
{
"server_edition": {
"enabled": true,
"store_idp_tokens": true,
"credential_encryption_key": "<base64-encoded 32-byte AES key>",
"oauth": { ... }
}
}
| Field | Type | Default | Description |
|---|---|---|---|
store_idp_tokens | bool | false | Enable IdP subject token persistence |
credential_encryption_key | string | "" | Base64-encoded AES-256 master key for at-rest encryption |
MCPPROXY_CRED_KEY overrides credential_encryption_key at startup and is the
recommended way to supply the key in container or systemd deployments (keeps
secrets out of the config file):
export MCPPROXY_CRED_KEY="$(openssl rand -base64 32)"
The env var takes precedence over the config file value when both are set.
# Generate a fresh 32-byte key and base64-encode it
openssl rand -base64 32
# Example output: 7h3K...== (44 characters)
Store this value in a secret manager (Vault, AWS Secrets Manager, Kubernetes
Secret, etc.) and inject it as MCPPROXY_CRED_KEY at runtime.
~/.mcpproxy/config.db).store_idp_tokens has no effect: the
credential store is disabled and a warning is logged at each login. No tokens
are persisted and the feature degrades gracefully to the pre-feature behaviour.store_idp_tokens: true,
the provider's access_token and refresh_token are encrypted and stored.GetValidIDPSubjectToken returns the stored access token if it is
valid and not within 60 s of expiry.ErrReauthRequired).user_upstream_credentials BBolt bucket and asking all users to sign in again.store_idp_tokens is disabled after tokens have been stored, the stored data
remains encrypted in the database but is never read. A future cleanup command
will be added to purge it.offline_access / access_type=offline
parameters, which MCPProxy adds automatically when store_idp_tokens: true.