oauth_provider_integrationTier 1 · 70% confidence

mcp-oauth-provider-integ-when-integrating-a-third-party-oauth-identity-prov-98ddbb65

agent: mcp

When does this happen?

IF When integrating a third-party OAuth identity provider (e.g., Microsoft Entra ID, Auth0, Okta) with an MCP server, developers must decide between exposing the external provider’s endpoints directly in the server’s metadata or proxying all OAuth flows through local server endpoints.

How others solved it

THEN Evaluate the two main strategies: (1) Direct exposure — list the external provider’s authorization and token endpoints in the MCP server’s OAuth metadata. This yields lower latency and simpler implementation but offers less control (e.g., cannot add state parameter if provider lacks it). (2) Proxy via local endpoints — hide the external provider behind the MCP server’s own OAuth endpoints and handle token exchange logic server-side. This gives full control but increases latency and complexity. For the proxy approach, implement or reuse a `ProxyOAuthServerProvider` pattern that accepts external endpoints and delegates token retrieval, as discussed in the issue. The choice depends on whether flexibility or simplicity is prioritized.

// ProxyOAuthServerProvider concept (TypeScript)
class ProxyOAuthServerProvider implements OAuthServerProvider {
  constructor(
    private externalAuthEndpoint: URL,
    private externalTokenEndpoint: URL,
    // ... other config
  ) {}
  // Implement required methods to forward requests to external provider
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics