MCPTimeout error inside linux container
I have a simple refinement loop agent setup (paired with mongodb-mcp-server) that runs perfectly through adk web, but this results in a MCPTimeout error when run in a linux container which I had setup following documentation over at https://google.github.io/adk-docs/deploy/gke/#code-files
{"error": "Timed out while waiting for response to ClientRequest. Waited 5.0 seconds."}
Here's my mcp configuration -
mcp_toolset = MCPToolset(
connection_params=StdioConnectionParams(
timeout=5,
server_params=StdioServerParameters(
command="npx",
args=[
"-y",
"mongodb-mcp-server",
"--connectionString",
os.getenv("MONGODB_CONNECTION_STRING"),
"--readOnly"
]
)
)
)
compose config
agent:
build: .
ports:
- "8000:8000"
environment:
- PORT=8000
- MONGODB_CONNECTION_STRING=<>
depends_on:
db:
condition: service_healthy
restart: unless-stopped
This may very well be an issue with the SDK (https://github.com/modelcontextprotocol/typescript-sdk/issues/576 or similar). I'm looking to start a conversation on it.
It may not be the same issue as I tagged above since in my case, the initial session.initialize() call itself fails with timeout.
Finally figured out the issue, the npx commands needs to download and setup the required packages before the stdio server can be spun up, 5 seconds are not nearly enough for that. I'm going to stick with increasing this timeout to a reasonable amount for now.
Thanks for reporting the issue and find out the root cause. feel free to reopen if you have further questions :)