π The fast, Pythonic way to build MCP servers and clients.
fix: StatefulProxyClient.clear() no longer causes KeyError on session teardown (#4328)
Perseus Computing222742a73779
diff --git a/fastmcp_slim/fastmcp/server/providers/proxy.py b/fastmcp_slim/fastmcp/server/providers/proxy.pyindex 8dab75564..f5f160194 100644--- a/fastmcp_slim/fastmcp/server/providers/proxy.py+++ b/fastmcp_slim/fastmcp/server/providers/proxy.py@@ -1230,7 +1230,7 @@ class StatefulProxyClient(ProxyClient[ClientTransportT]):self._caches[session] = proxy_clientasync def _on_session_exit():- self._caches.pop(session)+ self._caches.pop(session, None)logger.debug(f"{proxy_client} will be disconnect")# This callback runs while the server session's exit stack is# unwinding, which usually happens because the owning task is