mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
Add an e2e suite at tests/e2e/mcp/ that proves MCP authorization over the api_key auth family. An admin registers an upstream MCP server through the management API (POST /v1/mcp/server, persisted in the DB and picked up without a restart) and queues its deletion. Two keys are created against that one server: one granted access through object_permission.mcp_servers and one with no MCP grant. The permitted key is a live control proving the upstream is reachable and the tool is callable, so a denial on the ungranted key is an authorization decision rather than a dead server. The denied key then sees none of the server's tools on tools/list and is refused a tools/call with a 403 access_denied. A deterministic self-hosted FastMCP upstream (add/multiply over streamable-http) is added to the e2e compose stack so the suite runs offline with a known tool set. KeyGenerateBody gains an optional typed object_permission so the shared gateway can create a key with an MCP grant.
16 lines
497 B
Python
16 lines
497 B
Python
"""MCP suite's `client` fixture.
|
|
|
|
The shared lifecycle (resources/scoped_key), proxy liveness handling, and the
|
|
`e2e`/`covers` markers live in the parent tests/e2e/conftest.py. McpClient holds
|
|
the shared Gateway, so the `resources` fixture tears down whatever this suite
|
|
creates (keys via the Gateway, MCP servers via the deferred cleanups).
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from mcp_client import McpClient, build_client
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def client() -> McpClient:
|
|
return build_client()
|