diff --git a/fastmcp_slim/fastmcp/server/providers/proxy.py b/fastmcp_slim/fastmcp/server/providers/proxy.py index 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_client async 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