From c030191be665ec4432c2b66f2f88a5ae67147c2b Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 1 Oct 2026 11:56:26 -0700 Subject: [PATCH] docs(proxy): point mcp_server test references at tests/unit/proxy (#44055) * docs(proxy): point mcp_server test references at tests/unit/proxy The legacy tests/test_litellm/proxy tree was removed in #44018. Repoint the mcp_server AGENTS.md mirror path, swap its auth example for a module that still exists, and drop the utils.py comment block that named the old test path * docs(proxy): fix remaining mcp_server legacy test path and note import-time env reads Repoint the second tests/test_litellm reference in the mcp_server AGENTS.md Tests section and move the import-time env guidance there from the removed utils.py comment --- litellm/proxy/_experimental/mcp_server/AGENTS.md | 11 ++++++++--- litellm/proxy/_experimental/mcp_server/utils.py | 8 -------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/litellm/proxy/_experimental/mcp_server/AGENTS.md b/litellm/proxy/_experimental/mcp_server/AGENTS.md index d9e0bfa3589..626646c4c5c 100644 --- a/litellm/proxy/_experimental/mcp_server/AGENTS.md +++ b/litellm/proxy/_experimental/mcp_server/AGENTS.md @@ -89,14 +89,19 @@ module materially harder to understand. ## Tests -Mirror this package under `tests/test_litellm/proxy/_experimental/mcp_server/`. +Mirror this package under `tests/unit/proxy/_experimental/mcp_server/`. For regressions, extend the existing mapped test file instead of creating a new one. Use subdirectories that match the implementation path, such as -`auth/test_token_exchange.py` for `auth/token_exchange.py` and +`auth/test_token_endpoint_auth.py` for `auth/token_endpoint_auth.py` and `guardrail_translation/test_mcp_guardrail_handler.py` for `guardrail_translation/handler.py`. Use `tests/mcp_tests/` only when extending an existing broader MCP integration scenario that already lives there. Route, auth, tool listing, tool execution, OAuth, sampling, elicitation, DB, and dashboard-session changes should have -focused coverage in the mirrored `tests/test_litellm/...` path first. +focused coverage in the mirrored `tests/unit/proxy/...` path first. + +The environment-backed constants in `utils.py` (`LITELLM_MCP_SERVER_NAME`, +`LITELLM_MCP_SERVER_DESCRIPTION`, `MCP_TOOL_PREFIX_SEPARATOR`) are read once at +import time. Tests that override those variables must reload the module, as +`test_mcp_server_identity_env.py` does, or they assert against stale values. diff --git a/litellm/proxy/_experimental/mcp_server/utils.py b/litellm/proxy/_experimental/mcp_server/utils.py index 7411dc5c4f0..7c9d75457b5 100644 --- a/litellm/proxy/_experimental/mcp_server/utils.py +++ b/litellm/proxy/_experimental/mcp_server/utils.py @@ -40,14 +40,6 @@ class McpServerPayloadLike(Protocol): def tool_name_to_display_name(self) -> Mapping[str, str] | None: ... -# Constants -# -# NOTE: The environment-backed values below are read once, when this module is -# first imported, and cached for the lifetime of the process. Changing the -# corresponding environment variables after import has no effect unless the -# module is reloaded (e.g. ``importlib.reload``). Tests that override these -# variables must reload this module — see -# ``tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py``. LITELLM_MCP_SERVER_NAME: Final = os.environ.get("LITELLM_MCP_SERVER_NAME", "litellm-mcp-server") LITELLM_MCP_SERVER_VERSION: Final = "1.0.0" LITELLM_MCP_SERVER_DESCRIPTION: Final = os.environ.get("LITELLM_MCP_SERVER_DESCRIPTION", "MCP Server for LiteLLM")