refactor(mcp): relocate the v2 gateway to litellm/proxy/gateway/mcp

Moves the clean-room gateway package out of litellm/proxy/_experimental/mcp_server/v2
into its final home litellm/proxy/gateway/mcp (the folder graduation the migration plan
had slated for Phase 2, pulled forward so all further work lands at the final path with
no later import churn). Sitting outside _experimental/mcp_server also sharpens the
clean-room boundary: the gateway no longer nests under the v1 MCP code it must not import.

Pure relocation, no behavior change: git-tracked renames preserve history; relative imports
are unaffected; the test's absolute imports, the README's basedpyright command, and the
pyrightconfig venvPath depth are updated for the new location. Tests move to
tests/mcp_tests/gateway. black, ruff, basedpyright strict, and the 16 resolver tests all
pass at the new path.
This commit is contained in:
Tin Chi Lo 2026-06-17 15:43:50 -07:00
parent d2c56ed656
commit 1f5130073d
11 changed files with 11 additions and 6 deletions

View file

@ -0,0 +1,5 @@
"""LiteLLM MCP Gateway — the clean-room v2 gateway, grafted into v1 behind a flag.
Written v2-native; nothing here imports from v1 (`litellm.proxy._experimental.mcp_server.*`).
v1 only ever reaches this package through a thin adapter, never the other way round.
"""

View file

@ -41,7 +41,7 @@ error. That is the property we want, so the gate is load-bearing rather than dec
Run the gate (passes clean, 0 errors):
```
basedpyright --project litellm/proxy/_experimental/mcp_server/v2/pyrightconfig.json
basedpyright --project litellm/proxy/gateway/mcp/pyrightconfig.json
```
Now prove the gate actually bites. Delete any one arm from `label_enum` in

View file

@ -2,7 +2,7 @@
"include": ["."],
"typeCheckingMode": "strict",
"pythonVersion": "3.10",
"venvPath": "../../../../..",
"venvPath": "../../../..",
"venv": ".venv",
"reportMissingTypeStubs": false,
"reportUnknownMemberType": true,

View file

@ -8,11 +8,11 @@ import httpx
import pytest
from pydantic import ValidationError
from litellm.proxy._experimental.mcp_server.v2.oauth.httpx_auth import (
from litellm.proxy.gateway.mcp.oauth.httpx_auth import (
NoOpAuth,
StaticHeaderAuth,
)
from litellm.proxy._experimental.mcp_server.v2.oauth.types import (
from litellm.proxy.gateway.mcp.oauth.types import (
ApiKeyConfig,
AuthSpecKind,
NoneConfig,
@ -20,10 +20,10 @@ from litellm.proxy._experimental.mcp_server.v2.oauth.types import (
ServerSpec,
Subject,
)
from litellm.proxy._experimental.mcp_server.v2.oauth.upstream_credentials import (
from litellm.proxy.gateway.mcp.oauth.upstream_credentials import (
UpstreamCredentialProvider,
)
from litellm.proxy._experimental.mcp_server.v2.result import Error, Ok
from litellm.proxy.gateway.mcp.result import Error, Ok
PROVIDER = UpstreamCredentialProvider()
SUBJECT = Subject(tenant_id="t1", subject_id="u1")