GitLab MCP server runs a tools/call that has no JSON-RPC id and answers 202 with no result
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Both GitLab MCP endpoints, /api/v4/mcp and /api/v4/orbit/mcp, run a tools/call whose body has no JSON-RPC id, then answer 202 Accepted with an empty body. The tool runs and the client never gets the result.
The Orbit endpoint also accepts an id of any JSON type. A boolean, a float or an array gets a normal result with that id echoed back. MCP allows only a string or an integer, and the main endpoint already rejects the others.
Every MCP protocol version says a request must have an id. A body without one is a notification, and a server that can't accept a notification must answer with an HTTP error status. This is true for every protocol version the server supports, not only 2026-07-28.
The id here is the JSON-RPC envelope field that pairs a request with its response. It is not a tool argument: a create call through save_merge_request leaves out merge_request_iid but still sends an envelope id.
This doesn't appear to happen in production. Recent production logs show no tools/call without an id, so no client we know of sends one. The severity is low, and the fix stops a client bug from running a tool with no reply.
Steps to reproduce
-
Create an OAuth or personal access token with the
mcpscope. -
POST this body to
/api/v4/mcp, with noid:{"jsonrpc":"2.0","method":"tools/call","params":{"name":"save_note","arguments":{"project_id":"<project path>","merge_request_iid":<iid>,"body":"no id"}}} -
Open the merge request.
Example Project
None needed. Any project with a merge request.
What is the current bug behavior?
The server answers 202 Accepted with an empty body, and the note is created.
What is the expected correct behavior?
The server answers 400 Bad Request with a JSON-RPC -32600 (Invalid Request) error that has no id, and the tool does not run.
Relevant logs and/or screenshots
Why it happens, and the spec text
- The
tools/callbranch dispatches toHandlers::CallToolwhether or not the body has anid(base.rb:288-297). format_jsonrpc_responsethen answers 202 with no body becauseparams[:id]is nil (base.rb:201-218).tools/list,initializeandpingwithout anidalso run and answer 202. They have no side effects.- Orbit's
invoke_basic_handlerruns the handler whether or not the body has anid(orbit/mcp.rb:59-72), and itsformat_jsonrpc_responseanswers 202 the same way (#L87). Orbit queries are read-only. - Orbit declares
idwith no type (orbit/mcp.rb:105-106). The main endpoint usestypes: [Integer, String]with an identitycoerce_with(base.rb:238).
Spec text:
- Base protocol, 2025-06-18, 2025-11-25 and the draft: "Requests MUST include a string or integer ID." Notifications "MUST NOT include an ID", and "The receiver MUST NOT send a response."
- Streamable HTTP, 2025-11-25: "If the server cannot accept the input, it MUST return an HTTP error status code (e.g., 400 Bad Request). The HTTP response body MAY comprise a JSON-RPC error response that has no
id." The draft keeps the same rule, and adds that it "defines no client-to-server notifications over Streamable HTTP".
Output of checks
Reproduced with request specs on master at 61a2beb6587f:
/api/v4/mcp:status=202 body="", and the merge request's note count went from 0 to 1./api/v4/orbit/mcp: atools/callwith noidgotstatus=202 body="". With"id": true,1.5or[1], it got200and the sameidback.
Possible fixes
- Before dispatch in
lib/api/mcp/base.rbandee/lib/api/orbit/mcp.rb: whenparams[:id]is nil and the method doesn't start withnotifications/, answer400with-32600and noid.notifications/initializedandnotifications/cancelledkeep their 202. - Give Orbit's
idthe sametypes: [Integer, String]andcoerce_withasbase.rb:238, and drop itsrubocop:disable. Other types then get400with-32600.
Constraints
- Applies to every protocol version, legacy and modern.
- An unknown method that doesn't start with
notifications/and has noidanswers 400 instead of today's 202.
Open questions
- Ship behind a feature flag? No client can use today's response, because it never gets a result.
Patch release information for backports
Not requested.