Set up the decision MCP server
Install mneme-hq with the [mcp] extra and register mneme decision-mcp with your agent as a local server. The agent can then search your decisions, ask which ones apply to a file, trace a decision’s history and propose new ones for people to review. The server informs the agent; it blocks nothing.
You’ll end up with: a local server your agent can ask which recorded decisions apply to the file it is about to edit, before it writes anything.
Goal
A hook refuses a bad edit after the agent has produced it: native file edits are stopped before they reach disk, shell writes only when the turn ends. Either way the agent then redoes the work. Showing the agent the relevant decision before it starts avoids that. Mneme’s decision server speaks the Model Context Protocol (MCP), the standard many coding agents use to call outside tools, and serves the decisions in your memory file.
This layer is optional in a complete setup and enforces nothing on its own. Pair it with an agent hook and a CI check when you want violations stopped.
Prerequisites
- A memory file,
.mneme/project_memory.json, with at least one imported decision. Steps 1 to 4 of the Claude Code setup create one for ADR-001, the example architecture decision record (ADR) that bans Celery. An imported decision is enough here; it doesn’t need an active rule. - An agent or MCP host that can start a local server over standard input and output (stdio), meaning the host launches
mnemeas a process on your machine and talks to it through its input and output streams. Mneme ships the server command, not a configuration for each host, and we have not tested every host.
Tested versions: mneme-hq 0.11.0 with the [mcp] extra. We started the server from a Python MCP client, as a host does, and called its tools. Registering it inside a named agent was not part of that run.
Configure
1. Install with the MCP extra
pipx install "mneme-hq[mcp]==0.11.0"
If Mneme is already installed without the extra, add --force to reinstall it.
2. Register the server with your agent
Claude Code reads servers from a .mcp.json file in the repository root. Other hosts take the same command and arguments in their own format:
{
"mcpServers": {
"mneme": {
"command": "mneme",
"args": ["decision-mcp", "--proposals", ".mneme/decision_proposals.json", "--memory", ".mneme/project_memory.json"]
}
}
}
--memoryis the file the server reads decisions from. It re-reads the file on every request, so an ADR you re-import shows up without a restart.--proposalsis where proposed decisions wait for review. The server never writes them into the memory file.- Paths resolve against the folder the host starts the server in. Use absolute paths if your host doesn’t start in the repository root.
The MCP server reference lists every option, including --adr-dir, which validates your ADR folder at startup.
Run
Restart your agent so it picks up the server, then ask it which decisions apply to workers/jobs.py. To check the server without an agent, this small client starts it the way a host does and calls one tool. It imports the mcp package, and pipx keeps that package inside Mneme’s own isolated environment, where your Python can’t import it. So for this one check, make a throwaway virtual environment with pip. Your pipx install stays what the agent uses:
python -m venv .probe-venv .probe-venv/bin/python -m pip install "mneme-hq[mcp]==0.11.0"
On Windows, use .probe-venv\Scripts\python. Save the client as mcp_probe.py:
mcp_probe.py"""Call Mneme's decision-mcp server over stdio, the way an MCP host does.
Usage:
python mcp_probe.py list
python mcp_probe.py <tool-name> '<json arguments>'
"""
import asyncio
import json
import os
import sys
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
SERVER = StdioServerParameters(
command="mneme",
args=["decision-mcp", "--proposals", "",
"--memory", os.environ.get("MEMORY", ".mneme/project_memory.json")],
)
async def main(tool: str, arguments: str) -> None:
async with stdio_client(SERVER) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
if tool == "list":
tools = await session.list_tools()
print("\n".join(t.name for t in tools.tools))
return
result = await session.call_tool(tool, json.loads(arguments))
for block in result.content:
print(json.dumps(json.loads(block.text), indent=2, sort_keys=True))
asyncio.run(main(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else "{}"))
.probe-venv/bin/python mcp_probe.py list
.probe-venv/bin/python mcp_probe.py decision.applicable_to '{"paths": ["workers/jobs.py"]}'
The client passes --proposals "", which keeps proposals in memory, so it writes no file.
Expected result
The server lists six tools:
decision.propose decision.propose_batch decision.get decision.search decision.applicable_to decision.trace
For workers/jobs.py, it returns ADR-001, because the decision’s scope, workers, overlaps the path:
{
"canonical_scope_matches": [
{
"context_scope": [
"workers"
],
"decision_id": "ADR-001",
"lifecycle_status": "active",
"statement": "No Celery",
"version": "1",
"version_id": "dver-a1bfce306d1af69b5ff3deecdc6f5a6a"
}
],
"proposal_hint_matches": []
}
A path that no decision’s scope matches, such as app/handlers/invoices.py here, returns empty lists, so the agent learns that nothing applies:
{
"canonical_scope_matches": [],
"proposal_hint_matches": []
}
This layer has no blocked case. Even when a decision applies, the server only tells the agent; the hook and the CI check are what stop a write.
Matching uses the scope word. Give each decision a scope that appears in the paths it governs; Give coding agents the decisions that apply to a task shows how scopes match and which words fail.
What it does not do
- No enforcement. The server can’t block an edit, install a rule or change what CI checks.
- No authority. It can submit a proposed decision but can’t accept, reject, activate or supersede one. People do that with
mneme decision acceptorreject; see decision proposals. - Scope overlap, not rule applicability.
decision.applicable_tocompares scopes with paths. It doesn’t evaluate a rule’s path patterns, and its answer says nothing about whether a check would pass. - Local only. The server talks over stdio on your machine. There is no hosted endpoint and no authentication layer.
Troubleshooting
The server exits as soon as it starts
It refuses to start without a valid memory file, and exits with code 2:
ERROR: memory file missing.json does not exist
Point --memory at the file, or run mneme setup first. A memory file written by 0.9.x has to be migrated with mneme decision-index migrate; the reference gives both commands.
The agent says it has no Mneme tools
The host couldn’t start mneme. Check that the command is on the PATH the host uses, or put its full path in command. With pipx, run pipx list to see where it installed Mneme.
A decision you expected isn’t returned
Its scope doesn’t overlap the path you asked about, or it was never imported. decision.search with a word from the decision tells the two apart: it finds an imported decision whatever its scope, and returns nothing for one that was never imported.
Next layer
Read the server’s source
The decision server ships in the open-source mneme-hq package.