mcp_rag_server
Ingests Logseq notes into the local Markdown vault, making them searchable through the brain's retrieval and MCP tools.
Click on "Deploy 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., "@mcp_rag_serversearch my notes for the authentication refactor plan"
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.
local-brain
A private, local-first knowledge brain: a Markdown vault with hybrid semantic search, a desktop editor, and an MCP server so AI tools can query it — running entirely on your own machine, with nothing sent to a third party.

Why
Most "second brain" tools want your notes on someone else's server. This one
does not. Notes stay as plain Markdown files you own and can read with cat.
Search runs against a local SQLite file with FTS5 full-text search and
sqlite-vec vector similarity, so it works offline and keeps working if the
provider disappears. Embeddings are computed locally with fastembed (or
Ollama, if you prefer a local model).
The MCP server is the point of the project: it exposes the same retrieval to AI coding tools, so an assistant can pull in the notes and context you actually care about instead of a generic model's guesses.
Related MCP server: Another bloated Obsidian MCP Server
What it does
Markdown vault — notes as plain
.mdfiles with frontmatter, tags, backlinks and a D3 force-directed graph view.Hybrid search — SQLite FTS5 for keywords plus sqlite-vec for semantic similarity, ranked together.
/api/rag/searchand/api/search.Desktop shell — PySide6 window with a QWebEngineView host for the web UI.
WYSIWYG editor — Milkdown-based Markdown editing, so the vault is writable without leaving the app.
MCP server —
search_memory,recent_contextandindex_memoryexposed over the Model Context Protocol.Integrations — CalDAV calendar, Logseq note ingestion, Obsidian-style backlinks, plus a small leads tracker, job tracker and todo store.
OpenCode chat ingestion — index your AI coding sessions back into the vault so your own history becomes searchable memory.
Stack
Layer | Choice |
Backend | FastAPI, uvicorn (37 REST endpoints) |
Desktop shell | PySide6 + QWebEngineView |
Editor | Milkdown (WYSIWYG Markdown) |
Graph view | D3.js force-directed |
Storage | Markdown files on disk + one SQLite file |
Search | SQLite FTS5 + sqlite-vec vector similarity |
Embeddings | fastembed ( |
AI integration | MCP (Model Context Protocol) server |
Quick start
git clone https://github.com/ksohos333/local-brain.git
cd local-brain
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
bash run.shThen open http://127.0.0.1:9876 for the web UI, or launch the desktop shell:
python desktop.pyThe first run creates the database at ~/.local/share/local-brain/brain.db and
downloads the embedding model. After that, everything is offline.
Architecture
local-brain/
├── local_brain/
│ ├── main.py # FastAPI app — notes, search, graph, chat, calendar
│ ├── rag.py # Hybrid retrieval: SQLite FTS5 + sqlite-vec
│ ├── embeddings.py # fastembed / Ollama embedders
│ ├── vault.py # Markdown read/write, frontmatter, backlinks
│ ├── chat.py # Chat proxy over local / hosted models
│ ├── ingest.py # Ingest external notes and chat transcripts
│ ├── apps.py # App registry exposed via /api/apps
│ ├── caldav.py # CalDAV calendar sync
│ ├── logseq.py # Logseq note ingestion
│ ├── jobs.py # Job tracker
│ ├── leads.py # Leads tracker
│ ├── termart.py # Terminal art helpers
│ ├── config.py # Configuration
│ └── static/ # Web UI — index.html, app.js, style.css
├── mcp_rag_server.py # MCP server bridging AI tools to the brain
├── desktop.py # PySide6 desktop shell
├── run.sh # Launch uvicorn on 127.0.0.1:9876
├── start_server.py # Start the server as a detached daemon
└── migrate_pg_to_sqlite.py # One-off migration from the Postgres backendAPI
A selection of the 37 endpoints:
Method | Path | Purpose |
|
| List notes in the vault |
|
| Read a single note |
|
| Create or update a note |
|
| Keyword + semantic search |
|
| Hybrid RAG retrieval |
|
| Recently indexed content |
|
| Index content into the vault |
|
| Rebuild the whole index |
|
| Link graph for the D3 view |
|
| Backlinks for a note |
|
| Chat over the local brain |
|
| CalDAV calendar events |
|
| Tracker data |
Full list: http://127.0.0.1:9876/docs (FastAPI auto-generated OpenAPI UI).
MCP server
mcp_rag_server.py exposes the brain to AI coding tools over the Model Context
Protocol. It talks to the local server over HTTP, so the MCP server and the
brain can run as separate processes.
source .venv/bin/activate
python mcp_rag_server.pyTools exposed:
Tool | Purpose |
| Hybrid semantic + keyword search over the vault |
| Most recently indexed content for a session |
| Index new content into the vault |
Example client configuration:
{
"mcpServers": {
"local-brain": {
"command": "python",
"args": ["/path/to/local-brain/mcp_rag_server.py"],
"env": { "LOCAL_BRAIN_URL": "http://127.0.0.1:9876" }
}
}
}Development
source .venv/bin/activate
uvicorn local_brain.main:app --reload --port 9876The vault location, embedding model and MCP endpoint are all configurable in
local_brain/config.py.
Status
Actively developed. The Postgres + pgvector backend was replaced by SQLite with
sqlite-vec and FTS5, which removed the container dependency and made the
whole thing single-file; migrate_pg_to_sqlite.py handles moving an existing
vault across.
License
MIT — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Personal context for every AI: search, read, and write back to your private Markdown library.
Token-efficient MCP memory for Markdown vaults. Tiered search, GraphRAG, AI memories.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA local-first CLI and MCP server that helps you build and search a personal knowledge vault from Markdown notes, with semantic search and AI-powered features like stale note detection and session memory harvesting. It’s provider-agnostic, requires no GPU in its default mode, and exposes your vault as long-term memory to any MCP-compatible AI tool like Claude Code.36 PyPI47Apache 2.0
- AlicenseAqualityFmaintenanceA Model Context Protocol (MCP) server that provides AI assistants with secure access to Obsidian vaults. Enables reading, writing, searching, and managing notes without requiring Obsidian to be running.508,850 npmApache 2.0
- AlicenseAqualityBmaintenanceExposes local markdown documentation, notes, and knowledge bases to AI tools via the Model Context Protocol without embeddings or uploading.428 PyPI1MIT
- AlicenseNot gradedqualityDmaintenanceA local-first MCP server that turns a .context/ folder of markdown files into a searchable knowledge layer for AI coding agents.17 npm2MIT