-
Notifications
You must be signed in to change notification settings - Fork 1.6k
MCP SDK hangs #813
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
Comments
Update: another colleague of mine had the same issue on their laptop. So this seems an issue related to the MCP Python SDK (or the Gemini integration). |
Does using session.call_tool works, without any LLM inteaction? |
No, I debugged this with Claude-4-Sonnet: 2. Testing direct tool call...
INFO:__main__:Testing direct tool call...
INFO:__main__:Starting MCP server using stdio transport
INFO:mcp.server.lowlevel.server:Processing request of type ListToolsRequest
INFO:__main__:Available tools: ['retrieve_articles']
INFO:mcp.server.lowlevel.server:Processing request of type CallToolRequest
INFO:__main__:Starting retrieval for query: test
INFO:__main__:Calling retriever.retrieve_articles...
INFO:app.implementations.retrievers.python_retriever:Search method: hybrid
INFO:app.implementations.retrievers.python_retriever:Initial query given to the retriever: test
INFO:elastic_transport.transport:POST search [status:200 duration:1.430s]
INFO:app.implementations.vector_databases.elastic_search_vector_database:ES response time via 'took' (ms): 1302
INFO:app.implementations.vector_databases.elastic_search_vector_database:ES response time (s): 1.5721080303192139
INFO:app.implementations.retrievers.python_retriever:Number of results: 30
INFO:__main__:Retrieved 5 articles
INFO:__main__:Returning result of length: 718 characters It retrieves 5 articles as there's also reranking involved after hybrid search, but then hangs at this line: result = await asyncio.wait_for(
session.call_tool("retrieve_articles", {"query": "test"}),
timeout=60.0
) The MCP server itself is proprietary, it just returns articles from an ElasticSearch database as a long string. It works in Claude Desktop and with the MCP inspection tool, so I would assume there is something wrong with the "stdio" implementation. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I have developed a local MCP server which performs retrieval to an ElasticSearch database using hybrid search. The MCP server works fine when adding it to Claude Desktop, or when running the MCP Inspection tool using
mcp dev mcp_server.py
. Here's how I've added it to Claude Desktop (I have replaced my UV directory, GCP credentials and project name):However, when running the MCP server locally using the "stdio" protocol, the connection hangs. The MCP server performs its task, but then for some reason the results are not passed to the LLM API.
To Reproduce
I run the following script based on the docs:
This is the output:
=> after that, it hangs, the LLM does not return a result.
Expected behavior
I would expect a smooth response from the LLM, based on the tool call to the MCP server.
The sample code snippet from the docs works fine, but it does not for my MCP server (even though the MCP server works fine in Claude Desktop as well as within the MCP inspection tool).
Device:
The text was updated successfully, but these errors were encountered: