Say which FastMCP versions leak `ContextVar`-derived MCP credentials across a shared `MCPToolset`

Draft
DO
1mo ago
+7-2

The "shared MCPToolset instance is a single identity" warning added in #6425 says that credentials derived per request from a ContextVar inside an auth object always leak between overlapping runs on a shared instance. That's only true on FastMCP 3. The MCP SDK v2 (modelcontextprotocol/python-sdk#2298) propagates each caller's context into the transport, so on FastMCP 4, the default install now, each request reaches the server with the credentials of the run making it, even on a shared session.

I re-ran the #6411 repro against current main: one shared MCPToolset whose auth reads a ContextVar, three overlapping callers, and a streamable HTTP server that echoes the Authorization header it receives.

InstallResult
fastmcp-slim 4.0.10 + mcp 2.2.0 (what pydantic-ai-slim[mcp] resolves to)each caller received its own token
fastmcp 3.4.7 + mcp 1.30.0the second and third callers were sent as the first

The warning now says this per FastMCP version, and keeps the reason the per-run toolset pattern is still recommended either way: the server still sees one session, initialized with the first run's credentials.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
  • PR title is fit for the release changelog.

šŸ¤– Generated with Claude Code