modelcontextprotocol / modelcontextprotocol/servers
filesystem: ~1MB JSON-RPC line on stdio causes crash or zombie state
Nobody has claimed this yet.
- 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
- Start the server:
npx -y @modelcontextprotocol/server-filesystem /tmp
- 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.)
- 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/listtraffic 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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