Skip to content

[Fix] MCP - Ensure internal users can access /mcp and /mcp/ routes #12106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025

Conversation

ishaan-jaff
Copy link
Contributor

@ishaan-jaff ishaan-jaff commented Jun 27, 2025

[Fix] MCP - Ensure internal users can access /mcp and /mcp/ routes

This PR ensures internal users can access the /mcp and /mcp/ endpoints by extending route-validation logic, updating route definitions, and adding related unit tests.

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix
✅ Test

Changes

@ishaan-jaff ishaan-jaff requested a review from Copilot June 27, 2025 15:55
Copy link

vercel bot commented Jun 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 3:55pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures internal users can access the /mcp and /mcp/ endpoints by extending route-validation logic, updating route definitions, and adding related unit tests.

  • Extend is_llm_api_route to allow /mcp and /mcp/
  • Define mcp_routes in the route enum and include them in the combined routes list
  • Add unit tests for the new MCP routes

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/proxy_admin_ui_tests/test_route_check_unit_tests.py Added assertions for /mcp and /mcp/ routes
litellm/proxy/proxy_config.yaml Removed unrelated configuration sections (general_settings, etc.)
litellm/proxy/auth/route_checks.py Integrated mcp_routes into is_llm_api_route logic
litellm/proxy/_types.py Defined mcp_routes list and included it in the master routes set
Comments suppressed due to low confidence (3)

tests/proxy_admin_ui_tests/test_route_check_unit_tests.py:92

  • [nitpick] Consider adding unit tests for generic subpaths (e.g., /mcp/foo) to verify that the placeholder route /mcp/{subpath} is correctly handled.
    assert RouteChecks.is_llm_api_route("/mcp") is True

litellm/proxy/auth/route_checks.py:198

  • The mcp_routes list includes a placeholder pattern (/mcp/{subpath}), but check_route_access may only perform exact matches; consider adding fuzzy matching logic or parsing placeholders similar to OpenAI routes.
        if RouteChecks.check_route_access(

@ishaan-jaff ishaan-jaff merged commit e3c9318 into main Jun 27, 2025
38 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant