published fresh until

MCP Python SDK or FastMCP for a remote server with OAuth?

Summary As of November 2026, choose the MCP Python SDK for a small server with your own verifier, or FastMCP for provider integrations and composition. Apply FastMCP’s 4.1.2 authorization fixes or later. HTTP OAuth supplies validated identity; tools still enforce permissions (checked 2026-11-05).

Not for token arguments, see mcp-server-auth-never-a-tool-argument; stdio logging, see mcp-stdio-server-never-write-stdout

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Choose a Python MCP library, identity provider and tool-level permissions separately. An SDK alone does not establish a trust boundary.

Versions, licences and spec status, checked 2026-11-17

OptionStatusPick it when
Official mcp package2.3.0, MIT; Python >=3.10Small surface and your own verifier. Current high-level server is from mcp.server import MCPServer.
fastmcp4.2.0, Apache-2.0; Python >=3.11; Jeremiah Lowin/Nate NowackProviders/composition; from fastmcp import FastMCP ≠ mcp.server.fastmcp.
Official low-level ServerPart of mcp, same package/licenceExplicit handler/schema control; more protocol work.
Existing ASGI app or gatewayArchitecture option, not another MCP SDKReuse auth/tenancy controls, preserving discovery, challenges and streaming.

4.1.2 authorizes transformed components; blocks denied-resource template fallback. Docs track main; check pinned APIs.

The current MCP authorization specification is the 2026-07-28 revision. OAuth 2.1 remains an IETF draft in its references. Authorization is optional overall; supported HTTP auth should follow the spec. Stdio has a process/environment boundary. Client ID Metadata Documents are recommended; DCR is deprecated but retained for compatibility, not universally required.

Remote OAuth architecture

The client obtains an access token from an authorization server. The MCP endpoint is a resource server. It advertises Protected Resource Metadata and authorization-server discovery, then validates bearer credentials on each HTTP request. Client authorization/token requests include the MCP resource indicator. Check host/provider registration compatibility.

With official SDK authorization, pair token_verifier with AuthSettings. Implement TokenVerifier.verify_token returning a validated AccessToken or None. Set the public resource URL and required scopes. Enable validate_token_resource=True when the token's audience maps to that URL; otherwise validate the provider's audience identifier explicitly in the verifier. Merely configuring an issuer does not verify a JWT.

The SDK emits metadata and 401 challenges, but supplies no login/consent or token issuance. Use get_access_token() for validated handler identity and authorization. In-memory/stdio tests skip HTTP auth.

Verify JWT signature, allowed algorithm, trusted issuer, audience and time claims, then scopes/tenant ownership. Introspect opaque tokens through a trusted endpoint; check active status/resource. Reject ID tokens as API credentials. FastMCP token verification provides JWT/JWKS and introspection approaches. A bare verifier does not provide OAuth discovery for interactive clients.

Provider choice and integration notes, checked 2026-10-20

InfrastructureOfficial integration guidanceConstraint to resolve
Auth0FastMCP Auth0 integration distinguishes Auth0MCPProvider for Auth for MCP from Auth0Provider for an OIDC proxy with fixed application credentialsEnable Auth for MCP and Resource Parameter Compatibility Profile. Match API audience/resource and registered callbacks; verify pinned APIs.
KeycloakFastMCP Keycloak integration uses KeycloakAuthProvider, realm discovery and DCRGuide requires >=26.6.0 for DCR, trusted-host policy and audience mappers. Explicitly set audience; optional default accepts any audience. Not a latest-version claim.
CloudflareWorkers authorization guide offers Access, external providers and a Workers OAuth Provider libraryTypeScript Worker infrastructure. Ahead of Python, securely convey validated identity and prevent backend bypass. Its proxy issues MCP tokens separately from upstream tokens.

FastMCP's Remote OAuth path delegates issuance and publishes discovery; an OAuth/OIDC proxy bridges an upstream provider when client registration/redirect behaviour does not match. Do not build a new authorization server just because an old tutorial uses auth_server_provider.

What the agent should do with tokens

The host's OAuth client handles browser sign-in, PKCE, redirects, token exchange, protected storage and refresh. Keep bearer tokens in the host's OAuth client and server context; expose only authorized tools and sanitized results to the model. Server code reads validated request context and enforces permissions on every sensitive call. Tool visibility does not replace execution checks.

Never request a real token in chat, add it to a tool schema, print it in logs, return it in a result, commit it, or forward an MCP token to another API. Keep downstream credentials separate and server-side; design any exchange explicitly. Session IDs are not authentication. The MCP security guidance prohibits token passthrough and discusses confused-deputy risks in proxies.

Community evidence

  • HarrisonUnifyAI's issue #1083 reports bearer auth confusion; caravin points to standalone FastMCP and the author confirms HTTP auth worked. Historical API confusion, not a current feature comparison.
  • maxisbey's issue #2098 asks to expose session/auth/transport data on handler Context. The report says identity was “not accessible through the Context object”. Current docs describe the helper above; this is not a current absence claim or benchmark.

Recommendation by constraint

  • Existing OAuth provider and a small MCP surface: official SDK plus a focused verifier and explicit authorization rules.
  • Want documented Auth0/Keycloak adapters, proxy options and composition: evaluate standalone FastMCP, pin its version and check required integration APIs.
  • Existing authenticated ASGI service: reuse its trusted verification code, while preserving MCP metadata and challenge behaviour. Test streaming through the real proxy.
  • Local subprocess only: choose the simpler SDK API for the job; remote HTTP OAuth is not required merely because tools exist.

A prompt to give your agent

Identify distribution/imports without reading credentials. Propose issuer/resource-server split for our URL and hosts using pinned docs. Use synthetic credentials to test HTTP discovery, missing/expired/wrong-issuer/wrong-audience/insufficient-scope tokens, cross-tenant denial and key rotation. Prevent secrets reaching tool arguments, logs or results. Do not configure real tenants or deploy.

Mistakes and Limits

Do not mix official v1 FastMCP snippets, official v2 MCPServer and standalone FastMCP APIs. Do not mistake decoding for verification, DCR for universal support, or a passed in-memory test for HTTP auth coverage. Historical reports do not measure adoption or reliability. Provider docs may lead releases.

Reports from users

  • @iCodePoet, 2025-09-19: "API calls fail with 401 errors despite successful token refresh" — FastMCP #1863. The production OAuthProxy report describes stale request auth context after refresh. Closed via #2505; historical evidence for testing refresh and handler identity, not a claim about 4.1.1.

Reports verified against the linked sources on 2026-10-28.

Started from a post by @maxisbey, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Python SDK or FastMCP for a remote server with OAuth?
Summary: As of November 2026, choose the MCP Python SDK for a small server with your own verifier, or FastMCP for provider integrations and composition. Apply FastMCP’s 4.1.2 authorization fixes or later. HTTP OAuth supplies validated identity; tools still enforce permissions (checked 2026-11-05).
Copy for agent
get the whatworks thread mcp-python-sdk-or-fastmcp-for-remote-server-oauth-2026 and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-python-sdk-or-fastmcp-for-remote-server-oauth-2026
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks