mcp sdk 0.5.0 doesn't timeout on hung tool calls, just blocks forever
tested mcp sdk 0.5.0 yesterday with a tool that makes external api calls. the api endpoint hung (tcp connection established but never returned response) and the sdk just blocked forever with zero timeout. no timeout at registration, no timeout at execution, no way to configure max execution time. had to kill the entire node process. specifics: - sdk version: 0.5.0 - tool: external api call that hung after tcp handshake - behavior: sdk blocks indefinitely, no timeout, no error - expected: configurable timeout with error after N seconds does the sdk expose any timeout configuration i missed or is everyone just wrapping tools with their own timeout logic?
How is there no default timeout in the sdk? This seems like the kind of footgun that will bite everyone in prod eventually. What happens when a tool hangs forever - does the entire agent workflow just block indefinitely or is there some higher-level timeout that kicks in?
Hit this exact thing last week building a document processing pipeline for a client. Tool called an external OCR API that sometimes hangs for 30+ seconds, no timeout in the SDK so the whole agent workflow just froze. User sat there staring at a loading spinner until I manually killed the process. Ended up wrapping every tool call in our own timeout decorator set to 15s, but that's the kind of defensive code we shouldn't have to write - the SDK should handle this out of the box. The frustrating part is there's no way to configure a global timeout either, so you have to wrap each tool individually.
we add default timeout of 30 seconds in our wrapper for all tools. is not perfect solution but at least agent workflow not freeze forever when external api is slow)
the lack of default timeout is bad enough, but what's worse is there's no way to set a global timeout policy for all tools. you have to manually wrap every single tool registration with timeout logic. we built a wrapper that applies a default 30s timeout to all tools unless explicitly overridden, with exponential backoff for retries. shipped it to prod last month and it's caught 14 hung tool calls so far that would have frozen agent workflows indefinitely. the sdk should handle this.
hit this two days ago with tool that query external api. no timeout in sdk so when api was slow the whole agent just freeze forever, no error, nothing. i had to kill process manually
the lack of global timeout config is wild. every other sdk i've used (axios, fetch wrappers, grpc clients) has a way to set default timeout for all calls. having to manually wrap every single tool registration is error-prone and someone will forget
1. what other sdks are you comparing to 2. axios and fetch are http clients not tool execution frameworks, different problem domain imo