Skip to content

MCP Server

recon mcp runs a Model Context Protocol server on stdin and stdout. Use it when you want a coding agent (Claude Code, Cursor, Windsurf, Zed, VS Code) to list your saved requests, read Flight Recorder history and send requests, with every response passed through the PII Airlock and every network call checked against your agent policy first.

Terminal window
recon --workspace /path/to/workspace mcp

--workspace is a global flag, so recon mcp --workspace /path/to/workspace works too. That second form is what recon setup-mcp writes into client config files. With no --workspace, the current directory is used.

You normally do not run this by hand. Your MCP client starts the process and talks to it over pipes. To try it yourself, pipe JSON-RPC lines into it:

Terminal window
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"manual","version":"0"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"recon_latest_runs","arguments":{"limit":1}}}' \
| recon --workspace demo mcp

The server writes one line per request that has an id. The notifications/initialized line has no id, so it gets no reply:

{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"prompts":{"listChanged":false},"resources":{"listChanged":false,"subscribe":false},"tools":{"listChanged":false}},"instructions":"Recon exposes Git-native collections and Flight Recorder history strictly behind the maskkeel-compatible PII Airlock and Agent Policy Guardrails.","protocolVersion":"2024-11-05","serverInfo":{"name":"recon","version":"0.3.2"}}}
{"id":2,"jsonrpc":"2.0","result":{"tools":[{"description":"List saved .http requests and available environments in the Recon workspace.","inputSchema":{"properties":{},"type":"object"},"name":"recon_list_requests"},{"description":"List recent Flight Recorder executions (filterable by status_min and request_id).","inputSchema":{"properties":{"limit":{"default":20,"type":"integer"},"request_id":{"type":"string"},"status_min":{"type":"integer"}},"type":"object"},"name":"recon_latest_runs"},
...
{"id":3,"jsonrpc":"2.0","result":{"content":[{"text":"{\n \"runs\": [\n {\n \"actor\": \"agent\",\n \"actor_label\": \"agent-flow\",\n \"env_name\": \"local\",\n \"id\": \"01a22d25-a003-773d-af67-33052d5b2bca\",\n \"is_baseline\": false,\n \"method\": \"GET\",\n \"request_id\": \"campus-demo-list-students\",\n \"request_name\": \"List Students\",\n \"seq\": 4,\n \"status\": 200,\n \"total_ms\": 0.171906,\n \"ts_utc\": \"2026-11-30T15:49:30.243624264+00:00\",\n \"url\": \"http://127.0.0.1:4710/_sandbox/local/v1/students\",\n \"verified_zero_leak\": true,\n \"wire_bytes\": 669\n }\n ]\n}","type":"text"}],"isError":false}}

The tools/list reply above is cut short. In full it lists 23 tools. See the MCP Tools, Resources & Prompts reference for every tool.

  • JSON-RPC 2.0, one JSON object per line, over the process’s stdin and stdout.
  • Blank lines are skipped.
  • Each reply is a single line of compact JSON followed by a newline. Object keys in replies come out in alphabetical order.
  • Only protocol frames go to stdout. The server writes no logs to stdout.
  • Requests are handled one at a time, in the order they arrive. A tool call that is waiting for human approval blocks every later request on the same connection until it finishes.
  • A message with no id member is treated as a notification and gets no reply. This covers notifications/initialized and any other notification.
  • A JSON array (a JSON-RPC batch) has no top-level id, so it is ignored with no reply.
  • A line that is not valid JSON gets a parse error with "id": null.
  • When stdin closes, the server exits with code 0.

initialize always returns the same result. The server does not read the request’s params, so it does not negotiate the protocol version: it answers 2024-11-05 even if the client asks for a newer one.

Field Value
protocolVersion 2024-11-05
capabilities.tools {"listChanged": false}
capabilities.resources {"subscribe": false, "listChanged": false}
capabilities.prompts {"listChanged": false}
serverInfo.name recon
serverInfo.version The crate version, 0.3.2 for this release
instructions Recon exposes Git-native collections and Flight Recorder history strictly behind the maskkeel-compatible PII Airlock and Agent Policy Guardrails.

The server sends no notifications of its own. Tool, resource and prompt lists never change while it runs.

Method Result
initialize The handshake result above.
ping {}
tools/list {"tools": [...]} with 23 tool definitions (name, description, inputSchema).
tools/call Runs the tool named in params.name with params.arguments (an empty object if left out).
resources/list {"resources": [...]} with 6 resources (uri, name, mimeType).
resources/read Reads the resource at params.uri.
prompts/list {"prompts": [...]} with 3 prompts (name, description, arguments).
prompts/get Expands the prompt named in params.name with params.arguments.
Anything else Error -32601, Method not found: <method>.

Methods not in the table, such as resources/templates/list, resources/subscribe or completion/complete, return -32601.

A tools/call reply is always a JSON-RPC result, even when the tool fails. The tool output is a single text content item.

On success, text holds the tool’s output as pretty-printed JSON and isError is false. The id 3 reply in the example above has this shape.

On failure, text holds a plain error message and isError is true. An unknown tool name is reported this way too:

{"id":8,"jsonrpc":"2.0","result":{"content":[{"text":"Unknown tool `recon_nope`","type":"text"}],"isError":true}}

Your client has to parse text as JSON itself when isError is false.

Most tool errors are plain messages such as missing required parameter `run_id` or request `Missing` not found. Safety blocks start with a stable code you can match on:

Prefix Raised when
E_AGENT_POLICY_DENIED: The agent policy denies the call, or recon_load_test asks for more than its caps allow.
E_AGENT_APPROVAL_DENIED: A human denied the approval request. The note they typed follows the code, or Denied by human operator if there was none.
E_AGENT_APPROVAL_TIMEOUT: Nobody decided the approval request in time.
E_FIREWALL_BLOCKED: The outbound secret firewall stopped a recon_send_request call.

Real messages captured from the server:

E_AGENT_POLICY_DENIED: Agent guardrail blocked mutating DELETE call against env `prod` (`api.example.com`). Only loopback targets or envs explicitly listed in `agent_policy.allow_mutating_envs` permit mutations.
E_AGENT_POLICY_DENIED: host `api.example.com` matches agent_policy.blocked_hosts `*.example.com`
E_AGENT_APPROVAL_TIMEOUT: approval `01a22d22-d8fa-7019-874e-67ca5ad9c0af` timed out after 1s without human decision
E_FIREWALL_BLOCKED: outbound secret firewall blocked 1 violation(s)

Only recon_send_request adds the E_FIREWALL_BLOCKED: prefix. When the firewall stops recon_twin_run, the message comes through without that prefix.

Code Message When
-32700 Parse error The line is not valid JSON. The reply has "id": null.
-32601 Method not found: <method> The method is not one of the eight above.
-32602 Unknown resource URI `<uri>` resources/read with a URI the server does not know. Also used when reading a resource fails, with the underlying error text.
-32602 Unknown prompt `<name>` prompts/get with an unknown name. Also used when the workspace or Flight Recorder cannot be read while building the prompt.

Fourteen tools work only on local files and the Flight Recorder. They make no outbound request and skip the policy check. The other nine tools reach the network. Before they connect, the server checks the target against the agent policy in .recon.toml:

Tool Method the policy sees
recon_send_request The request’s method.
recon_twin_run The request’s method, checked once per environment.
recon_run_flow Each step’s method. Steps whose request is found and resolves are checked before the flow starts. Every step is checked again as it runs.
recon_load_test The request’s method, then the separate load-test rule.
recon_paginate The request’s method, checked again for every page.
recon_sse_stream The request’s method.
recon_ws_exchange GET when messages is empty, POST when it sends messages. ws:// and wss:// are checked as http:// and https://.
recon_graphql POST for a query that is a mutation, otherwise GET. Introspection counts as GET.
recon_grpc_call Always POST. With inspect_only: true it makes no call and skips the check.

The policy returns one of three outcomes. The full rules are on Agent Policy & Approvals. In short:

  • Deny. The tool returns E_AGENT_POLICY_DENIED: <reason>. A URL that does not parse is denied. Hosts in blocked_hosts are always denied. Read-only methods (GET, HEAD, OPTIONS) are denied only when allow_read_only is off. Other methods are denied unless the host is loopback (localhost, 127.0.0.1, ::1) with allow_local_mutations on, or the environment is in allow_mutating_envs.
  • Require approval. This applies to a mutating call when require_approval_for_mutations is on, and to any allowed call to an environment listed in require_approval_envs. The server creates a pending approval in the Flight Recorder and checks it every 250 ms. It waits for up to approval_timeout_secs seconds (default 60, minimum 1). An approval continues the call. A denial returns E_AGENT_APPROVAL_DENIED. No decision in time returns E_AGENT_APPROVAL_TIMEOUT. A recon ui server for the same workspace decides approvals in the same Flight Recorder database (see “Also available via” below).
  • Allow. The call goes ahead.

Inside recon_run_flow and recon_paginate, the per-step and per-page checks treat “require approval” as allowed. Only the up-front check waits for a human.

Each decision is written to the agent activity log with actor_label mcp-agent and one of the decisions allowed, denied, pending_approval, approved or expired. The logged URL has secret values scrubbed out. Read the log through the recon://activity/recent resource.

After the policy check, recon_send_request and recon_twin_run pass the request through the Outbound Secret Firewall. The firewall runs after approval. A request that needs approval asks for it first, even if the firewall would then block it.

Response bodies and headers, script logs, captured variables, stream events and exported documents (capsules, mock packs, OpenAPI) go through the PII Airlock before they reach the agent. recon_check_openapi is the exception: it validates the stored response body directly and returns only the validation report. The salt comes from --salt or MASKKEEL_SALT. recon_send_request and recon_inspect_run return a compliance_receipt, and recon_twin_run returns one for each side.

For each session the server keeps a reversible alias map of up to 10,000 entries. If the agent passes a pseudonymised value from an earlier response back in the url or a JSON or text body of recon_send_request, the server swaps the real value back in before it sends the request. A code comment says this is only for loopback or local targets, but the code does not check the target host: the swap happens for any target once the map has entries.

Setting Effect on recon mcp
--workspace <dir> Workspace root. The server loads it at start-up and again on most tool calls, so edits to .recon.toml, .http files and environments take effect without a restart.
--salt <salt> / MASKKEEL_SALT Airlock salt. Default recon-dev-salt. Every result that shows salt_fingerprint or airlock_salt_fingerprint reflects it.
RECON_AGE_KEY, RECON_AGE_KEY_FILE Age identity used to unlock the team vault for age:// secrets. See Vault & Secret URIs.
[agent_policy] in .recon.toml The policy described above.
mask_config in .recon.toml Path to mask.toml, read once at start-up. If the file is missing or invalid, the server uses the built-in defaults without reporting an error. recon doctor does report an invalid mask.toml.

If the workspace cannot be loaded at start-up (for example, .recon.toml does not parse), the server prints an E_CLI_RUNTIME error on stderr and exits with code 2 without reading stdin.

Group Tools Purpose
Collections recon_list_requests List saved requests and environments.
History recon_latest_runs, recon_inspect_run, recon_search_history, recon_diff_runs Read, search and diff Flight Recorder runs.
Execute recon_send_request, recon_twin_run Send one request, or one request against two environments.
Ledger recon_verify_airlock Check the Flight Recorder hash chain.
Code and contracts recon_scan_codebase, recon_drift_report, recon_export_openapi, recon_check_openapi, recon_export_capsule Scan source for routes, report drift, export or check OpenAPI, build bug capsules.
Lab recon_run_flow, recon_load_test, recon_paginate, recon_mock_export Run flows, small load tests, pagination, and export a mock pack.
Protocols recon_sse_stream, recon_ws_exchange, recon_graphql, recon_grpc_call SSE streams, WebSocket, GraphQL and gRPC.
Secrets recon_vault_list, recon_auth_status Vault and OAuth status metadata, never secret values.

The server lists six read-only resources. Each returns application/json:

URI Contents
recon://workspace Workspace name, default environment, environment names, request count, salt fingerprint.
recon://runs/latest The 10 most recent run summaries.
recon://routes Saved requests plus routes and DTOs found by scanning the workspace.
recon://drift/latest Three-way drift report over code, collections and the 12 most recent runs.
recon://activity/recent The 40 most recent agent activity entries and 20 most recent approvals.
recon://airlock/config Salt fingerprint and the loaded mask.toml rules.

It also lists three prompts: debug-failing-endpoint, review-api-drift and generate-contract-tests. Each returns one user message built from the current workspace and recent runs. The reference shows the exact text of each.

recon setup-mcp prints, and with --write merges, the entry for your client. For Claude, Cursor and Windsurf it looks like this (paths shortened):

{
"mcpServers": {
"recon": {
"args": [
"mcp",
"--workspace",
"/path/to/workspace"
],
"command": "/path/to/recon"
}
}
}

The entry has no env key, so the server uses the default salt unless MASKKEEL_SALT is set in the environment the client starts it with. See Setup, Skill & Doctor for the Zed and VS Code formats and the file each client uses.

Code Meaning
0 stdin closed and the server stopped normally.
2 Start-up failed, for example the workspace could not be loaded. An E_CLI_RUNTIME envelope is printed on stderr.
  • recon setup-mcp and recon doctor: see Setup, Skill & Doctor.
  • Approvals that the server waits on are listed and decided over HTTP at GET /api/v1/agent/approvals and POST /api/v1/agent/approvals/{id}/decide, and the activity log at GET /api/v1/agent/activity, served by recon ui. See HTTP API.