MCP server integration

June 24, 2026 ยท View on GitHub

lessonweaver ships an optional Model Context Protocol server so MCP-capable agent runtimes (Claude Code, Copilot, and other clients) can reach the governed loop in-session: submit a trace, list and read the resulting review-pending candidates, and load reviewed skills into context.

The server can propose candidates and load reviewed skills, but it deliberately exposes no tool that answers review questions, approves, or promotes a skill. Approval stays a human action performed with the CLI.

Install

The server lives behind an optional extra so the base install stays dependency-free:

pip install "lessonweaver[mcp]"

import lessonweaver never loads the mcp SDK; only the server entry point does. Without the extra, starting the server exits with an install hint.

Run

lessonweaver-mcp                       # stdio transport
lessonweaver-mcp --registry-root ./.lessonweaver/registry
lessonweaver-mcp --no-sanitize         # disable submit-time redaction (not recommended)

The registry root resolves the same way as the CLI: the --registry-root flag, then the LESSONWEAVER_REGISTRY environment variable, then a project-local .lessonweaver/registry, then ~/.lessonweaver/registry.

Claude Code client configuration

{
  "mcpServers": {
    "lessonweaver": {
      "command": "lessonweaver-mcp",
      "args": ["--registry-root", "${workspaceFolder}/.lessonweaver/registry"]
    }
  }
}

Any MCP client that speaks stdio can launch lessonweaver-mcp the same way.

Tools

ToolEffectWrites?
detectMine candidates from a trace bundleNo
submit_traceValidate, sanitize, mine, and save candidates as review-pendingCandidates only
list_pending_candidatesList review-pending candidatesNo
get_candidateFetch one candidate by idNo
retrieveRank active skills relevant to a taskNo
load_skillsCompile relevant active skills into a budgeted snippetNo
explain_loadExplain what would load for a task and whyNo

Each tool maps directly onto the existing public library API (LessonDetector, FileSystemRegistry, SkillRetriever, SkillLoader, explain_load); the server adds no detection, retrieval, or scoring logic of its own.

Threat model

Trace content submitted over MCP is untrusted input. submit_trace runs TraceSanitizer on the bundle before mining by default; pass --no-sanitize (or "sanitize": false per call) only when you understand the risk. See the instruction-poisoning notes referenced from docs/protected-invariants.md.

What the server does not do

  • It exposes no tool to answer review questions, approve, or promote a skill โ€” approval is CLI-only and human-only.
  • It makes no LLM or network calls; every tool is deterministic.
  • It does not add the mcp SDK to the base install.