π The fast, Pythonic way to build MCP servers and clients.
Keep the CLI URL proxy era-agnostic; monitor claimed-result resolution
Jeremiah Lowin1e1882851d3f
diff --git a/fastmcp_slim/fastmcp/cli/run.py b/fastmcp_slim/fastmcp/cli/run.pyindex 476c0267d..0d12f14c2 100644--- a/fastmcp_slim/fastmcp/cli/run.py+++ b/fastmcp_slim/fastmcp/cli/run.py@@ -97,10 +97,15 @@ def create_client_server(url: str) -> Any:A FastMCP server instance"""try:- import fastmcp-- client = fastmcp.Client(url)- server = create_proxy(client)+ # Hand `create_proxy` the URL rather than a pre-built `Client`. A Client+ # target is treated as caller-configured and pinned, so its era would be+ # fixed at construction β and since `Client` now defaults to `"auto"`,+ # that would pin this proxy's upstream to the modern era and break+ # handshake-era clients connecting to it (`ping`, server-initiated+ # forwarding). Passing the URL lets the proxy mirror each front+ # connection's negotiated era instead, so `fastmcp run <URL>` serves+ # both eras.+ server = create_proxy(url)return serverexcept Exception as e:logger.error(f"Failed to create client for URL {url}: {e}")diff --git a/fastmcp_slim/fastmcp/client/mixins/tools.py b/fastmcp_slim/fastmcp/client/mixins/tools.pyindex 418976f69..d52e90cb9 100644--- a/fastmcp_slim/fastmcp/client/mixins/tools.py+++ b/fastmcp_slim/fastmcp/client/mixins/tools.py@@ -230,8 +230,13 @@ class ClientToolsMixin:else:# A claimed extension result (SEP-2133): resolve it through the# owning extension's resolver into an ordinary CallToolResult.- result = await self._resolve_claimed_result(- name, driven, read_timeout_seconds+ # Resolution issues further session requests of its own (result+ # validation lists tools; a resolver may make more), so it needs+ # the same session monitoring as the calls above β otherwise a+ # transport-level failure can kill the session runner while this+ # await waits forever.+ result = await self._await_with_session_monitoring(+ self._resolve_claimed_result(name, driven, read_timeout_seconds))# Reflect tool-level errors on the span so callers see ERROR