n8n does MCP OAuth in its credential layer, and CIMD is off until an environment variable turns it on

Kind: nuance · Status: current · Last verified: 2026-11-27 · Clients: n8n · Revisions: 2025-11-25

The MCP nodes construct StreamableHTTPClientTransport and SSEClientTransport with a custom fetch and no authProvider. The SDK's OAuth code never runs. Authentication is whatever n8n credential the node uses: Bearer, Header, Multiple Headers, a generic OAuth2 credential, or the MCP OAuth2 credential.

The MCP OAuth2 credential extends n8n's generic OAuth2 credential. When the user clicks connect in the editor, oauth.service.ts in the cli package does the work:

At run time the node reads the stored token. A 401 on any MCP request calls n8n's token refresh and retries once. A failed refresh surfaces as an auth error on the node. Nothing starts a new authorization from inside a workflow run.

The pnpm workspace patches pkce-challenge 5.0.0, a dependency of the SDK, to drop ~ from the verifier alphabet. n8n's own OAuth service imports that package. The MCP nodes do not reach the SDK's auth module, so the patch does not change SDK behaviour on the MCP path, and metadata.sdk.patched is false.

Sources