litellm/tests/unit/proxy/mcp_server
tin-berri fee4b448a1
feat(proxy): sign Moyai users in through the existing gateway login, with a short-lived DPoP-bound credential (#56258)
* feat(proxy): let the admin-connected Moyai deployment sign users in through the gateway login

The proxy-API sign-in (`lite login --pkce`) already does gateway login, a team
consent page, PKCE, refresh and revoke, and mints a per-user, per-team
credential the normal auth path enforces models, budgets and rate limits on.
It refused every hosted callback, so Moyai could not use it.

A proxy-API grant may now redirect to the Moyai deployment a proxy admin
connected (the existing `moyai_url` setting) as well as to loopback. A
credential delivered to a hosted callback is limited to the inference routes,
and the limit is carried on the grant so a refresh keeps it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* test(proxy): let the gateway-endpoint minter stand-in take allowed_routes like the real minter

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* feat(proxy): bind the Moyai login credential to a client key (DPoP) and expire it in ten minutes

A proxy-API grant for a hosted callback now needs an RFC 9449 DPoP proof at
the token endpoint. The credential and its refresh token are bound to that
key: every request with the credential must carry a fresh proof for its
method, URL and token, checked where every authenticated request converges,
with the proof's jti claimed in the shared single-use cache. The credential
lives for ten minutes and is renewed with the rotating refresh token.
`lite login` on loopback is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(proxy): carry the DPoP key binding in the credential's metadata, not a new auth-object field

A new field on UserAPIKeyAuth changed the serialized shape every cache and the
Rust key store agree on byte for byte. The binding now rides in the minted
credential's existing metadata, which every copy and cache already carries, so
the auth object is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(proxy): refuse a replayed DPoP proof on the token endpoint too

Proofs on code exchange and refresh were verified but their jti was not
claimed, so the replay guarantee was narrower there than on API requests. Both
now go through one helper that verifies the proof and claims its jti.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(proxy): answer a single-use store outage as unavailable, not as a bad DPoP proof

A proof whose jti could not be recorded was refused as invalid_dpop_proof, so
a client would drop a still-valid grant during a Redis fault. The token
endpoint now answers 503 temporarily_unavailable and API requests 503, the way
the code and refresh-token claims already do; only a missing, invalid, replayed
or wrong-key proof is a 400/401.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-04 11:36:32 -08:00
..
auth feat(mcp): read profile grants from caller permissions (#53674) 2026-12-03 23:42:40 -08:00
events feat(mcp): persist per-server event settings (#53602) 2026-11-24 06:31:10 +00:00
faults fix(mcp): propagate managed oauth reauthentication (#54815) 2026-12-02 11:07:52 +00:00
guardrail_translation
outbound_credentials fix(mcp): recover rejected oauth tokens (#54814) 2026-12-01 13:43:49 -08:00
__init__.py
conftest.py fix(mcp): serialize oauth credential revocation (#54816) 2026-12-01 04:55:06 +00:00
test_auth_profiles.py feat(mcp): carry named credentials on the server model (#54831) 2026-12-04 00:09:38 -08:00
test_byok_credential_cache.py refactor(auth_cache_invalidation): move the invalidation channel to the native client (#51135) 2026-11-21 18:58:27 +09:00
test_byok_oauth_endpoints.py refactor(auth_cache_invalidation): move the invalidation channel to the native client (#51135) 2026-11-21 18:58:27 +09:00
test_callback_oauth_error_responses.py
test_capabilities.py
test_catalog.py feat(mcp): carry named credentials on the server model (#54831) 2026-12-04 00:09:38 -08:00
test_client_allowlist.py
test_contracts.py
test_db_credentials.py fix(mcp): preserve OAuth scope refusal notes for prompts and resources (#55550) 2026-12-01 12:44:19 -08:00
test_discoverable_endpoints.py feat(proxy): authorize hosted LiteAdmin tools with caller credentials (#55591) 2026-12-02 19:08:20 -08:00
test_gateway_dcr_flow.py feat(proxy): sign Moyai users in through the existing gateway login, with a short-lived DPoP-bound credential (#56258) 2026-12-04 11:36:32 -08:00
test_id_jag_grant.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
test_idp_token_exchange.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_interactions.py
test_is_tool_name_prefixed.py
test_jwt_mcp_enforcement.py fix(auth): check a mapped JWT's end-user claim and keep the error classes of refused keys and JWTs (#52397) 2026-11-18 03:36:46 +00:00
test_jwt_mcp_simple.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
test_mcp_auth_header_extraction.py
test_mcp_auth_priority.py
test_mcp_block_recording.py
test_mcp_chat_completions.py fix(mcp): handle the caller Authorization on chat and responses the way native /mcp does (#54587) 2026-11-25 18:37:32 -08:00
test_mcp_client_unit.py feat(mcp): cache upstream tool lists with an admin-set lifetime (#51160) 2026-11-12 08:48:04 -08:00
test_mcp_cost_calculator.py
test_mcp_custom_fields.py
test_mcp_debug.py
test_mcp_discovery.py chore(ui): stop committing the built admin UI export (#55249) 2026-11-30 12:04:38 -08:00
test_mcp_elicitation_handler.py
test_mcp_env_vars.py feat(fips): encrypt stored secrets with the FIPS provider's AES-256-GCM in fips_mode (#51429) 2026-11-18 03:22:53 +00:00
test_mcp_guardrail_usage_monitor.py fix(mcp): refuse calls to guardrail-hidden tools (#48669) 2026-10-27 17:13:40 -07:00
test_mcp_header_alias_utils.py
test_mcp_hook_extra_headers.py fix(mcp): refuse calls to guardrail-hidden tools (#48669) 2026-10-27 17:13:40 -07:00
test_mcp_logging.py feat(lens): add key and team tracing controls (#53191) 2026-11-23 17:59:37 +00:00
test_mcp_max_concurrent_requests.py
test_mcp_metadata_preservation.py
test_mcp_oauth_passthrough.py
test_mcp_oauth_passthrough_cold_start.py
test_mcp_oauth_passthrough_tools.py fix(mcp): propagate managed oauth reauthentication (#54815) 2026-12-02 11:07:52 +00:00
test_mcp_partial_update.py feat(terraform): configure MCP server OAuth settings (#53862) 2026-11-23 19:24:34 +00:00
test_mcp_proxy_mode.py feat(mcp): cache upstream tool lists with an admin-set lifetime (#51160) 2026-11-12 08:48:04 -08:00
test_mcp_sampling_completion_flow.py
test_mcp_sampling_model_access.py
test_mcp_sampling_model_resolution.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_mcp_sampling_priority_selection.py
test_mcp_sampling_request_builder.py
test_mcp_sampling_response_conversion.py
test_mcp_sampling_tool_conversion.py
test_mcp_server.py feat(mcp): cache upstream tool lists with an admin-set lifetime (#51160) 2026-11-12 08:48:04 -08:00
test_mcp_server_identity_env.py
test_mcp_server_manager.py feat(mcp): carry named credentials on the server model (#54831) 2026-12-04 00:09:38 -08:00
test_mcp_server_tool_calls_and_headers.py fix(mcp): let zero-budget users call MCP tools that cost nothing (#52130) 2026-11-16 17:44:44 -08:00
test_mcp_session_logging.py
test_mcp_sigv4_auth.py
test_mcp_stale_session.py
test_mcp_tool_search.py feat(mcp): cache upstream tool lists with an admin-set lifetime (#51160) 2026-11-12 08:48:04 -08:00
test_mcp_toolset_scope.py refactor(proxy): move non-auth writers out of the auth cache (#51599) 2026-11-20 17:57:38 +09:00
test_oauth2_flow_backfill.py
test_oauth2_mcp_config.yaml
test_oauth2_token_cache.py refactor(auth_cache_invalidation): move the invalidation channel to the native client (#51135) 2026-11-21 18:58:27 +09:00
test_oauth_identity_binding.py
test_oauth_issuer_stamp_backfill.py
test_openapi_spec_path_url.py fix(mcp): accept YAML OpenAPI documents (#48622) 2026-10-27 14:46:15 -07:00
test_openapi_to_mcp_generator.py ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
test_openapi_tool_auth.py
test_operations.py fix(mcp): cache and bound resource owner discovery on the aggregate endpoint (#54487) 2026-11-28 11:33:07 -05:00
test_per_user_oauth_cache.py refactor(proxy): move non-auth writers out of the auth cache (#51599) 2026-11-20 17:57:38 +09:00
test_proxy_api_credentials.py feat(proxy): sign Moyai users in through the existing gateway login, with a short-lived DPoP-bound credential (#56258) 2026-12-04 11:36:32 -08:00
test_rest_endpoints.py fix(mcp)!: forward the LiteLLM key when the admin configures it (#50604) 2026-11-10 20:51:34 -08:00
test_result_conversion.py
test_semantic_tool_filter.py refactor(mcp): let the semantic filter take its MCP tool loader as a parameter (#50483) 2026-11-13 16:34:00 -08:00
test_server_resolution.py
test_short_mcp_tool_prefix.py
test_state_tokens.py
test_stored_auth_profiles.py feat(mcp): add the encrypt-and-merge helpers for stored auth profiles (#53634) 2026-11-26 02:13:26 +00:00
test_subscriptions.py
test_tool_registry.py
test_ui_session_utils.py
test_upstream.py feat(mcp): add an opt-in per-server setting to skip MCP tool output validation (#49961) 2026-11-03 20:42:10 -08:00
test_utils.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00