Cursor MCP client does not restart session on 404 Session not found

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

MCP specification in transports section 2.5 regarding session management it is clearly stated that if server returns 404 Session not found client MUST reinitialise the session, however cursor client does not do that. So, if for example stateless server gets redeployed client usually silently stop using MCP or if forced jsut complains about an error without trying to reinitialise it.

Restarting agent helps

Steps to Reproduce

Deploy and MCP server that does not persist sessions outside in process memory
Use it in the chat
Stop and redeploy server with fresh session list
Ask in the same chat cursor to use MCP

Expected Behavior

When server gets redeployed I expect client retrying and reinitialising session again.

Operating System

MacOS

Version Information

2026.05.16-0338208

For AI issues: which model did you use?

Composer 2 Fast

Additional Information

We use official python sdk for MCP server development. It also could be related to ambiguity in the return codes Clarify JSON-RPC error code for 'session not found' responses · Issue #1821 · modelcontextprotocol/python-sdk · GitHub

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey @Pavel_Plotnikov!

Thanks, I can reproduce this. Cursor (the IDE) respects the spec, but the CLI doesn’t right now. I’ve filed a bug with the team. Unfortunately, until that’s resolved, you’ll need to exit and re-run agent whenever the MCP server gets redeployed. That gets you a fresh session and the tool calls work on the first try again.

If it’s easy on your end, running the MCP server with persistent session state (something durable rather than in-process memory) would also sidestep this.

Cool, thank you for reproducing it and moving it forward! I do appreciate fast response.

We actually might have a solution for this problem that is okay for our specific use case.

Since our MCP server does not really need session so python MCP sdk has this flag stateless python-sdk/src/mcp/server/streamable_http_manager.py at e8e64842781c66b613872cf394de6e7d6f6925bf · modelcontextprotocol/python-sdk · GitHub .

So when it is True it will create and close session on every request. I will verify this solution in production today or tomorrow but seems works for us.

However, i would appreciate a fix from client side anyway since in the future we might start using sessions :wink: