MCP server
westering mcp serves the detect and intervene commands as tools over the Model Context Protocol. It reads JSON-RPC 2.0 messages from standard input, one message per line, and writes one response line for each request to standard output. It reads only the files and directories a tool call names, never touches the network, and prints the same bytes for the same input.
Connect a client
Install the binary as the install page describes, so westering is on the path. Claude Code adds the server with one command.
claude mcp add westering -- westering mcp
The Claude Code plugin in this repository adds the server and the Agent Skill together. The plugin carries the skill and the MCP server but not the binary, so install the binary first.
claude plugin install westering --marketplace david-engelmann/westering
Inside a session the same step is /plugin install westering --marketplace david-engelmann/westering. The client names the plugin's server plugin:westering:westering, and its tools reach the agent as mcp__plugin_westering_westering__detect and mcp__plugin_westering_westering__intervene.
A client that reads an mcpServers configuration takes this entry.
{
"mcpServers": {
"westering": {
"command": "westering",
"args": ["mcp"]
}
}
}
A relative path in a tool call is read from the directory the client starts the server in.
The third session of An agent uses the skill gives Claude Code this server through --mcp-config. The client reports the server as connected with both tools, and the agent calls detect and then intervene.
Tools
| Tool | Arguments | Result |
|---|---|---|
detect | Exactly one of trace, a trace document given inline, and path, a file path. Optional format and progress | The document westering detect prints |
intervene | scenario, one of the six scripted scenarios, and optional fixtures, a directory of recorded judgment fixtures | The session record westering intervene prints |
format names how detect reads its input. trace, the default, is the native trace format. openai and anthropic read a tool call log, inline under the trace id inline or from a file under the file's name, and auto decides from the file and takes only path. progress names the rule that derives progress for a tool call log, tool-result by default or call-result, and it is refused beside the trace format.
A call that runs answers the document as structuredContent and one text block holding the document exactly as the command prints it. A refusal answers one text block holding the text of the error line the command prints, without its error: prefix, with isError set to true, so the model reads it and can correct the call. An argument the tool does not take, a missing or extra input, and a value outside its set are refused the same way.
A conversation
A client opens with initialize, sends the notifications/initialized notification, which gets no response, and calls tools. The third request below names a file that does not exist.
$ printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"example","version":"1.0.0"}}}' '{"jsonrpc":"2.0","method":"notifications/initialized"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"detect","arguments":{"path":"examples/looping_trace.json"}}}' '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"detect","arguments":{"path":"examples/missing_trace.json"}}}' | ./target/debug/westering mcp
{"id": 1, "jsonrpc": "2.0", "result": {"capabilities": {"tools": {}}, "protocolVersion": "2025-11-25", "serverInfo": {"name": "westering", "version": "0.1.0"}}}
{"id": 2, "jsonrpc": "2.0", "result": {"content": [{"text": "{\n \"detections\": [\n {\n \"detail\": \"call pattern of length 1 repeated 4 times with no progress\",\n \"evidence_span\": {\n \"end_step\": 4,\n \"start_step\": 1\n },\n \"pattern\": [\n \"grep(pattern=config, path=src)\"\n ],\n \"shape\": \"looping\",\n \"trace_id\": \"trace-loop-001\"\n }\n ],\n \"trace_id\": \"trace-loop-001\"\n}\n", "type": "text"}], "isError": false, "structuredContent": {"detections": [{"detail": "call pattern of length 1 repeated 4 times with no progress", "evidence_span": {"end_step": 4, "start_step": 1}, "pattern": ["grep(pattern=config, path=src)"], "shape": "looping", "trace_id": "trace-loop-001"}], "trace_id": "trace-loop-001"}}}
{"id": 3, "jsonrpc": "2.0", "result": {"content": [{"text": "trace file cannot be read, examples/missing_trace.json", "type": "text"}], "isError": true}}
Protocol versions
The server answers clients of both protocol eras from one process and keeps no state between lines.
A legacy client opens with initialize. The server answers with the version the client asked for when it is 2025-11-25 or 2025-06-18, and with 2025-11-25 otherwise. It does not echo 2025-03-26, since that revision requires a server to accept JSON-RPC batches and this server answers a batch as an invalid request. Legacy clients also get ping.
A modern client names the revision 2026-07-28 on every request under io.modelcontextprotocol/protocolVersion in the request's _meta, and may first ask server/discover. Every modern result carries resultType set to complete and names the server under io.modelcontextprotocol/serverInfo in its _meta. A request that names any other version under that member is refused with the error -32022 and the versions the server supports.
$ printf '%s\n' '{"jsonrpc":"2.0","id":"d1","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}' '{"jsonrpc":"2.0","id":"d2","method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2099-01-01"}}}' | ./target/debug/westering mcp
{"id": "d1", "jsonrpc": "2.0", "result": {"_meta": {"io.modelcontextprotocol/serverInfo": {"name": "westering", "version": "0.1.0"}}, "cacheScope": "public", "capabilities": {"tools": {}}, "resultType": "complete", "supportedVersions": ["2026-07-28"], "ttlMs": 3600000}}
{"error": {"code": -32022, "data": {"requested": "2099-01-01", "supported": ["2026-07-28"]}, "message": "Unsupported protocol version"}, "id": "d2", "jsonrpc": "2.0"}
Errors
| Code | When |
|---|---|
| -32700 | The line is not UTF-8 or does not parse as JSON, answered under the id null |
| -32600 | The message is not a single request object, or its id, jsonrpc, method or params is malformed |
| -32601 | The method is not one the server serves in that era |
| -32602 | tools/call names an unknown tool or carries a malformed name or arguments, or params is a list |
| -32022 | A modern request names a protocol version other than 2026-07-28 |
A notification, a well formed message with no id, never gets a response. A blank line is skipped. When standard input ends the server exits 0. If standard output cannot take a response, the server exits 1 with one error: line on standard error.