litellm/tests/test_litellm/proxy/_experimental/mcp_server
Sameer Kankute 718c4637a8
feat(mcp): allow native MCP OAuth support for cursor (#28327)
* feat(mcp): allow native MCP OAuth redirect URIs (cursor://)

Discoverable OAuth /authorize rejected cursor:// callbacks because
validate_trusted_redirect_uri only accepted http/https. Add an
allowlisted native path with a built-in Cursor default and optional
MCP_TRUSTED_NATIVE_REDIRECT_URIS env for other clients.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): address Greptile native redirect URI review

Lowercase paths in normalizer so env allowlist entries match case-
insensitively. Tighten wildcard prefix matching to reject sibling
paths (e.g. callback-2) unless the prefix ends with /.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): reject query params on native OAuth redirect URIs

Greptile: normalization stripped query strings before allowlist compare,
so cursor://.../callback?injected=... could pass validation. Reject any
native redirect_uri with a query component (same as fragments).

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(model_cost_map): add mistral/ministral-8b-2512 entry

Mistral rotated the 'mistral/mistral-tiny' alias to return
'ministral-8b-2512' as the response model, which is not in the cost map.
This caused test_completion_mistral_api and
test_completion_mistral_api_modified_input to fail in
completion_cost lookup. Add the entry mirroring the existing
openrouter/mistralai/ministral-8b-2512 pricing.

* fix(mcp): lowercase default native redirect URIs

Make _parse_trusted_native_redirect_uris apply the same lowercasing
to built-in defaults as it does to env-var entries.

* fix(tests): backfill local model_cost into remote-fetched map

litellm.model_cost is loaded at import time from the URL pinned to main,
so pricing entries that exist only in this branch (e.g.
mistral/ministral-8b-2512, freshly added because Mistral now returns this
id from mistral-tiny) are absent at test time and completion_cost lookups
raise. Backfill the in-tree backup so cassette-driven cost calculations
resolve against the entries that ship with the branch under test.

Fixes the local_testing_part1 failures on test_completion_mistral_api and
test_completion_mistral_api_modified_input.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Claude <claude@anthropic.com>
2026-05-20 15:28:44 -07:00
..
auth Merge pull request #27977 from BerriAI/litellm_mcp_internal_delegate_pkce 2026-05-15 22:57:48 +05:30
guardrail_translation fix(tests): Add missing mocks for MCP IP filtering and updated APIs (#20652) 2026-02-07 11:30:49 -08:00
test_byok_oauth_endpoints.py feat(mcp): allow native MCP OAuth support for cursor (#28327) 2026-05-20 15:28:44 -07:00
test_db_credentials.py fix(mcp): re-encrypt user credentials during master-key rotation 2026-04-30 01:58:26 +00:00
test_discoverable_endpoints.py fix(mcp-oauth): PROXY_BASE_URL escape hatch + diagnostic logging for {"detail":"invalid_request"} (#28086) 2026-05-16 17:48:03 -07:00
test_is_tool_name_prefixed.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_jwt_mcp_enforcement.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_jwt_mcp_simple.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_cost_calculator.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_custom_fields.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_debug.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_discovery.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_hook_extra_headers.py feat(mcp): add OBO MCP Auth (#27421) 2026-05-07 15:35:21 -07:00
test_mcp_metadata_preservation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_server_manager.py fix(mcp): JWT on tools/list and REST tools/call server resolution (#28227) 2026-05-20 13:31:44 -07:00
test_mcp_server.py fix(mcp): JWT on tools/list and REST tools/call server resolution (#28227) 2026-05-20 13:31:44 -07:00
test_mcp_sigv4_auth.py style: black format test_mcp_sigv4_auth.py 2026-04-15 18:19:08 -07:00
test_mcp_stale_session.py feat(mcp): add delegate_auth_to_upstream flag for PKCE passthrough (#27834) 2026-05-13 12:06:13 -07:00
test_mcp_toolset_scope.py Litellm ishaan march23 - MCP Toolsets + GCP Caching fix (#25146) (#25155) 2026-04-04 16:23:21 -07:00
test_oauth2_token_cache.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_openapi_to_mcp_generator.py fix(mcp): forward extra_headers for OpenAPI MCP tools (#27383) 2026-05-09 15:10:54 -04:00
test_openapi_tool_auth.py fix(mcp): use canonical proxy_logging_obj, deny when MCP server is unresolvable 2026-05-01 22:28:46 +00:00
test_rest_endpoints.py fix(mcp): JWT on tools/list and REST tools/call server resolution (#28227) 2026-05-20 13:31:44 -07:00
test_semantic_tool_filter.py fix(mcp_semantic_tool_filter): match tools with client-side namespace prefix (#26078) (#26117) 2026-04-22 19:06:34 -07:00
test_short_mcp_tool_prefix.py fix(mcp): address greptile review on short tool prefix 2026-04-29 03:59:40 +00:00
test_ui_session_utils.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00