Skip to content

[Feat] MCP - Add support for streamablehttp_client MCP Servers #11628

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

Conversation

ishaan-jaff
Copy link
Contributor

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

[Feat] MCP - Add support for streamablehttp_client MCP Servers

Adds HTTP streaming support for MCP servers in LiteLLM and updates tests and CI configuration accordingly.

Implement HTTP streamablehttp_client transport in MCPServerManager for both list_tools and call_tool.

Adds support for streamablehttp_client MCP servers on LiteLLM

https://www.loom.com/share/ba1422987ec349a7a306372687cb825d?sid=4d30fff2-85e1-4b7a-a649-0d0a3a25233e

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
✅ Test

Changes

Copy link

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

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

Adds HTTP streaming support for MCP servers in LiteLLM and updates tests and CI configuration accordingly.

  • Implement HTTP streamablehttp_client transport in MCPServerManager for both list_tools and call_tool.
  • Introduce new async tests with mocks for HTTP transport behavior.
  • Bump mcp dependency version from 1.5.0 to 1.9.3 in .circleci/requirements.txt and CI scripts.

Reviewed Changes

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

File Description
tests/mcp_tests/test_mcp_server.py Added new HTTP-transport tests and mocks for streamablehttp_client.
litellm/proxy/_experimental/mcp_server/mcp_server_manager.py Implemented HTTP transport logic in _get_tools_from_server and call_tool.
.circleci/requirements.txt Updated mcp version to 1.9.3.
.circleci/config.yml Updated CI steps to install mcp==1.9.3
Comments suppressed due to low confidence (2)

tests/mcp_tests/test_mcp_server.py:48

  • This test relies on an environment variable but doesn’t skip or assert when the URL is missing. Consider adding if not os.environ.get(...): pytest.skip('No HTTPS server URL set') and include assertions to validate the returned tools and result.
"url": os.environ.get("ZAPIER_MCP_HTTPS_SERVER_URL"),

litellm/proxy/_experimental/mcp_server/mcp_server_manager.py:259

  • Returning an empty error result without any context can make debugging difficult. Consider including a descriptive error message in the CallToolResult, or raising an exception when an unsupported transport is encountered.
return CallToolResult(content=[], isError=True)


return tools_result.tools
elif server.transport == MCPTransport.http:
# TODO: implement http transport
return []
verbose_logger.debug(f"Using HTTP streamable transport for {server.url}")
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

[nitpick] The HTTP transport blocks in both _get_tools_from_server and call_tool are nearly identical. Consider extracting session initialization and mapping logic into a shared helper to reduce duplication.

Copilot uses AI. Check for mistakes.

@wagnerjt
Copy link
Contributor

Need the version bump in pyproject.yaml and the poetry.lock

@ishaan-jaff ishaan-jaff merged commit 02b02c7 into main Jun 12, 2025
43 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.

2 participants