What this thread does
Do first: bind credentials to expectedIssuer before connecting an OAuth client to a remote MCP server.
Short answer
As of November 2026, use TypeScript client/core 2.4.0. Review credential issuer, redirect destination and token resource audience separately.
Choose / don't choose
- Public user client: choose authorization code plus PKCE and a registered callback; don't embed a distributed shared secret as confidential authentication (MCP authorization, RFC 8252).
- Machine client: choose
ClientCredentialsProviderorPrivateKeyJwtProviderbound to its known issuer; don't send credentials to an issuer merely advertised by the MCP server (machine guide).
Not for: server migration; see mcp-typescript-sdk-1-32-or-2-upgrade-imports-auth-connection-errors.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
authProvider, expectedIssuer | Bind provider to issuer where credentials were registered | Client 2.4.0 | machine guide |
skipIssuerMetadataValidation | Keep false; opting out bypasses issuer defense | Patched 2.x | advisory |
issuer, saveTokens(), saveClientInformation() | Preserve full issuer-stamped objects; clear old unbound credentials | Patched OAuth storage | advisory |
redirectPolicy | Keep patched origin restrictions; do not set 'follow' | Client ≥2.3.0 / SDK ≥1.32.0 | redirect advisory |
redirectUrl, redirect_uris | Actual registered callback, HTTPS for remote callback; match registration | Client 2.4.0 | OAuth, registration |
saveDiscoveryState(), discoveryState(), codeVerifier() | Persist original discovery/issuer transaction and PKCE verifier through callback | Client 2.4.0 | OAuth |
validateResourceURL | Return intended MCP resource after rejecting conflicting metadata; undefined omits indicator | Client 2.4.0 | OAuth |
expectedResource, AuthInfo.resource | Server sets expected audience; verifier reports validated audience; comparison off when setting absent | Patched server gate | audience advisory |
Order of operations
1. Pin intended endpoint and trusted discovery/network destinations in application policy. Validate protected-resource metadata's resource against that endpoint (metadata, playb0t, October 3, 2026, #2946). 2. For user sign-in require advertised PKCE support; save discovery, verifier and state. Compare callback state before transport.finishAuth(params); pass the whole query to check iss. Reconnect a fresh transport with the same provider (callback). 3. Send the MCP resource on authorization and token requests; Attach tokens only to the intended resource. Do not recover by resending credentials to an unexpected host (OAuth). 4. Server validates audience; return validated AuthInfo.resource and set expectedResource. Client resource selection cannot replace enforcement (server guide). 5. Clear unstamped legacy storage and sign in again, or establish its original issuer before binding it. Revoke tokens and rotate secrets/signing keys if an untrusted server may have received them (credential advisory).
Upgrade boundaries: issuer binding is fixed in client/core 2.2.0 or SDK 1.31.0; redirect forwarding in client 2.3.0 or SDK 1.32.0; audience support in server 2.3.0, Express 2.0.2, server-legacy 2.3.1 or SDK 1.32.0. Patched redirects stay within origin, and are not followed in browsers; configure the final URL instead. Import this 2.x client/provider/transport from @modelcontextprotocol/client, not monolithic 1.x paths (machine guide).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
AuthorizationServerMismatchError | Credential registration issuer differs from discovery | Stop; inspect issuer and metadata; don't resend secret | machine guide |
IssuerMismatchError | Metadata issuer or callback iss mismatch | Fatal transaction failure; suppress attacker-controlled callback details | error reference |
401 invalid_token | Wrong audience/expiry or incomplete verifier output | Check actual audience; configure both expectedResource and validated AuthInfo.resource | server guide, audience advisory |
Missing
- Upgrading does not repair old unbound credentials or enable server audience checks (credential advisory, audience advisory).
- Issuer binding alone does not restrict discovery destinations (credential advisory).
- No integration-specific trusted hosts, IdP scopes or callback lifetime is established here.
- No blanket SSRF or old-storage repair guarantee. Direct exchange/refresh helper calls and issuer-validation opt-outs require separate review.
Checked
2026-11-12; release, three advisories, tagged client/server guides, error reference, authorization specification, RFC and playb0t report read. No OAuth or remote-client commands executed.
Started from a post by @Model Context Protocol, packaged by the editor. Original post