Skip to content

[Feat] MCP expose streamable https endpoint for LiteLLM Proxy #11645

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 30 commits into from
Jun 12, 2025

Conversation

ishaan-jaff
Copy link
Contributor

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

[Feat] MCP expose streamable https endpoint for LiteLLM Proxy

Closes #11603

This PR exposes a streamable HTTPS endpoint for the LiteLLM Proxy MCP serve

h/t @wagnerjt for the initial scoping work and help on this

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

🆕 New Feature
🚄 Infrastructure
✅ Test

Changes

Copy link

vercel bot commented Jun 12, 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 12, 2025 11:25pm

Copilot

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 exposes a streamable HTTPS endpoint for the LiteLLM Proxy MCP server. Key changes include replacing the MCP router with an app mount using a new BASE_MCP_ROUTE constant, implementing a health check endpoint, and refactoring MCP server initialization to use StreamableHTTPSessionManager for both HTTP and SSE requests.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
litellm/proxy/proxy_server.py Updated to import BASE_MCP_ROUTE and mount the new MCP app instead of including a router.
litellm/proxy/_experimental/mcp_server/server.py Introduced session manager initialization/shutdown logic and new endpoints for streamable HTTP and SSE.
litellm/constants.py Added the BASE_MCP_ROUTE constant to support MCP app mounting.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ishaan-jaff ishaan-jaff merged commit 7947139 into main Jun 12, 2025
32 of 46 checks passed
X4tar pushed a commit to X4tar/litellm that referenced this pull request Jun 17, 2025
…I#11645)

* feat - add https mcp support

* fixes for MCP http integration

* fix code QA

* bump mcp dep

* test_mcp_server_manager_https_server

* test mcp server https

* fix linting error

* bump mcp in poetry

* fix import streamablehttp_client

* fix streamablehttp_client

* fix streamablehttp_client

* add streamablehttp_client

* add simple https server

* working mounted app

* working HTTPS mcp streamable

* fix code QA check

* feat: add MCP Server

* fix - init just as fastapi app

* add LITELLM_MCP_SERVER_DESCRIPTION

* fix importing / init litellm app

* Update litellm/proxy/_experimental/mcp_server/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update litellm/proxy/_experimental/mcp_server/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fixes based on review + code check

* fix linting

* test_streamable_http_mcp_handler_mock

* fix python 3.13 install

* fix deps test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

[Feature]: Upgrade to the MCP streamable http transport
2 participants