lcc mcp)src/lcc/mcp_server.py is a minimal
Model Context Protocol server over stdio
(JSON-RPC 2.0, one JSON message per line as the MCP stdio spec requires;
LSP-style Content-Length framing is also accepted, and each reply uses the
framing of its request). It exposes seven tools:
| Tool | What it does | Offline? |
|---|---|---|
compact |
Relevance compaction (text, question, provider=mechanical, threshold=0.4); returns compacted_text + full report |
Yes with mechanical/laya; jev needs TYPESAFE_API_KEY |
compact_transcript |
Tool-call compaction of a session transcript (messages, question, preserve_recent=6): pairs each tool call with its result and keeps, trims or drops the pair; kept messages are verbatim. ref_unchanged: true returns each unchanged message as {"ref": <input index>} and leaves per-call decisions out, for clients that cap a tool result’s size (Claude Code’s MAX_MCP_OUTPUT_TOKENS); ref_blocks: true also refs the kept blocks of a changed message, so only replaced text travels back. Contract and limits: docs/TOOL_CALLS.md |
Yes: auto (default, local specialist-v3) and rules; jev is opt-in and needs TYPESAFE_API_KEY; failures keep every call |
inspect |
Read-only diagnostic inspection; returns the inspection report | Yes |
prepare |
Inspect-first deterministic preparation; returns action + prompt (or skip note) |
Yes |
explain |
Audits a compact report object (report, optional source_text/only/limit) |
Yes |
intake |
Intake triage: readiness with named reasons, non-blocking risk_flags, ask_count, an advisory category (with category_probability and category_context; empty below the model’s threshold; optional previous_turn input), questions, assumptions, a speech receipt (every removed filler span), and a compiled prompt with the static template first |
Yes (default; no relevance pass) |
recall |
Returns an output compact_transcript (rules_mode: "stashed") removed (id, optional lines a-b); hash-verified on read. Optional file adds on_disk: whether that file still holds what the output showed. See docs/TOOL_CALLS.md |
Yes (stdio only; refused by --http) |
Stdlib only — no new dependencies, and the base install is untouched. The
server only calls the same public library entry points as the CLI, so the
deterministic-core boundary (ADR 0010, tests/test_deterministic_boundary.py)
is unaffected.
lcc mcp # stdio server (Ctrl-C / EOF to stop)
python -m lcc.mcp_server # same, without the console script
Claude Code / generic MCP client (~/.claude.json, .mcp.json, or equivalent):
{
"mcpServers": {
"lcc": { "command": "lcc", "args": ["mcp"] }
}
}
Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json on macOS,
%APPDATA%\Claude\claude_desktop_config.json on Windows, same mcpServers block.
Cursor — .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every project, same
mcpServers block.
Any other stdio client works with command: "lcc", args: ["mcp"]. With pipx, replace
"command": "lcc" with the absolute path from which lcc: desktop applications do not inherit
your shell’s PATH, and that is the usual cause of a server that “fails to start” there.
lcc mcp writes nothing to stdout except framed JSON-RPC, so a client that shows garbage is
usually reading stderr or a wrapper that prints a banner.
With pipx: replace "command" with the full path from
pipx --global-home (or which lcc). With an editable checkout, use
<repo>/.venv/bin/lcc.
.venv/bin/python - <<'EOF'
import json, subprocess
msgs = [
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}},
{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}},
]
p = subprocess.run([".venv/bin/lcc", "mcp"],
input=b"".join(json.dumps(m).encode() + b"\n" for m in msgs),
capture_output=True, timeout=60)
responses = [json.loads(line) for line in p.stdout.splitlines() if line.strip()]
print(responses[0]["result"]["serverInfo"])
print([t["name"] for t in responses[1]["result"]["tools"]])
EOF
Simpler still: tests/test_mcp_server.py speaks the protocol end-to-end
(initialize → tools/list → tools/call compact/inspect/explain, all
offline) and is the executable contract.
compact defaults to provider: "mechanical" — safe for agents with no
key. Pass "laya" only if the [laya] extra is installed, "jev" only
with TYPESAFE_API_KEY in the server’s environment.{content: [{type: "text", text: "error: …"}],
isError: true} — never as dropped content.recall’s file must be an absolute path. Its on_disk answer holds counts, never content,
but it still tells the caller whether that file exists and whether it holds the recalled
lines. Give file only to agents that may read those files anyway.mechanical/laya: zero).