[Bug]: support MCP Streamable HTTP Transport
Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).
- [x] I have checked the existing issues.
Describe the bug and reproduction steps
I just built an MCP server from scratch for use with Open Hands AI: https://github.com/createthis/diffcalculia_mcp
I noticed when configuring Open Hands AI to connect to the MCP server that I had to use /sse in my URL and that I couldn't use /mcp.
Here's the error from the log when I use /mcp:
20:13:55 - openhands:INFO: base.py:344 - In workspace mount mode, not initializing a new git repository.
20:13:55 - openhands:INFO: utils.py:52 - Initializing MCP agent for url='http://host.docker.internal:3002/mcp' api_key='******' with SSE connection...
20:13:55 - openhands:ERROR: client.py:64 - Error connecting to http://host.docker.internal:3002/mcp: unhandled errors in a TaskGroup (1 sub-exception)
20:13:55 - openhands:ERROR: utils.py:63 - Failed to connect to url='http://host.docker.internal:3002/mcp' api_key='******': unhandled errors in a TaskGroup (1 sub-exception)
And here's the success message when I use /sse:
19:55:11 - openhands:INFO: base.py:344 - In workspace mount mode, not initializing a new git repository.
19:55:11 - openhands:INFO: utils.py:52 - Initializing MCP agent for url='http://host.docker.internal:3002/sse' api_key='******' with SSE connection...
19:55:11 - openhands:INFO: client.py:90 - Connected to server with tools: ['patch', 'read_file']
I have unit tests and e2e tests for both SSE and Streamable clients and servers, so I'm reasonably confident by Streamable implementation works. I think Open Hands just doesn't support the newer Streamable protocol.
You can read more about this in the Typescript SDK docs (my server uses typescript): https://github.com/modelcontextprotocol/typescript-sdk?tab=readme-ov-file#backwards-compatibility
Or the Python SDK docs (I gather Open Hands uses the Python SDK): https://github.com/modelcontextprotocol/python-sdk?tab=readme-ov-file#streamable-http-transport
OpenHands Installation
Docker command in README
OpenHands Version
e26ca14-nikolaik
Operating System
MacOS
Logs, Errors, Screenshots, and Additional Context
No response
Hello! I have the same error with Grafana MCP server: https://github.com/grafana/mcp-grafana. I have tried with versions 0.35, 0.36 and 0.37
03:53:28 - openhands:INFO: utils.py:52 - Initializing MCP agent for url='http://localhost:8000/sse' api_key='******' with SSE connection...
03:53:28 - openhands:ERROR: client.py:64 - Error connecting to http://localhost:8000/sse: unhandled errors in a TaskGroup (1 sub-exception)
03:53:28 - openhands:ERROR: utils.py:63 - Failed to connect to url='http://localhost:8000/sse' api_key='******': unhandled errors in a TaskGroup (1 sub-exception)
03:53:28 - openhands:INFO: utils.py:52 - Initializing MCP agent for url='http://host.docker.internal:38390/sse' api_key='******' with SSE connection...
03:53:28 - openhands:ERROR: client.py:64 - Error connecting to http://host.docker.internal:38390/sse: 1 validation error for ListToolsResult
tools
Field required [type=missing, input_value={}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.11/v/missing
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for over 30 days with no activity.