Keep the CLI URL proxy era-agnostic; monitor claimed-result resolution

This commit is contained in:
Jeremiah Lowin 2026-07-20 12:46:34 -04:00
commit 1e1882851d
No known key found for this signature in database
2 changed files with 16 additions and 6 deletions

View file

@ -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 server
except Exception as e:
logger.error(f"Failed to create client for URL {url}: {e}")

View file

@ -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