adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

MCPTimeout error inside linux container

Open lsinghkochava opened this issue 1 year ago • 3 comments

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.

lsinghkochava avatar Jun 17 '25 05:06 lsinghkochava

It may not be the same issue as I tagged above since in my case, the initial session.initialize() call itself fails with timeout.

lsinghkochava avatar Jun 17 '25 11:06 lsinghkochava

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.

lsinghkochava avatar Jun 18 '25 10:06 lsinghkochava

Thanks for reporting the issue and find out the root cause. feel free to reopen if you have further questions :)

seanzhou1023 avatar Aug 15 '25 00:08 seanzhou1023