modelcontextprotocol / modelcontextprotocol/go-sdk

Expose max JSON-RPC frame/message size for stdio transports

Open
#984 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs confirmation
Dominant language
Go
Stars
5.1k
Forks
543
Avg merge
1d 17h
Merged PRs (30d)
37

Description

Doc Relay uses the Go MCP SDK with child MCP servers over stdio (CommandTransport). We need a host-side bound on JSON-RPC frame/message size so a buggy or malicious child cannot send one very large newline-delimited JSON frame and force the parent to buffer/decode it before application code can reject it.\n\nCurrent observation in v1.6.0: the framing/read loop is owned inside the SDK transport/JSON-RPC stack, so hosts using CommandTransport do not appear to have a supported seam equivalent to Decoder.MaxBytes, io.LimitReader per frame, or MaxMessageBytes. Replacing the SDK framing locally would conflict with using the SDK as the JSON-RPC/MCP boundary.\n\nRequested API shape could be any of:\n\n- a MaxMessageBytes/MaxFrameBytes option on CommandTransport or Client/Server options,\n- an exported transport wrapper hook that bounds each newline-delimited frame before JSON decoding, or\n- documented guidance for safely enforcing this without reimplementing the SDK framing loop.\n\nThe important behavior is that an oversized child stdout frame is rejected and the connection is closed before unbounded parent heap growth.

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 with CommandTransport and the SDK transport/JSON-RPC framing and read loop described in the issue; trace where newline-delimited child stdout is buffered and decoded. Compare the available Client or Server options and transport seams, then verify that an oversized frame is rejected and the connection closes before JSON decoding or unbounded parent buffering.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.