github PrefectHQ/fastmcp v4.2.5
v4.2.5: Smoke Signals

58 minutes ago

This release serves subscriptions/listen on 2026-07-28 connections, so clients can open a stream and receive tool, prompt and resource change events, and FastMCP.notify_tools_changed() and its siblings now push those events to listening clients. A new opt-in UsageMiddleware records per-user, per-tool usage as the OpenTelemetry mcp.server.operation.duration histogram for tools/call and prompts/get; add it before any error-handling middleware. An experimental Events extension (SEP-3415) lands in fastmcp.experimental.events, with poll and push delivery and a fastmcp experimental events list|watch CLI; it is opt-in, and its API may change in any release without a deprecation period.

The release also tightens several OAuth and OpenAPI checks and fixes a batch of proxy, schema and CLI bugs. A CIMD client's metadata document can no longer widen the scopes a server allows; if you set neither valid_scopes nor required_scopes, CIMD clients can no longer request any scope, so set valid_scopes to the scopes you accept. A redirect URI must now match an exact allowed pattern's query and may not carry a fragment, and an exact pattern at a host's root (such as https://app.example/) now matches only that path; append /* to allow any path, while wildcard and portless loopback patterns are unchanged. Revoking a refresh token now also ends that grant's access tokens, and presenting a refresh token more than 60 seconds after it was rotated ends the whole grant as a suspected theft, so clients that copy one stored refresh token between processes must share the rotated one too. A new client_registration_ttl_seconds on OAuthProxy and OIDCProxy lets unused dynamic client registrations expire from persistent storage; it is off by default. AzureProvider with a multi-tenant tenant_id (organizations, consumers or common) no longer checks the token issuer, so users from any tenant are accepted; pass token_issuer to pin one. Behind a proxy, a backend now sees only the roots, sampling and elicitation support the real client declared.

OpenAPI tools no longer forward MCP transport headers such as mcp-protocol-version to the wrapped API, and a new forward_client_headers option on FastMCP.from_openapi, FastMCP.from_fastapi and OpenAPIProvider takes False to forward no client headers or a list of names to forward only those. OpenAPI cookie parameter values are now percent-encoded outside the characters cookies allow, so a backend that reads a cookie containing ;, spaces or non-ASCII text must decode it.

Listen streams are on by default. On 2026-07-28 connections, servers now advertise listChanged and resources.subscribe, and clients that support it hold one open subscriptions/listen stream per connection for as long as they stay connected. Each server process accepts up to 1024 open listen streams, and refuses further listen requests with an error.

Who should check: servers on hosts where an open request is costly or cut off, such as serverless platforms with request time limits, servers with a small fixed pool of workers or connections, and deployments that bill per open connection. Change events are delivered within one process, so with several workers or replicas a notify_* call reaches only the listeners connected to the same process.

To turn it off, set FASTMCP_ENABLE_SUBSCRIPTIONS_LISTEN=false in the server's environment before fastmcp is imported, or set fastmcp.settings.enable_subscriptions_listen = False in code before the server is created. The server then behaves exactly as in v4.2.4: it advertises listChanged and resources.subscribe as false, answers subscriptions/listen with -32601, and notify_* does nothing. Handshake-era (2025-11-25 and earlier) connections are unaffected either way.

Want to see where fixes like these come from? Watch fastmcp's issues and PRs move through triage live on the triage floor.

Thanks to our 25 contributors, including 6 first-time contributors.

What's Changed

Enhancements ✨

Security 🔒

Fixes 🐞

Docs 📚

  • Keep experimental features off stable surface; fix Skills and identity assertion labels by @zzstoatzz in #6702

Other Changes 🦾

New Contributors

Full Changelog: v4.2.4...v4.2.5

Don't miss a new fastmcp release

NewReleases is sending notifications on new releases.