Skip to content

Server hangs indefinitely when JSON-RPC request ID exceeds #1765

@manthanghasadiya

Description

@manthanghasadiya

Describe the bug
MCP server becomes completely unresponsive when receiving a JSON-RPC request with an id value exceeding Number.MAX_SAFE_INTEGER (9007199254740991). The server doesn't crash or return an error - it simply stops responding to all requests permanently.

To Reproduce

  1. Start any MCP server using the TypeScript SDK
  2. Initialize the connection normally
  3. Send a request with id: 9007199254740992 (MAX_SAFE_INTEGER + 1)
  4. Server hangs indefinitely - no response, no error
{"jsonrpc":"2.0","id":9007199254740992,"method":"tools/list"}

Expected behavior
Server should either:

  • Return a JSON-RPC error response for invalid ID
  • Reject the request and continue processing other requests

Actual behavior
Server enters permanent deadlock. Process stays alive (low CPU, ~55MB memory) but responds to nothing. Requires manual restart.

Logs
No error output - server silently hangs.

Process alive: Yes
CPU: 0.25%
Memory: 54MB
Response: None (waited 10+ minutes)

Additional context

  • Tested on @modelcontextprotocol/sdk latest version
  • Reproducible 100% of the time
  • Single malformed request is enough to freeze the server
  • IDs at or below MAX_SAFE_INTEGER work fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions