Fix JSON-RPC id leaking into MCP API tool routes
What does this MR do and why?
ApiTool (used by every route-backed and aggregated MCP tool) runs the target REST endpoint in-process against the same Rack request. The MCP request body is the JSON-RPC envelope, so Grape parsed it into the route's params and the JSON-RPC id leaked in as params[:id]. On EE, filter_attributes_using_license! then treated save_project's create route as an update and returned 404 Project Not Found.
This hides the request body for the in-process call (request.env['rack.input'] is swapped for an empty StringIO and restored afterwards). Tool arguments already travel via GRAPE_ROUTING_ARGS, so nothing else is lost.
References
- Bug: #631936 (closed)
- Follow-up to !259294 (merged)
Once this fix is on master, the end-to-end #save_project examples currently skipped in !259294 (merged) can be unskipped.
Screenshots or screen recordings
Not applicable; backend-only change.
How to set up and validate locally
Not applicable beyond the automated specs; this MR adds a unit example in spec/services/mcp/tools/base/api_tool_spec.rb.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.