mcp: rejected request IDs receive no JSON-RPC error envelope
维护者通常 1 天内回复
评估
调研方向
Start with the StreamableHTTPHandler and IO/stdio request decoding and read paths; the issue does not name specific files or tests. Reproduce the invalid-ID request on both transports, then inspect how each handles decoder rejection and frames errors. Done means both return an Invalid Request (-32600) envelope with id null, HTTP uses 400 and application/json, IO/stdio continues to the following valid request, and the rejected request is not dispatched.
由索引模型根据 Issue 内容生成。
描述
Problem
A syntactically valid, single JSON-RPC request with an ID rejected by the decoder does not receive a JSON-RPC error response:
{"jsonrpc":"2.0","id":true,"method":"ping"}
On upstream main d1a225e:
- Streamable HTTP returns HTTP 400 with a
text/plainbody beginningmalformed payload, rather than a JSON-RPC error envelope. - The IO/stdio transport returns
parse error: invalid ID type boolfromRead, writes no response, and does not deliver the subsequent valid request in that read call. The connection read loop treats this as a terminal read error.
The same behavior occurs for object and array IDs. These cases reproduce independently of the pending numeric-ID precision fixes.
Expected behavior
For a single request whose ID cannot be accepted, return a JSON-RPC Invalid Request error (-32600) with an explicit id: null. Over HTTP, use HTTP 400 and application/json. Over IO/stdio, write the error and continue reading subsequent valid messages. Do not dispatch the rejected request.
The response ID requirement comes from https://www.jsonrpc.org/specification#response_object. This report concerns structurally invalid IDs, not a new numeric range policy.
Reproduction
HTTP: POST the above body to a StreamableHTTPHandler with Content-Type application/json and Accept application/json, text/event-stream.
IO/stdio: feed the above JSON followed by a newline and {"jsonrpc":"2.0","id":7,"method":"ping"}. The current transport returns an error without writing a JSON-RPC response.
Regression tests reproduce both failures on the unmodified base. Repeating the invalid frame 1000 times before a valid request tests iterative recovery.
Related work and scope
- #1209 / #1210 concern syntactically malformed JSON and decoder resynchronization. Here JSON decoding succeeds, so that recovery machinery is unnecessary.
- #976 concerns other malformed request envelopes.
- #1375 / #1253 address exact numeric identity parsing. Once a numeric ID is rejected by those decoders, it needs the same error framing. This change can be reviewed independently and does not redefine numeric acceptance.
Legacy batch handling, invalid response handling, absent/null request IDs, and malformed JSON recovery are outside this narrowly scoped fix.
- 主要语言
- Go
- 星标
- 5.3k
- 派生
- 607
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 80
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/go-sdk 的其他 Issue
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensions可能重新可做 关联的 PR 已关闭且未合并。 未关闭needs investigation
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/go-sdk#745 · 13 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
mcp: a second subscriptions/listen for the same URI silences the first可能已有人在做 @jmrplens 今天认领。 未关闭
modelcontextprotocol/go-sdk#1489 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
mcp: ClientSession.CallTool omits Mcp-Param-* headers unless the tool is in the ListTools cache, so a call without a prior tools/list is rejected可能已有人在做 @huynle-dev 今天认领。 未关闭
难度 4/5 1-2 天 新手友好度 35/100
modelcontextprotocol/go-sdk#1481 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
mcp: list_changed can only be broadcast; a server cannot notify one session (2026-07-28 subscriptions/listen)可能已有人在做 @huynle-dev 今天认领。 未关闭
难度 4/5 1-2 天 新手友好度 32/100
modelcontextprotocol/go-sdk#1480 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
mcp: Client.Connect falls back to initialize after a 401 on server/discover, running the authorization flow twice可能已有人在做 @kerthans 于 12 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
modelcontextprotocol/go-sdk#1423 · 1 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/go-sdk 的全部 Issue
相似的 Issue
-
bug good first issue help wanted
难度 2/5 1-3 小时 新手友好度 70/100
-
[mesheryctl] design delete fails when passing file or URL as positional argument可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭component/mesheryctl kind/bug language/go
难度 2/5 1-3 小时 新手友好度 74/100
meshery/meshery#22772 · 3 条评论 ·
维护者通常 1 天内回复
-
backend security size:S
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
limitlessprojects/Go-Hybrid#3342 ·
维护者通常 1 天内回复
-
status/ready type/bug
难度 2/5 1-3 小时 新手友好度 65/100
buildpacks/pack#2733 ·
维护者通常 1 天内回复