MCP connection aborts after one minute (timeout is not honored) #6629
Replies: 7 comments 13 replies
-
The "timeout" is for initial connection when LC starts. If you are experiencing an "abort error" after 60 seconds, it's likely your hosting setup that is cutting the request. Most hosting setups will by default cut requests after 60 seconds if not fulfilled, and you can confirm this if you are experiencing an "error connecting to server" from the UI side. If you are in charge of the instance's setup, you can look into how this can be mitigated on the deployment end. The timeout is configurable with NGINX. Some hosting providers won't allow longer timeouts unless you are subscribed to Enterprise plans. There is nothing from the LibreChat configuration you can do to resolve this. |
Beta Was this translation helpful? Give feedback.
-
The bottom line is that LibeMCP side is forcibly aborting the connection after exactly 1 minute. |
Beta Was this translation helpful? Give feedback.
-
By "LibreChat" aborting the connection I mean it's the client side. It might be inside MCP client SDK or up the call stack in tools or chat api, etc.
which clearly indicates that the client has canceled the connection. I'll prepare an mcp server that can be used to reproduce it. |
Beta Was this translation helpful? Give feedback.
-
I've prepared MCP server that executes command longer but sends progress updates every 5 seconds to keep the connection alive. To run it you need to install uv. uv is python equivalent to npm. It provides
This mcp server provides just one command If you run the server with |
Beta Was this translation helpful? Give feedback.
-
Hi! OK, I've nailed it. It's Typescript/JS MCP client bug! (I'm calling it bug because it's starkly different behavior than python's, however it probably can and should be set to a higher value). I created two clients. Python and Typescript: https://github.com/emsi/slow-mcp/blob/master/src/client.py When I run the tests with python client it works as expected:
The server just calls the following script that prints number of seconds lapsed:
However the Typescript/JS client times out after EXACTLY 60000 milliseconds:
FYI: I've opened an issue on the typescript-sdk project: modelcontextprotocol/typescript-sdk#245 |
Beta Was this translation helpful? Give feedback.
-
I think it's working as expected, apologies I didn't direct you to adjusting the timeout sooner: mcpServers:
slow_mcp:
type: sse
url: http://0.0.0.0:3001/sse
timeout: 300000 # Configure this timeout for long operations |
Beta Was this translation helpful? Give feedback.
-
@danny-avila No it's not. Please read my previous messages and see the test clients. Your tests are using server that periodically sends some data and it's a global timeout. The problematic one is on the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
I have MCP server configured like this:
My server sends ping (progress update) every 5 seconds and works properly with ClaudeDesktop.
However, despite the
timeout
set to 10 minutes the tool is aborted exactly after a minute:The same is true to SSE servers:
Version Information
Steps to Reproduce
Create a MCP tool that takes more than 1 minut to finilize.
What browsers are you seeing the problem on?
No response
Relevant log output
Screenshots
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions