lcc

LCC as an MCP server (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 six 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. Contract and limits: docs/TOOL_CALLS.md jev/auto only (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, intent, questions, assumptions, compiled prompt Yes (default; no relevance pass)

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.

Run it

lcc mcp                       # stdio server (Ctrl-C / EOF to stop)
python -m lcc.mcp_server      # same, without the console script

Connect an agent

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.

Smoke test (no client needed)

.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.

Notes for integrators