Change timeout for MCP Server (ADK enforces 5 seconds)
So i am using u/playwright/mcp@latest mcp server and got it working eventually. The issue i have now is that i get timeout error often:
{"error": "Timed out while waiting for response to ClientRequest. Waited 5.0 seconds."}
I asked on their repo and they said that the default is not 5 seconds and ADT set that limit itself.
The ADK documentation says:
connection_params: The connection parameters to the MCP server. Can be:
StdioConnectionParams for using local mcp server (e.g. using npx or
python3); or SseConnectionParams for a local/remote SSE server; or
StreamableHTTPConnectionParams for local/remote Streamable http
server. Note, StdioServerParameters is also supported for using local
mcp server (e.g. using npx or python3 ), but it does not support
timeout, and we recommend to use StdioConnectionParams instead when
timeout is needed.
But i cant figure out how to change the enforced 5 second limit. The commented out options dont work: root_agent = LlmAgent( model="gemini-2.0-flash", name="browser_MCP_Agent", instruction="You search the web in order to answer the user's question.", tools=[ MCPToolset( connection_params=StdioServerParameters( command="npx", args=[ "@playwright/mcp@latest", "--browser", "brave", "--headless", "--vision", # "--timeout", "60" ], # timeout=60, ) ), ], ) root_agent = LlmAgent( model="gemini-2.0-flash", name="browser_MCP_Agent", instruction="You search the web in order to answer the user's question.", tools=[ MCPToolset( connection_params=StdioServerParameters( command="npx", args=[ "@playwright/mcp@latest", "--browser", "brave", "--headless", "--vision", # "--timeout", "60" ], # timeout=60, ) ), ], )
You can do this on the latest version
mcp_toolset = MCPToolset(
connection_params=StdioConnectionParams(
timeout=15,
server_params=StdioServerParameters(
command="npx",
args=[
"@playwright/mcp@latest",
"--browser", "brave",
"--headless",
"--vision",
]
)
)
)
You can do this on the latest version
mcp_toolset = MCPToolset( connection_params=StdioConnectionParams( timeout=15, server_params=StdioServerParameters( command="npx", args=[ "@playwright/mcp@latest", "--browser", "brave", "--headless", "--vision", ] ) ) )
Thanks! I got your changes working I think! The model seem to not wait for the the time specified by the argument but it does wait alot longer now!
Closing this as it's fixed now.