-
Notifications
You must be signed in to change notification settings - Fork 96
Description
Description
When attempting to retrieve an index mapping from an Elasticsearch instance using the MCP, the operation fails with a JSON-RPC internal error. The server-side logs confirm a response error with the same message, suggesting a problem with parsing or decoding the response received from the Elasticsearch API.
Steps to Reproduce
- Connect the MCP server to an Elasticsearch instance (version 8.11.1).
- Ensure at least one index exists in Elasticsearch.
- Execute a request via the MCP to retrieve the mapping of a specific index.
Expected Behavior
The MCP should successfully retrieve the index mapping from Elasticsearch and return the complete mapping structure as a JSON object to the client.
Actual Behavior
The MCP client receives the following error response:
[
{
"response": "MCP error -32603: error decoding response body"
}
]

The MCP server logs show a corresponding internal error for the request, indicating a failure during the response processing phase.
Environment
- MCP Server Version: latest
- Elasticsearch Version: v8.11.1
- Operating System MCP Server: Ubuntu 24.04.3 LTS
- Deployment: Docker

MCP Server Logs
The following relevant logs were captured from the MCP server at the time of the error. Note the repeated WARN messages with error decoding response body.
2025-08-22T10:27:22.788805Z INFO rmcp::transport::streamable_http_server::tower: Response(JsonRpcResponse { jsonrpc: JsonRpcVersion2_0, id: Number(3), result: CallToolResult(CallToolResult { content: [Annotated { raw: Text(RawTextContent { text: "Found 8 indices:" }), annotations: None }, Annotated { raw: Text(RawTextContent { text: "[{\"index\":\".ds-index-xyz-elasticagent-2025.07.25-000842\",\"status\":\"open\",\"docs.count\":105351333},...]" }), annotations: None }], is_error: Some(false) }) })
2025-08-22T10:27:23.340360Z INFO serve_inner: rmcp::service: Service initialized as server peer_info=None
2025-08-22T10:27:23.351625Z WARN rmcp::service: response error id=4 error=ErrorData { code: ErrorCode(-32603), message: "error decoding response body", data: None }
2025-08-22T10:27:23.351657Z INFO rmcp::transport::streamable_http_server::tower: Error(JsonRpcError { jsonrpc: JsonRpcVersion2_0, id: Number(4), error: ErrorData { code: ErrorCode(-32603), message: "error decoding response body", data: None } })
2025-08-22T10:27:25.979940Z INFO serve_inner: rmcp::service: Service initialized as server peer_info=None
2025-08-22T10:27:25.988727Z WARN rmcp::service: response error id=5 error=ErrorData { code: ErrorCode(-32603), message: "error decoding response body", data: None }
2025-08-22T10:27:25.988770Z INFO rmcp::transport::streamable_http_server::tower: Error(JsonRpcError { jsonrpc: JsonRpcVersion2_0, id: Number(5), error: ErrorData { code: ErrorCode(-32603), message: "error decoding response body", data: None } })
2025-08-22T10:27:26.378046Z INFO serve_inner: rmcp::service: Service initialized as server peer_info=None
2025-08-22T10:27:26.387453Z WARN rmcp::service: response error id=6 error=ErrorData { code: ErrorCode(-32603), message: "error decoding response body", data: None }
2025-08-22T10:27:26.387484Z INFO rmcp::transport::streamable_http_server::tower: Error(JsonRpcError { jsonrpc: JsonRpcVersion2_0, id: Number(6), error: ErrorData { code: ErrorCode(-32603), message: "error decoding response body", data: None } })
Additional Context
The error suggests that the response from the Elasticsearch _mapping API endpoint might not be in the format that the MCP is expecting, leading to a deserialization failure. This could be due to a change in the API response in Elasticsearch v8.11.1 or an issue in the MCP's response handling logic.