Description
Describe the bug
The JS/TS client sdk has 60 seconds timeout that is not affected by server sending progress update.
On the same mcp server tool, the python client sdk works as expected but the js/ts sdk times out with:
file:///.../@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:282
const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
^
McpError: MCP error -32001: Request timed out
at Timeout.timeoutHandler (file:///.../@modelcontextprotocol/sdk/dist/esm/shared/protocol.js:282:49)
at listOnTimeout (node:internal/timers:611:17)
at process.processTimers (node:internal/timers:546:7) {
code: -32001,
data: { timeout: 60000 }
}
Node.js v23.10.0
I have created an mcp server that is doing some "heavy" task that takes more than 60 seconds, though this server sends progress updates every 5 seconds to keep the connection alive.
You can run the server like this:
uvx --quiet --refresh git+https://github.com/emsi/slow-mcp --transport sse
(requires uvx! https://docs.astral.sh/uv/getting-started/installation/)
I've created two clients. Python and Typescript:
https://github.com/emsi/slow-mcp/blob/master/src/client.py
https://github.com/emsi/slow-mcp/blob/master/src/client.mjs
When I run the tests with python client it works as expected:
$ python3 ./src/client.py
[03/31/25 22:05:22] INFO Processing request of type ListResourcesRequest server.py:534
INFO Processing request of type ListToolsRequest server.py:534
Tools: meta=None nextCursor=None tools=[Tool(name='run_command', description='Run command and report progress.', inputSchema={'properties': {'timeout': {'default': 300, 'title': 'Timeout', 'type': 'integer'}}, 'title': 'run_commandArguments', 'type': 'object'})]
INFO Processing request of type CallToolRequest server.py:534
Result: meta=None content=[TextContent(type='text', text='1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78\n79\n80\n81\n82\n83\n84\n85\n86\n87\n88\n89\n90\n91\n92\n93\n94\n95\n96\n97\n98\n99\n100\n101\n102\n103\n104\n105\n106\n107\n108\n109\n110\n111\n112\n113\n114\n115\n116\n117\n118\n119\n120\n121\n122\n123\n124\n125\n', annotations=None)] isError=False
The server just calls the following script that prints number of seconds lapsed:
#!/bin/sh
for sec in $(seq 1 125); do
sleep 1
echo "$sec"
done
However the Typescript/JS client times out after 60000 milliseconds!
To Reproduce
- Make sure to install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
(my slow_mcp server requires it) - Download example client: https://github.com/emsi/slow-mcp/blob/master/src/client.mjs
- Install sdk
npm install @modelcontextprotocol/sdk
:) - Run the client:
node src/client.mjs
Expected behavior
The timeout should be longer. Some tasks might easily take more than few minutes and if the server is sending updates or pings the timeout should reset.
At the very least both python and js/ts sdk should have identical, longer, timeouts.