Skip to main content
Glama
knowledge-library-mcp

knowledge-library-mcp

knowledge-library-mcp

MCP server exposing the knowledge-library (notes, guidance, projects, search, plus explicit-save write tools) to Claude clients.

Run locally

uv sync --extra dev
KNOWLEDGE_LIBRARY_ROOT=~/code/knowledge-library uv run python -m knowledge_library_mcp --selftest

Related MCP server: secondbrain-mcp

Run tests

uv run pytest
uv run ruff check src tests scripts

The tests need ripgrep (rg) on PATH. They run against the fixture library in tests/fixtures/library/, not against real notes.

Configuration

The server resolves the library root by:

  1. KNOWLEDGE_LIBRARY_ROOT environment variable, if set.

  2. Otherwise, the directory three levels above server.py. That default dates from when this code lived in knowledge-library/mcp-server/; outside that layout, set the variable. The ingress VM sets it to its clone, /opt/knowledge-library.

Tools exposed

See src/knowledge_library_mcp/server.py. Spec: kennyrnwilson/knowledge-library → docs/superpowers/specs/2026-05-08-mcp-knowledge-platform-design.md § 6.2.

Teaching tools

teach_start, list_lessons, get_lesson, write_teach_file and edit_teach_file let a chat with no skills of its own (claude.ai, for example) run Matt Pocock's teach skill. The workspace is 05-projects/<project>/teach/; the project must already have a README.md. teach_start returns the skill's instructions, from the vendored copy in src/knowledge_library_mcp/teach_skill/, plus the workspace's state. The write tools accept .html, .css, .js, .svg and .md files inside the workspace only, and like the other write tools they never commit.

Book lesson plans

save_lesson_plan is how the reading app turns a book into a course. It writes one section of 05-projects/<book-slug>/teach/PLAN.md: a ## <chapter> section for a chapter, or ## Whole book. Saving the same section again replaces it, and the other sections stay.

The first call for a book creates the course:

  • the project README.md, linked to the book in book-library, and a row in 05-projects/README.md;

  • teach/MISSION.md from the reader's why, which that first call requires;

  • teach/RESOURCES.md, with the book and its reading-app link, and teach/NOTES.md;

  • teach/assets/, copied from the use-the-system workspace, so lessons get the course stylesheet, the quiz and the Recall marking.

A project of the same name that does not link to the book is refused. The tool returns every path it wrote, which the caller passes to save_changes.

PLAN.md is a state file like MISSION.md: teach_start returns it, and the chat preamble tells the teacher to write the first lesson in the plan that is not yet a link, then link it. So "teach me the next lesson in the <book-slug> project" works through a book from its plan.

Explicit-save model

Write tools (create_note, update_note, append_fleeting, add_quote, write_teach_file, edit_teach_file) only touch disk. They never commit. The save_changes tool stages, commits, and pushes. The LLM must only call save_changes when the user explicitly approves ("save it", "commit that", "looks good").

Staying in step with main

knowledge-library's sync-to-vm.yml fast-forwards the server's clone on every push to main. That isn't enough on its own: it runs only on a push, and its --ff-only pull stops working once the clone holds a commit that an earlier save_changes failed to push. Two things here cover the gaps, and both act only when main is checked out:

  • Before each tool call, refresh runs git pull --ff-only origin main, at most once every 30 seconds, with a 15-second timeout. A failed pull is not an error: the call goes ahead on what is on disk.

  • save_changes commits, fetches, rebases onto origin/main, then pushes. A conflict aborts the rebase and leaves the commit local, with an error that says so. A commit stranded by an earlier failed push goes out with the next save_changes, even when there is nothing new to commit.

Deployment

This repo is the source of truth for the server. (It used to be a mirror of knowledge-library/mcp-server/; that subtree and its sync were removed on 2026-10-17.) The knowledge content stays in the private knowledge-library repo.

.github/workflows/deploy-vm.yml runs lint, the tests and the selftest on every pull request and push. On a push to main, it then runs personal-portal's deploy/ingress-vm/knowledge-library-mcp.sh install inside the ingress VM, on the Mac Mini's self-hosted runner. That installs dependencies pinned by uv.lock and restarts the knowledge-library-mcp systemd unit (port 5103, behind gateway.kennyrnwilson.com/mcp/knowledge).

Available Tools

11 tools
append_fleetingB

Append a timestamped block to today's 01-fleeting-notes/YYYY-MM-DD.md. Lowest-friction capture.

Inputs: content (required). Returns: result

create_noteA

Create a new note. Returns relative path. Refuses to overwrite.

kind: fleeting | literature | permanent | guidance | project area_or_path: required area name for permanent/guidance; optional sub-path for others.

Inputs: kind (required), title (required), content (required), area_or_path (required). Returns: result

get_guidanceA

Return the markdown of 04-guidance/<area>/<topic>.md for the first matching area.

Inputs: topic (required). Returns: result

get_noteA

Return the markdown content of a note by relative path.

Inputs: path (required). Returns: result

list_areasB

The six canonical areas of the knowledge library.

Inputs: no named parameters. Returns: result

list_pending_changesA

Return uncommitted changes in the knowledge-library (parsed git status).

Inputs: no named parameters. Returns: result

list_permanent_notesA

List all permanent notes within one area.

Inputs: area (required). Returns: result

list_projectsA

List active projects (directories under 05-projects/ containing a README.md).

Inputs: no named parameters. Returns: result

save_changesA

Stage all changes, commit, push origin main.

ONLY call this tool when the user has explicitly approved the change ("save it", "commit that", "looks good, push it"). Drafts iterated in chat without explicit approval should remain uncommitted on disk.

Inputs: message.

search_notesB

Full-text search across the library. Optional area scopes to permanent/guidance for that area.

Inputs: query (required), area. Returns: result

update_noteA

Overwrite an existing note. Refuses if path doesn't already exist.

Inputs: path (required), content (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool maps to a distinct resource and action: areas, note content, searches, projects, and git operations are cleanly separated. Even the retrieval tools differ clearly by path-based access, guidance-specific lookup, and area-scoped listing.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern: list_* for collections, get_* for single items, create/update/append for mutations, and save/list for git workflow. The naming makes the tool set predictable and easy to navigate.

    Tool Count5/5

    11 tools is well-scoped for a knowledge library covering capture, search, retrieval, editing, project listing, and git persistence. Each tool serves a clear purpose without redundancy or bloat.

    Completeness4/5

    The surface covers create, read, update, search, capture, project listing, and git commit/push workflows. Missing delete/archive and a general list-all-notes operation are workable gaps, but they may be intentional for a permanent knowledge base.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Exposes a clinic's knowledge base and structured records to Claude Desktop as callable tools, with read tools grounded with citations and write tools gated behind approval.
      4
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude clients to search, read, and write to a Markdown second brain vault via GitHub, with tools for retrieval, capture, and knowledge graph consistency.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables a shared persistent knowledge vault for Claude Desktop, allowing notes to be saved, retrieved, searched, updated, and deleted across Chat and Code tabs.
      5
      65 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude to read and search a local Markdown knowledge base and past session transcripts, and write distilled notes back into it over MCP.
      1
      Functional Source , Version 1.1, MIT Future