coriqo-mcp: check every MCP tool call against a mandate
coriqo-mcp is an open-source interposer for the Model Context Protocol. It runs on your machine between an MCP host (Claude Desktop, an agent framework, your own client) and an MCP server. Each tools/call is checked against a mandate file, and each decision is written to a device-signed ledger.
What it does
An MCP server exposes tools to an AI agent. Nothing in the protocol records which tools the agent called, with what arguments, or whether anyone had approved that. coriqo-mcp adds that layer without changing the host or the server.
- Checks each call before the server sees it. The check reads a mandate file held in memory; Coriqo’s service is not on the path of a call.
- Records each decision. The tool name, the decision and reason, the mandate’s SHA-256, the session, the step number and a SHA-256 of the call’s arguments (RFC 8785 canonical JSON). The arguments themselves are not recorded.
- Enforces when you tell it to. In
enforcemode a call outside the mandate gets an MCP error and never reaches the server.
The measured overhead on one Apple M2 Pro laptop was 0.5 to 3.2 ms added per call (five runs of 300 stdio round trips, against a minimal echo server, while the machine was busy). Run the benchmark in the repository on your own hardware before relying on that.
Install
coriqo-mcp ships inside the open-source byoai-runtime package (Apache 2.0, Python 3.10 or later). It needs the coriqo-mcp extra, which brings in cryptography (to sign the ledger with a device key), PyYAML (to read the mandate) and uvicorn (for HTTP mode).
pip install "byoai-runtime[coriqo-mcp] @ git+https://github.com/coriqo/byoai-runtime"
The install above is from the GitHub source, which is where the coriqo-mcp command is currently maintained. The pre-release on PyPI (pip install --pre byoai-runtime) is an older build and may not include it. Check the changelog before relying on the PyPI version.
Run it
Put coriqo-mcp --mandate <file> -- in front of the command you already use to start the server. It starts the server as a child process, relays stdio, and stops it when the host disconnects.
coriqo-mcp --mandate coriqo.mandate.yaml -- npx -y @modelcontextprotocol/server-filesystem ~/work
In an MCP host’s config, that means command: "coriqo-mcp" with the rest as args. For a server you reach over HTTP, relay it instead:
coriqo-mcp --mandate coriqo.mandate.yaml --http \
--upstream http://127.0.0.1:9000 --listen 127.0.0.1:8808
The mandate file
The mandate is coriqo.mandate.yaml v1, an open format that says what an agent may do in a form any runtime or CI check can read. The format is specified in MANDATE_SPEC.md. A short one:
spec: coriqo.mandate/v1
agent:
name: payments-assistant
mode: shadow # or enforce
on_stale_snapshot: fail_open
tools:
allowed: [search, get_balance, transfer_funds]
prohibited: [delete_account]
on_violation: deny # deny | deny_and_halt_run | alert_only
An invalid file stops coriqo-mcp at start, with every problem listed. The file is re-read in the background. If it later becomes unreadable, the last good copy is used until it is older than max_staleness_s, and then on_stale_snapshot decides (fail_closed refuses every call).
Shadow and enforce
shadow(the default). Every call goes through. A call outside the mandate is recorded asflagged. Start here to see what your agent actually does before you block anything.enforce. A call outside the mandate is refused with an error whose only text is “This action is not permitted.” It does not name the tool, the rule or the mandate, so the model has nothing to work around. Withdeny_and_halt_run, every later call in that session is refused too.
What is recorded
Events go to a local ledger (~/.byoai/recorder/ledger.db by default) with device-signed checkpoints. The coriqo-seal-verifier checks that ledger offline. On a device enrolled with Coriqo, each decision is also sent to Coriqo’s verdict endpoint: the tool, the decision, the reason, the mandate version and the step. The arguments hash stays in the local ledger.
A hash of short or guessable arguments can be confirmed by someone who guesses them, so treat the record as no more public than the arguments.
What is checked, and what is not
- Checked: every
tools/call, single or batched, against the allow-list, the prohibited list,max_steps_per_run, the environment and the mandate’s age. - Not checked:
max_cost_usd(an MCP call carries no cost); resources, prompts, sampling and elicitation requests; the content of a tool’s result; and what a tool does once it runs.coriqo-mcpdecides whether a call reaches the server. It does not watch the server. - Bypass: the rule covers calls that go through
coriqo-mcp. A host configured to start the server directly bypasses it.
Source and related packages
- byoai-runtime on GitHub: source, configuration reference and changelog.
- byoai-shield: the sister tool that keeps secrets and personal data out of AI chat apps.
- coriqo-seal-verifier: check a ledger or sealed record offline.
- How the Coriqo record works and known limitations.
Questions about the code?
An engineer who works on it will answer.