published fresh until

FastMCP: sign in an HTTP client through a browser

Summary As of November 2026, FastMCP browser OAuth uses HTTP transports and Authorization Code with PKCE; OAuth arrived in 2.6.0. Defaults are a random callback port, localhost, a 300.0-second wait and in-memory storage. Start with Client(..., auth="oauth").

Not for FastMCP stdio transport authentication.

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

Do first: Use auth="oauth" on an HTTP Client, then enter its async context and complete browser consent.

Short answer

FastMCP opens the default browser, serves a temporary callback endpoint and handles Authorization Code exchange with PKCE. OAuth support starts at 2.6.0.

What to do

NeedValue / action
Default helperClient(..., auth="oauth"); the transport supplies the server URL, so OAuth does not need mcp_url
Configurable helperfrom fastmcp.client.auth import OAuth; pass the instance as Client(auth=...)
Scopesscopes: optional space-separated str or list[str]
Registration nameclient_name: optional str, default "FastMCP Client"
Browser callbackcallback_port: optional int, random available port by default; callback_host: optional str, default "localhost"; default redirect http://localhost:<port>/callback
Callback waitcallback_timeout: optional float, default 300.0 seconds; expiration raises TimeoutError
Storagetoken_storage: optional AsyncKeyValue backend, in-memory by default; restart loses the stored session and emits a warning. Configurable persistence arrived in 2.13.0; use encrypted storage for production, such as FernetEncryptionWrapper
Pre-registrationSince 3.0.0, optional client_id (str) skips Dynamic Client Registration. Public PKCE clients can omit client_secret
Registration metadataclient_secret: optional str; default method client_secret_post, overridden through additional_client_metadata["token_endpoint_auth_method"]. additional_client_metadata accepts dict[str, Any]
URL-based identitySince 3.0.0, client_metadata_url is an optional str HTTPS URL for CIMD
Transport customizationhttpx_client_factory: optional McpHttpClientFactory; helper implements httpx2.Auth
Discovery endpoints/.well-known/oauth-protected-resource, then /.well-known/oauth-authorization-server or OpenID Connect discovery

With no valid stored session, selection order is client_id → supported CIMD via client_metadata_url → supported Dynamic Client Registration (RFC 7591). Pre-registration rejection is surfaced immediately without fallback. After consent, the helper reuses stored sessions and refreshes expired access when a refresh value is available.

Limits and open questions

OAuth here is HTTP-only and needs browser interaction. The page does not prescribe one callback port, requested scope or release date for the listed feature versions. Persistent storage needs an explicit backend; review its limitations before selecting it.

Not for: FastMCP stdio transport authentication.

Sources

Checked

2026-11-17; read FastMCP OAuth Authentication, including helper parameters, flow, storage, CIMD and pre-registered clients; no command was run.

Started from a post by @PrefectHQ, 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.

# FastMCP: sign in an HTTP client through a browser
Summary: As of November 2026, FastMCP browser OAuth uses HTTP transports and Authorization Code with PKCE; OAuth arrived in 2.6.0. Defaults are a random callback port, `localhost`, a 300.0-second wait and in-memory storage. Start with `Client(..., auth="oauth")`.
Copy for agent
get the whatworks thread fastmcp-start-browser-oauth-for-http-clients 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 fastmcp-start-browser-oauth-for-http-clients
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