This release adds an experimental CodeModeClient, which wraps a Client or ClientGroup and runs CodeMode on the client side, so an agent gets the search, schema and execute meta-tools over servers that don't run CodeMode themselves, and one execute block can chain tools across servers. Server spans now carry network.transport and, over HTTP, network.protocol.name and network.protocol.version. Fixes cover client callbacks and results, OpenAPI schemas and path parameters, resource links returned by a mounted server's tools (now namespaced like the rest of the mount), and response limiting, which now keeps truncated results within max_size as serialized.
Authlib is no longer installed with fastmcp. The client and server no longer use it, so code that imports authlib directly must declare it as its own dependency.
Experimental events are now their own package, fastmcp-events, with a new API. In 4.2.5 the Events extension lived in fastmcp.experimental.events and each event type was a check function. That module is gone: install the events extra (pip install "fastmcp[events]") and import from fastmcp_events. Each event type is now a Pydantic model: register it with @events.event("name"), then feed it with await events.emit(...) or with a reader registered by @events.reader(Model), so port each check function to a model and a reader. An optional for_subscription method on the model takes the subscription arguments and decides what each subscription receives. Emitted events can be kept in Redis through Docket with DocketEventLog (add fastmcp-events[docket]), so they survive restarts and reach every replica.
Thanks to our 28 contributors, including 12 first-time contributors.
What's Changed
Enhancements ✨
- Land reviewed community fixes by @zzstoatzz, @DivyaNarahari97, @linhongyu510, @himanshuchawla0807-gif, @asasemahmed, @mikamikasuki, @Larry-Labs, @PennEwan, @Premvkmishra, and @pvliesdonk in #6723
- Add client-side CodeMode via CodeModeClient by @strawgate in #5585
- Show a remote url server in the mcp.json docs by @zzstoatzz and @eric-burel in #6750
- Add network transport attributes to server spans by @zzstoatzz in #6751
- Remove Authlib from client and server dependencies by @zzstoatzz, @mikamikasuki, and @zhuweid in #6794
- Declare event types as models, with emit or a reader by @zzstoatzz in #6762
- Keep emitted events in Redis via Docket by @zzstoatzz in #6763
- Split events into a fastmcp-events package by @zzstoatzz in #6807
Fixes 🐞
- Hydrate binary-format strings to bytes in client results by @zzstoatzz and @Vanity-1 in #6716
- Make Client callback setters reach a live session by @zzstoatzz and @dgenio in #6717
- Flatten discriminated OpenAPI schemas nested below the request body by @zzstoatzz and @tobias-bahls in #6718
- Namespace resource links returned by tools by @zzstoatzz, @Liu8Can, and @ldlda in #6720
- Keep a config client's live clone connected when another client closes by @zzstoatzz, @dayan02dev, and @BlueX888 in #6721
- Document that the client runs on asyncio by @zzstoatzz and @CNSeniorious000 in #6724
- Keep a shared keep_alive=False stdio subprocess until its last client exits by @zzstoatzz and @Aurelucien in #6727
- Serialize label and matrix OpenAPI path parameters by @zzstoatzz and @BlueX888 in #6725
- Report the inner session ID from a single-server MCPConfigTransport by @zzstoatzz and @67-luck in #6738
- Apply an AggregateProvider's own transforms in get_tasks() by @zzstoatzz and @67-luck in #6739
- Raise the ty floor to 0.0.104 and use its renamed ignore rules by @zzstoatzz in #6740
- generate-cli: keep SKILL.md parameter rows on one line by @zzstoatzz and @3urek4 in #6742
- apps dev: close the proxy client when a request fails by @zzstoatzz and @soarkit in #6743
- Set each client redirect response parameter once by @zzstoatzz in #6744
- Recreate OpenAPIProvider's default client on each lifespan by @zzstoatzz and @BlueX888 in #6745
- Bound truncated responses by their serialized size by @zzstoatzz and @Harcend in #6746
- Bound $ref alias chains in is_object_schema by @zzstoatzz and @3urek4 in #6741
- Forward security= from @mcp_resource to resource templates by @zzstoatzz, @jcd1991, and @finngladstone in #6749
Docs 📚
- docs: Keycloak and RemoteAuthProvider work with CIMD, not only DCR by @zzstoatzz in #6752
Other Changes 🦾
- chore(deps): Update github actions by @prefect-renovate[bot] in #6507
- chore(deps): Update dependency prefect to v3.9.3 by @prefect-renovate[bot] in #6508
- chore(deps): Update dependency ruff to v0.17.5 by @prefect-renovate[bot] in #6509
- chore(deps): Update python Docker tag to v3.15 by @prefect-renovate[bot] in #6735
New Contributors
- @Vanity-1 made their first contribution in #6716
- @tobias-bahls made their first contribution in #6718
- @Liu8Can made their first contribution in #6720
- @dayan02dev made their first contribution in #6721
- @linhongyu510 made their first contribution in #6723
- @Premvkmishra made their first contribution in #6723
- @3urek4 made their first contribution in #6741
- @soarkit made their first contribution in #6743
- @Harcend made their first contribution in #6746
- @finngladstone made their first contribution in #6749
- @jcd1991 made their first contribution in #6749
- @eric-burel made their first contribution in #6750
Full Changelog: v4.2.5...v4.2.6