Librarian MCP
Allows AI agents to manage a personal knowledge base of Markdown files that can be used as an Obsidian vault, with capabilities including semantic search, Git-based draft workflows, and automated rule enforcement.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Librarian MCPsemantic search for 'effective meeting notes'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π Librarian MCP: The Personal Knowledge OS
Librarian MCP is an intelligent orchestration layer for your personal knowledge base, inspired by Andrej Karpathy's LLM Wiki vision. It transforms a simple folder of Markdown files into a dynamic, structured, and safe "digital brain" accessible to any AI agent via the Model Context Protocol (MCP).
Unlike traditional RAG systems that merely retrieve fragments, Librarian MCP enables Iterative Synthesisβwhere AI acts as an active editor, maintaining structure, cross-links, and ground truth across multiple projects.
π Key Features
π‘οΈ Safety-First (Drafts Workflow): AI never modifies your "master" branch directly. All changes are isolated in
draft/*Git branches for your review and approval.π§ Local Semantic Intelligence: Fully offline vector search using
transformers.js(all-MiniLM-L6-v2) andLanceDB. No external API keys or internet connection required for search.π Automated Rule Enforcement: Enforces naming conventions (
Capitalized_Snake_Case) and mandatory metadata (YAML sources/tags) at the protocol level to prevent data entropy.πΊοΈ Autonomous Project Mapping: Automatically scans your directory structure and maintains a global index of all projects and knowledge nodes.
π Ingest API: Optional HTTP service to feed data from browser extensions, bots, or CLI tools directly into your Hub's
raw/directory.π³ Portable & Private: Runs as a lightweight Docker container. Your data stays on your machine, always under Git version control.
ποΈ Architecture
graph TD
User([User / Obsidian]) <--> Hub[(Knowledge Hub\nMarkdown + Git)]
AI_Agent([AI Agent / Gemini-CLI / Cursor]) <--> MCP[Librarian MCP Server]
MCP <--> Hub
External_Source([Web / API / Bots]) -- HTTP POST --> Ingest[Ingest API]
Ingest --> Hubπ οΈ Quick Start
1. Prerequisites
Docker & Docker Compose
A folder to serve as your Knowledge Hub (Librarian will initialize it if empty).
2. Configuration
Clone this repository:
git clone https://github.com/AlSokolov2/librarian-mcp.git cd librarian-mcpCreate your
.envfile:cp .env.example .envConfigure the following variables in
.env:KNOWLEDGE_HUB_PATH: Absolute path to your notes folder.USER_ID&GROUP_ID: Runid -uandid -gin your terminal to get these (prevents permission issues).
3. Launch
docker compose up -d4. Connect to your MCP Client
Add Librarian to your client configuration (e.g., ~/.gemini/settings.json):
"mcpServers": {
"librarian": {
"command": "docker",
"args": ["exec", "-i", "librarian-mcp", "node", "build/index.js"]
}
}Note: If you prefer to use the pre-built image from Docker Hub:
"args": ["run", "-i", "--rm", "alsokolov2/librarian-mcp:latest"]π Tools Reference
Tool | Description |
| Classic keyword search using |
| Contextual search by meaning. Finds related concepts even without keyword matches. |
| Reads any file from the Hub (wiki, raw, or meta). |
| Writes content to a new Git branch ( |
| Lists all pending AI-generated drafts. |
| Merges a specific draft branch into |
| Deletes a draft branch without saving changes. |
| Re-builds the local vector database for semantic search. |
| Synchronizes |
π Governance & Rules
Librarian enforces the "Knowledge Hub Constitution":
Naming: Files in
wiki/must beCapitalized_Snake_Case.md.Grounding: Every wiki page must have a
sourcesarray in its YAML header pointing to files inraw/.Structure: Every page must start with an
# H1 Header.History: Every change is committed to Git with an automated summary.
These rules are configurable via meta/config.json inside your Hub.
π Ingest API Usage
If enabled (ENABLE_INGEST_API=true), you can send data to the Hub via HTTP:
curl -X POST http://localhost:3000/ingest \
-H "Content-Type: application/json" \
-H "x-api-key: your-secret-key" \
-d '{
"filename": "meeting_notes.txt",
"content": "Raw text from the meeting..."
}'βοΈ License
MIT License. Created with β€οΈ by AlSokolov2.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AlSokolov2/librarian-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server