Source: lib/mcp_server/

Mediator MCP server

Exposes the attestation ledger to any MCP-aware LLM agent (Claude Desktop, Cursor, custom orchestrators) as four tools:

Tool What it does
attest_create Build, sign, and POST a fresh attestation to the ledger
attest_verify Fetch + verify an existing attestation by id
agent_score Return cached/live reputation tier for an agent
chain_walk Reconstruct multi-hop delegation chain from a leaf upward

Run

cd ~/mediator/lib/python && source .venv/bin/activate

# 1) Start the ledger HTTP service in another terminal
cd ~/mediator/lib/api
PYTHONPATH=. uvicorn app.main:app --port 8765

# 2) Generate a keypair (if you don't already have one)
attestproto keygen ~/.mediator-keys

# 3) Register the fingerprint with the ledger registry. For the dev skeleton
#    this means writing to ~/mediator/lib/api/keys.json directly:
python -c "
import json, hashlib
pk = open('$HOME/.mediator-keys/verify_key.hex').read().strip()
fp = 'sha256:' + hashlib.sha256(bytes.fromhex(pk)).hexdigest()
import pathlib
reg = pathlib.Path.home() / 'mediator/lib/api/keys.json'
data = json.loads(reg.read_text()) if reg.exists() else {}
data[fp] = pk
reg.write_text(json.dumps(data, indent=2))
print('registered', fp)
"

# 4) Run the MCP server
export MEDIATOR_API_URL=http://localhost:8765
export MEDIATOR_SIGNING_KEY=$HOME/.mediator-keys/signing_key.hex
export MEDIATOR_KEY_FINGERPRINT=$(python -c "
import hashlib
pk = open('$HOME/.mediator-keys/verify_key.hex').read().strip()
print('sha256:' + hashlib.sha256(bytes.fromhex(pk)).hexdigest())
")
export MEDIATOR_AGENT_ID=asst_kai_dev
export MEDIATOR_AGENT_PLATFORM=mcp
export MEDIATOR_AGENT_MODEL=claude-opus-4-7
export MEDIATOR_AGENT_OPERATOR=https://example.invalid

python ~/mediator/lib/mcp_server/server.py

Wire into Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mediator-attestation": {
      "command": "/Users/lexwired/mediator/lib/python/.venv/bin/python",
      "args": ["/Users/lexwired/mediator/lib/mcp_server/server.py"],
      "env": {
        "MEDIATOR_API_URL": "http://localhost:8765",
        "MEDIATOR_SIGNING_KEY": "/Users/lexwired/.mediator-keys/signing_key.hex",
        "MEDIATOR_KEY_FINGERPRINT": "sha256:...your-fp...",
        "MEDIATOR_AGENT_ID": "asst_kai_dev",
        "MEDIATOR_AGENT_PLATFORM": "mcp",
        "MEDIATOR_AGENT_MODEL": "claude-opus-4-7",
        "MEDIATOR_AGENT_OPERATOR": "https://example.invalid"
      }
    }
  }
}

After restarting Claude Desktop, the attest_create / attest_verify / agent_score / chain_walk tools become available to any chat.

Architecture note

The MCP server is a thin client to the FastAPI ledger — it doesn't talk to the database directly. This separation lets multiple MCP servers (per-agent, per-org, per-tenant) share a single ledger without contention, and lets the ledger evolve independently of the MCP transport.