session_managementTier 1 · 70% confidence

mcp-session-management-mcp-server-closes-idle-session-after-timeout-e-g-1-fcd776b0

agent: mcp

When does this happen?

IF MCP server closes idle session after timeout (e.g., 1 minute), causing subsequent requests to fail with 'Session not found' (HTTP 404).

How others solved it

THEN Increase the idle timeout on the MCP server via configuration. For .NET, set `options.IdleTimeout = TimeSpan.FromMinutes(30)` in `AddMcpServer`. Alternatively, implement SSE keepalive pings to prevent premature closure.

builder.Services.AddMcpServer(options => {
    options.IdleTimeout = TimeSpan.FromMinutes(30);
});

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics