You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After running the AspNetCoreSseServer sample with Cursor, I encounter the following error after 5 minutes of idle time: SSE error: TypeError: terminated: Body Timeout Error
To Reproduce
Steps to reproduce the behavior:
Run the sample SSE server: cd samples/AspNetCoreSseServer && dotnet run --configuration Debug
Register the server in MCP config: { "mcpServers": { "sse-test-5": { "url": "http://localhost:3001/sse" } } }
Observe that it connects successfully and appears online in Cursor
Wait for 5 minutes (no interaction)
Observe the error: SSE error: TypeError: terminated: Body Timeout Error
Expected behavior
The SSE connection should remain open indefinitely (or at least longer than 5 minutes) if idle, without triggering a timeout or client termination error.
I have the same issue with VS Code / GH Copilot . My MCP Server was written using the C#SDK and is running as a Docker container. Timeout error after 5 minutes.
If you haven't already, I recommend updating your ModelContextProtocol.AspNetCore package to 0.1.0-preview.12. In that release, I increased the default HttpServerTransportOptions.IdleTimeout from 5 minutes to 2 hours. You can use that option to make the timeout even longer. Timeout.Infinite is also now supported, but it's not a silver bullet since there's also a MaxIdleSessionCount which applies to any idle session even before the timeout to avoid potentially running out of memory. Still, this should be perfectly fine for local scenarios where you control the only client, Cursor.
The new stateless Streamable HTTP support added by #392 gets rid of the need for an IdleTimeout entirely and can be used more reliably for remote connections since it does not rely on storing per-session state in server memory.
Describe the bug
After running the AspNetCoreSseServer sample with Cursor, I encounter the following error after 5 minutes of idle time:
SSE error: TypeError: terminated: Body Timeout Error
To Reproduce
Steps to reproduce the behavior:
cd samples/AspNetCoreSseServer && dotnet run --configuration Debug
{ "mcpServers": { "sse-test-5": { "url": "http://localhost:3001/sse" } } }
SSE error: TypeError: terminated: Body Timeout Error
Expected behavior
The SSE connection should remain open indefinitely (or at least longer than 5 minutes) if idle, without triggering a timeout or client termination error.
Logs
SSE Server Logs:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:3001
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /Users/shaykeren/work/csharp-sdk/samples/AspNetCoreSseServer
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0) method 'initialize' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'initialize' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0) method 'initialize' request handler called.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0) method 'initialize' request handler called.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0) method 'initialize' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'initialize' request handler completed.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'initialize' request handler completed.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'initialize' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[570385771]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler called.
info: ModelContextProtocol.Server.McpServer[1867955179]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) method 'tools/list' request handler completed.
info: ModelContextProtocol.Server.McpServer[2103773711]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) message processing canceled.
info: ModelContextProtocol.Server.McpServer[2081236114]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shutting down.
info: ModelContextProtocol.Server.McpServer[613617602]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shut down.
info: ModelContextProtocol.Server.McpServer[2103773711]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) message processing canceled.
info: ModelContextProtocol.Server.McpServer[2081236114]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shutting down.
info: ModelContextProtocol.Server.McpServer[613617602]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shut down.
info: ModelContextProtocol.Server.McpServer[2103773711]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) message processing canceled.
info: ModelContextProtocol.Server.McpServer[2081236114]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shutting down.
info: ModelContextProtocol.Server.McpServer[613617602]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shut down.
info: ModelContextProtocol.Server.McpServer[2103773711]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) message processing canceled.
info: ModelContextProtocol.Server.McpServer[2081236114]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shutting down.
info: ModelContextProtocol.Server.McpServer[613617602]
Server (AspNetCoreSseServer 1.0.0.0), Client (cursor-vscode 1.0.0) shut down.
Cursor MCP Output:
2025-04-23 08:21:43.090 [info] test: Reusing existing sse client
2025-04-23 08:21:43.090 [info] test: Connected to sse server, fetching offerings
2025-04-23 08:21:43.094 [info] listOfferings: Found 2 tools
2025-04-23 08:21:43.094 [info] test: Found 2 tools, 0 resources, and 0 resource templates
2025-04-23 08:21:43.095 [info] -mcp: Client closed for command
2025-04-23 08:21:43.095 [error] -mcp: Error in MCP: Client closed
2025-04-23 08:21:43.096 [info] test: Handling CreateClient action
2025-04-23 08:21:43.096 [info] test: getOrCreateClient for sse server. process.platform: darwin isElectron: true
2025-04-23 08:21:43.096 [info] test: Reusing existing sse client
2025-04-23 08:21:43.097 [info] -mcp: Handling ListOfferings action
2025-04-23 08:21:43.097 [error] -mcp: No server info found
2025-04-23 08:21:43.097 [info] test: Handling ListOfferings action
2025-04-23 08:21:43.097 [info] test: Listing offerings
2025-04-23 08:21:43.097 [info] test: getOrCreateClient for sse server. process.platform: darwin isElectron: true
2025-04-23 08:21:43.097 [info] test: Reusing existing sse client
2025-04-23 08:21:43.097 [info] test: Connected to sse server, fetching offerings
2025-04-23 08:21:43.101 [info] listOfferings: Found 2 tools
2025-04-23 08:21:43.101 [info] test: Found 2 tools, 0 resources, and 0 resource templates
2025-04-23 08:21:43.152 [info] -mcp: Client closed for command
2025-04-23 08:21:43.152 [error] -mcp: Error in MCP: Client closed
2025-04-23 08:21:43.170 [info] -mcp: Client closed for command
2025-04-23 08:21:43.170 [error] -mcp: Error in MCP: Client closed
2025-04-23 08:26:45.289 [error] test: Client error for command SSE error: TypeError: terminated: Body Timeout Error
2025-04-23 08:26:45.290 [error] test: Error in MCP: SSE error: TypeError: terminated: Body Timeout Error
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: