Skip to Content
OchreML
Resources & Protocol

JSON-RPC 2.0 Protocol

Transport framing, handshake lifecycle, supported MCP methods, and JSON-RPC 2.0 error codes in ochreml mcp.

ochreml mcp implements MCP protocol version 2024-11-05 over line-delimited JSON-RPC 2.0 on stdin and stdout (python/ochreml/_mcp.py).

  • Server Name: ochreml-mcp
  • Capabilities: {"tools": {}, "resources": {}}
  • Transport: One compact JSON object per line (\n-terminated) on stdin/stdout; optional debug logs on stderr when OCHREML_DEBUG=1.

Supported Methods

MethodKindDescription
initializeRequestHandshake returning protocolVersion ("2024-11-05"), capabilities, and serverInfo (name, version).
notifications/initializedNotificationClient lifecycle acknowledgement; produces no response (None). Any notifications/* message without an id is also ignored without reply.
pingRequestLiveness check returning {}.
tools/listRequestReturns {"tools": [...]} with the JSON schemas for all 9 MCP tools.
tools/callRequestExecutes params.name with params.arguments. Returns {"content": [{"type": "text", "text": "<json>"}], "isError": bool}.
resources/listRequestReturns {"resources": [...]} listing ochreml://catalog/estimators and ochreml://catalog/nn.
resources/readRequestReads params.uri and returns {"contents": [{"uri", "mimeType": "application/json", "text": "<json>"}]}.

Handshake Example

Request:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}

Response:

{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{},"resources":{}},"serverInfo":{"name":"ochreml-mcp","version":"0.3.7a1"}}}

Tool Errors vs. Protocol Errors

ochreml mcp distinguishes between tool execution errors and JSON-RPC protocol errors:

  • Tool execution errors (missing file, path traversal outside --root, invalid .dit extension, bad hyperparameter, unknown tool name) return a normal JSON-RPC result with "isError": true so the LLM can read the error message and recover:
{
  "jsonrpc": "2.0",
  "id": 6,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"error\": \"Access denied: path '../secret.csv' escapes allowed MCP root '/workspace' ( >_< )\"}"
      }
    ],
    "isError": true
  }
}
  • Protocol errors return a standard JSON-RPC error object:
CodeMeaningTrigger
-32700Parse errorMalformed JSON line on stdin.
-32600Invalid RequestNon-object JSON payload or missing method string.
-32601Method not foundUnknown JSON-RPC method.
-32602Invalid paramsNon-string name or non-object arguments in tools/call, or unknown uri in resources/read.
-32603Internal errorUnhandled server-level exception outside tool dispatch.

On this page