From 296c6d8d2e1288e5c54a203d24b9f72c3a4d6056 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 13 Feb 2026 11:05:40 -0800 Subject: [PATCH] feat(mcp): add MCP_TOKEN_EXCHANGE_CACHE_MAX_SIZE constant Sets cache max size to 500 for token exchange (higher than client_credentials since it's per-user). Co-Authored-By: Claude Opus 4.6 --- litellm/constants.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/constants.py b/litellm/constants.py index 6c889a317b8..eeff7b568c3 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -161,6 +161,11 @@ MCP_STDIO_ALLOWED_COMMANDS: frozenset = frozenset( | (set(_MCP_STDIO_EXTRA_COMMANDS.split(",")) - {""}) ) +# MCP OAuth2 Token Exchange (OBO) Defaults +MCP_TOKEN_EXCHANGE_CACHE_MAX_SIZE = int( + os.getenv("MCP_TOKEN_EXCHANGE_CACHE_MAX_SIZE", "500") +) + LITELLM_UI_ALLOW_HEADERS = [ "x-litellm-semantic-filter", "x-litellm-semantic-filter-tools",