modelcontextprotocol / modelcontextprotocol/go-sdk
Expose max JSON-RPC frame/message size for stdio transports
Nobody has claimed this yet.
- 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
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 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