Problem
The OAuth provider persists the DCR client registration (credentials/mcp/<key>-client.json) and reuses it for every subsequent authorization (clientInformation() in packages/agent-core/src/mcp/oauth/provider.ts). When the server side has meanwhile expired or dropped that registration (common for authorization servers that GC dynamic registrations), the next interactive flow builds its authorization URL from the stale client_id/redirect URI and the authorization server rejects it — in our case with "Invalid redirect URI" on the consent page.
Nothing in the client detects this: the flow just fails, and retrying reuses the same stale registration. The only recovery is knowing to delete credentials/mcp/<key>-client.json manually, which no error message suggests.
Suggested direction
When the authorization endpoint (or token exchange) rejects with a registration-related error (invalid_client, redirect-URI mismatch), invalidate the persisted client info (invalidateCredentials('client')) and re-run DCR once before surfacing the failure. Open to other designs — mainly filing this so the failure mode and its manual workaround are on record. Applies to both v1 (mcp/oauth/) and v2 (mcpCore/oauth/).
Problem
The OAuth provider persists the DCR client registration (
credentials/mcp/<key>-client.json) and reuses it for every subsequent authorization (clientInformation()inpackages/agent-core/src/mcp/oauth/provider.ts). When the server side has meanwhile expired or dropped that registration (common for authorization servers that GC dynamic registrations), the next interactive flow builds its authorization URL from the staleclient_id/redirect URI and the authorization server rejects it — in our case with "Invalid redirect URI" on the consent page.Nothing in the client detects this: the flow just fails, and retrying reuses the same stale registration. The only recovery is knowing to delete
credentials/mcp/<key>-client.jsonmanually, which no error message suggests.Suggested direction
When the authorization endpoint (or token exchange) rejects with a registration-related error (
invalid_client, redirect-URI mismatch), invalidate the persisted client info (invalidateCredentials('client')) and re-run DCR once before surfacing the failure. Open to other designs — mainly filing this so the failure mode and its manual workaround are on record. Applies to both v1 (mcp/oauth/) and v2 (mcpCore/oauth/).