litellm/tests/mcp_tests
Tin Chi Lo 4b55de7f45 refactor(mcp): model api_key placement as (header_name, value_prefix)
The scheme enum assumed every static credential rides on the Authorization header with a prefix,
which is true for bearer/basic/token/raw but wrong for api_key: v1 writes that one to the
X-API-Key header (client.py:443-444), a different header entirely. Parity-testing the graft
surfaced it. API-key headers are not standardized (OpenAPI models the header name as
configurable; real upstreams vary - Atlassian uses Authorization: Bearer, MS Logic Apps and
Spring AI use X-API-Key, Azure APIM uses Ocp-Apim-Subscription-Key), so model the placement as
data: header_name (default Authorization) + value_prefix (default Bearer), like OpenAPI's apiKey
scheme. This expresses every v1 auth_type and any custom upstream header, with no per-scheme
enum and no leak.

Replaces ApiKeyConfig.scheme/header_for with header_name/value_prefix/header(); the arm builds
StaticHeaderAuth(value, header_name=name) via a small helper. The capability is not yet exposed
to admins (that is the deferred server-configuration phase); the v1->v2 adapter will fill the
pair from v1's auth_type. Test now covers bearer/basic/token/raw on Authorization plus X-API-Key
and a custom header. 56 tests, gates green.
2026-06-18 09:08:24 -07:00
..
gateway refactor(mcp): model api_key placement as (header_name, value_prefix) 2026-06-18 09:08:24 -07:00
test_configs [Release Fix] (#22411) 2026-02-28 09:46:35 -08:00
conftest.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
mcp_server.py test: const 2026-01-19 12:03:26 +09:00
test_aresponses_api_with_mcp.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_auth_header_extraction.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_auth_priority.py [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788) 2026-02-09 17:35:11 -08:00
test_mcp_chat_completions.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_client_unit.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_guardrails.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_hooks.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_litellm_client.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_logging.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_server.py [internal copy of #28008] Support MCP OAuth passthrough and issuer-scoped JWT auth (#28356) 2026-06-02 12:22:04 -07:00
test_oauth2_mcp_config.yaml [UI] M2M OAuth2 UI Flow (#20794) 2026-02-09 19:28:02 -08:00
test_openapi_spec_path_url.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_per_user_oauth_cache.py [internal copy of #28008] Support MCP OAuth passthrough and issuer-scoped JWT auth (#28356) 2026-06-02 12:22:04 -07:00
test_proxy_mcp_e2e.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_semantic_tool_filter_e2e.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00