Problem
When calling Gerrit REST API endpoints, the server returns a JSON response prefixed with the security string )]}:
)]}'
{
"id": "...",
...
}
This is a Gerrit security feature to prevent JSON hijacking attacks (Gerrit REST API Documentation). However, the gerrit-mcp-server does not strip this prefix before parsing the JSON, causing JSON parse errors.
Error Message
Error executing tool get_change_details: Expecting value: line 1 column 1 (char 0)
Steps to Reproduce
- Configure gerrit-mcp-server with valid Gerrit credentials
- Call any REST API endpoint, e.g.:
mcporter call 'Gerrit.get_change_details(change_id:"324339")'
- Observe JSON parsing error
Expected Behavior
The MCP server should strip the )]} prefix from Gerrit API responses before parsing the JSON.
Actual Behavior
The MCP server fails to parse the JSON response because of the )]} prefix.
Environment
- gerrit-mcp-server: used via
uvx gerrit-mcp-server
- Gerrit instance: UnionTech Gerrit (gerrit.uniontech.com)
- Authentication: HTTP Basic Auth
Possible Fix
Strip the )]} prefix from the response body before JSON parsing, or use the Gerrit CLI/Go library which handles this automatically.
Problem
When calling Gerrit REST API endpoints, the server returns a JSON response prefixed with the security string
)]}:This is a Gerrit security feature to prevent JSON hijacking attacks (Gerrit REST API Documentation). However, the gerrit-mcp-server does not strip this prefix before parsing the JSON, causing JSON parse errors.
Error Message
Steps to Reproduce
Expected Behavior
The MCP server should strip the
)]}prefix from Gerrit API responses before parsing the JSON.Actual Behavior
The MCP server fails to parse the JSON response because of the
)]}prefix.Environment
uvx gerrit-mcp-serverPossible Fix
Strip the
)]}prefix from the response body before JSON parsing, or use the Gerrit CLI/Go library which handles this automatically.