modelcontextprotocol / modelcontextprotocol/servers

filesystem: ~1MB JSON-RPC line on stdio causes crash or zombie state

Open
#4,207 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Describe the bug
The secure-filesystem-server MCP server becomes unavailable after receiving a single ~1 MB JSON-RPC message on stdio.

Unlike truncated JSON or type-confused fields, this payload is syntactically valid JSON-RPC. The failure is consistent with missing per-line size limits and/or unbounded buffering / JSON.parse on huge stdin lines, leading to memory pressure, event-loop blocking, or a broken read loop.

Environment
OS: Linux
Platform: Cursor Desktop
MCP server: @modelcontextprotocol/server-filesystem via npx -y
Reported serverInfo: {"name":"secure-filesystem-server","version":"0.2.0"}

To Reproduce

  1. Start the server:
npx -y @modelcontextprotocol/server-filesystem /tmp
  1. After a normal session is established (or on a fresh stdio session), write one newline-terminated line whose JSON body is approximately 1 MB. For example:
{
  "jsonrpc": "2.0",
  "method": "echo",
  "params": { "data": "<1,048,576 × 'A'>" },
  "id": 9999
}

(Exact construction: "A" * 1024 * 1024 inside params.data, then json.dumps + \n.)

  1. Wait ~200 ms, then send a valid follow-up request.

Expected behavior

  • Enforce a maximum stdin line / message size (e.g. 64 KiB–256 KiB, aligned with MCP/host limits) before full buffering or JSON.parse.
  • On oversize input: return a JSON-RPC error (or drop the line per transport rules), log a clear stderr line, and continue processing subsequent messages.
  • Server process remains alive and responsive to normal initialize / tools/list traffic after the oversized line.

Actual behaviour
Observed failure modes:

  • Node process exits (transport closes abruptly), or
  • Process still running but does not respond to the post-fuzz liveness probe (“zombie state”).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with npx -y @modelcontextprotocol/server-filesystem /tmp and a newline-terminated ~1 MB JSON-RPC message on the stdio entry point. Trace the oversized-line handling and JSON.parse path, then verify that an oversize request is handled clearly and that subsequent initialize or tools/list traffic remains responsive.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.