From 1cff05e87d5b3f8c7651dc8ebc30754a83756b31 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Mon, 23 Mar 2026 14:01:25 -0700 Subject: [PATCH] fix(mcp): remove dead toolset cache stubs, log invalidation failures, align schema updated_at defaults --- .../litellm_proxy_extras/schema.prisma | 2 +- .../_experimental/mcp_server/mcp_server_manager.py | 12 ++++-------- litellm/proxy/schema.prisma | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index 1e9f0e60eda..8c7e4c33103 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -336,7 +336,7 @@ model LiteLLM_MCPToolsetTable { tools Json @default("[]") // [{server_id: string, tool_name: string}] created_at DateTime @default(now()) created_by String? - updated_at DateTime @updatedAt + updated_at DateTime @default(now()) @updatedAt updated_by String? } diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py index 102bd615738..f02dbf650b7 100644 --- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py @@ -182,12 +182,6 @@ class MCPServerManager: } """ - # Toolset caches are now stored in user_api_key_cache (Redis-backed DualCache - # in production) so entries are shared across workers. These attributes are - # kept as empty stubs so existing callers don't AttributeError during tests. - self._toolset_perm_cache: Dict[str, Tuple[Dict[str, List[str]], float]] = {} - self._toolset_name_cache: Dict[str, Tuple[Optional[Any], float]] = {} - def get_registry(self) -> Dict[str, MCPServer]: """ Get the registered MCP Servers from the registry and union with the config MCP Servers @@ -885,8 +879,10 @@ class MCPServerManager: ] for k in keys_to_remove: cache_dict.pop(k, None) - except Exception: - pass + except Exception as e: + verbose_logger.warning( + f"invalidate_toolset_cache: failed to evict in-memory entries: {e}" + ) async def get_toolset_by_name_cached( self, diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index edbc9a344c5..6269791fd74 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -340,7 +340,7 @@ model LiteLLM_MCPToolsetTable { tools Json @default("[]") // [{server_id: string, tool_name: string}] created_at DateTime @default(now()) created_by String? - updated_at DateTime @updatedAt + updated_at DateTime @default(now()) @updatedAt updated_by String? }