Title: Surface the JSON-RPC envelope in WithMCPParse for method-less messages so consumers need not re-read the body · Issue #3122 · github/github-mcp-server · GitHub
Open Graph Title: Surface the JSON-RPC envelope in WithMCPParse for method-less messages so consumers need not re-read the body · Issue #3122 · github/github-mcp-server
X Title: Surface the JSON-RPC envelope in WithMCPParse for method-less messages so consumers need not re-read the body · Issue #3122 · github/github-mcp-server
Description: Problem WithMCPParse returns early when the parsed message has no method: // Skip if not a valid JSON-RPC 2.0 request if mcpReq.JSONRPC != "2.0" || mcpReq.Method == "" { next.ServeHTTP(w, r) return } That is precisely the shape of a JSON...
Open Graph Description: Problem WithMCPParse returns early when the parsed message has no method: // Skip if not a valid JSON-RPC 2.0 request if mcpReq.JSONRPC != "2.0" || mcpReq.Method == "" { next.ServeHTTP(w, r) return...
X Description: Problem WithMCPParse returns early when the parsed message has no method: // Skip if not a valid JSON-RPC 2.0 request if mcpReq.JSONRPC != "2.0" || mcpReq.Method == "" { next.Se...
Opengraph URL: https://github.com/github/github-mcp-server/issues/3122
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Surface the JSON-RPC envelope in WithMCPParse for method-less messages so consumers need not re-read the body","articleBody":"## Problem\n\n`WithMCPParse` returns early when the parsed message has no `method`:\n\n```go\n// Skip if not a valid JSON-RPC 2.0 request\nif mcpReq.JSONRPC != \"2.0\" || mcpReq.Method == \"\" {\n next.ServeHTTP(w, r)\n return\n}\n```\n\nThat is precisely the shape of a JSON-RPC *response*, including the ping/heartbeat responses clients send back (`{\"jsonrpc\":\"2.0\",\"id\":42,\"result\":{}}`). For those, `MCPMethodInfo` is never populated, and a consumer cannot distinguish \"not parsed because it was a response\" from \"not parsed because it was malformed or non-MCP\".\n\n## Why this matters downstream\n\nIn `github/github-mcp-server-remote`, `requestctx.WithHandler` needs to know whether a request is a heartbeat (it is used to suppress log noise for pings). Because the parsed metadata cannot express that, it has to read and decode the body itself, independently of `WithMCPParse`.\n\nThat was the root of github/github-mcp-server-remote#938: two middleware each did `io.ReadAll` on the same body before any size limit applied. We fixed the memory amplification in github/github-mcp-server-remote#939 by enforcing the limit at the edge and bounding heartbeat detection to a 4 KiB prefix, but the duplicate read is still there in reduced form — every POST pays a bounded copy plus a `json.Unmarshal` that `WithMCPParse` is about to repeat a moment later.\n\nWe deliberately did not work around it downstream. The only in-repo option was a substring pre-filter before the unmarshal, which is not strictly semantics-preserving (a client escaping the key as `\"\\u0072esult\"` would change the result), so we left the read in place rather than take that risk.\n\n## Suggested change\n\nSurface the JSON-RPC envelope even when `method` is empty, so consumers can classify responses without re-reading the body. For example, keep the existing early return for genuinely non-MCP payloads but still record the envelope when `jsonrpc == \"2.0\"`:\n\n- add `ID` and a `Result` presence flag (or an `IsResponse bool`) to `MCPMethodInfo`, and\n- populate `MCPMethodInfo` for `jsonrpc == \"2.0\"` messages with an empty `method`, leaving `Method` empty as it is today.\n\nExisting consumers that switch on `Method` are unaffected, since the field keeps its current value.\n\n## Payoff\n\n`requestctx.WithHandler` could then move below `WithMCPParse` and read nothing at all: heartbeat classification would come from already-parsed metadata. That removes the last duplicate body read on the remote hot path (~1,250 RPS on 1 CPU / 1 GiB pods).\n\nHappy to send the PR if the shape sounds right.\n\n## References\n\n- github/github-mcp-server-remote#938 — original issue\n- github/github-mcp-server-remote#939 — remote-side fix, which documents this as the remaining follow-up\n- github/github-mcp-server#3111 — the upstream body-limit work this builds on","author":{"url":"https://github.com/SamMorrowDrums","@type":"Person","name":"SamMorrowDrums"},"datePublished":"2026-08-19T14:49:28Z","url":"https://github.com/github/github-mcp-server/issues/3122"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:15d680d2-d993-77c0-bbbd-6c8b381ddf5b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF8E:17E9B8:45A2DC:5F1DCA:6B068592 |
| html-safe-nonce | d0f095c8e8e5cc7d70cf3bc0b4a515de6d5606edce325368365232ce430ac340 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjhFOjE3RTlCODo0NUEyREM6NUYxRENBOjZCMDY4NTkyIiwidmlzaXRvcl9pZCI6IjIyMTI4MzAwMzY5ODA2NzM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 11e36f7beb9073680f4658df9e3cf389ba96119ab4e6b33bd32ec5ee92e99480 |
| hovercard-subject-tag | issue:5193952582 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3122/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9d47d04c78f977efddf4cdd0cb5e172f0e297b85c579271f095b658b04490d9/github/github-mcp-server/issues/3122 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9d47d04c78f977efddf4cdd0cb5e172f0e297b85c579271f095b658b04490d9/github/github-mcp-server/issues/3122 |
| og:image:alt | Problem WithMCPParse returns early when the parsed message has no method: // Skip if not a valid JSON-RPC 2.0 request if mcpReq.JSONRPC != "2.0" || mcpReq.Method == "" { next.ServeHTTP(w, r) return... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SamMorrowDrums |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6d3909414814ff86ce7da4c51a0f4918a13fb41b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width