org-roam-mcp
Provides access to an org-roam knowledge graph, enabling AI agents to search nodes, read node files, find backlinks, explore graph neighborhoods and shortest paths, compute centralities and communities, suggest links, detect orphans, and sync the org-roam database via Emacs.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
org-roam MCP server
An MCP server that gives AI agents access to an org-roam knowledge graph.
It needs no API key: the AI client brings the model. Reads query the
org-roam SQLite database directly, so they work without Emacs.
org_roam_sync and emacs_eval go through emacsclient and need a
running Emacs server (M-x server-start).
AI client → MCP server (Python, stdio) → sqlite3 (reads)
→ emacsclient --eval (sync, Elisp)Tools
Tool | Parameters | Purpose |
|
| Find nodes by title substring |
|
| Find nodes by the words in their text |
|
| Find nodes by meaning (only with the extra |
|
| Read the full file of a node |
|
| All nodes that link to a node |
|
| Breadth-first neighbourhood of a node |
|
| Shortest paths between two nodes (max depth 8) |
|
| Neighbours two nodes share |
|
| Most connected nodes by degree |
| Nodes without links | |
| Run | |
|
| Evaluate any Elisp through |
Graph algorithms (networkx; only id: links count):
Tool | Parameters | Purpose |
|
| Node importance by PageRank |
|
| Topic clusters by Louvain community detection |
|
| Bridge nodes between clusters |
|
| Distance-based centrality |
|
| Local density of a node or the whole graph |
| Density, diameter, components, average degree | |
|
| Unlinked nodes with many shared neighbours |
| Weakly connected subgraphs |
org_roam_search_text searches the text of the files in the database:
all words must occur in a node, in any order, case ignored (ß matches ss),
and a phrase in double quotes counts as one word. Parts of words match too:
tomato finds tomatoes, and art finds party. It returns one line per node (the heading
node the hit is under, otherwise the file's node): id | title | file:line | snippet, with the hit marked as **hit**, most hits first. Property
drawers are not searched. Files that are not UTF-8 are skipped and counted.
It has no index: each call reads the files once. With 1,000 synthetic notes
(5 MB) a call took 0.2–0.7 s; with 5,000 (24 MB), 1 s for a rare word and
about 4 s for a word found in most files. An index (for example SQLite FTS5, as in the
roam-graph-mobile app) would be worth it when calls get slow with many more
notes.
Worked examples: docs/examples.md.
Search by meaning (optional)
A trial: org_roam_search_similar finds notes about the same thing in other
words, also across German and English, with an embedding model that runs on
the laptop. It is there only when the extra semantic is installed; without
it, nothing changes.
uv sync --no-config --extra semantic --directory ~/src/org-roam-mcp
claude mcp add --scope user org-roam -- \
uv run --no-config --extra semantic --directory ~/src/org-roam-mcp org-roam-mcp(With uvx: uvx --no-config --from 'org-roam-mcp[semantic] @ git+https://github.com/ChristianGeng/org-roam-mcp' org-roam-mcp;
that may install the larger CUDA build of PyTorch, see below.)
Size. The extra installs
sentence-transformerswith PyTorch, transformers, scikit-learn and the Hugging Face libraries: about 1 GB in the environment (PyTorch alone about 750 MB). In a clone,uv synctakes PyTorch from PyTorch's CPU-only index on Linux and Windows, so no CUDA libraries are installed.Model.
intfloat/multilingual-e5-small(384 dimensions, about 490 MB on disk, German and English), or any sentence-transformers model named inORG_ROAM_MCP_EMBED_MODEL. e5 models get theirquery:andpassage:prefixes; other models none.What leaves the machine: only the model download, once, from Hugging Face (into
~/.cache/huggingface). The notes and the queries are not sent anywhere.Pieces. Each node (the file's node, and each heading with its own
:ID:, as inorg_roam_search_text) is one piece, or several pieces of about equal size when it is longer, with the node's title and tags in front. A piece has at most 400 words, and it fits whole in what the model reads (itsmax_seq_length: 512 tokens for e5-small, 128 forparaphrase-multilingual-MiniLM-L12-v2), counted with the model's tokenizer, prefix, title and tags included; the model would cut off the rest, and 400 German words are about 660 e5 tokens. Property drawers are left out. A result is one line per node, most similar first:id | title | file:line | snippet, where the snippet is the start of the node's best piece.Cache. The vectors are kept in
$XDG_CACHE_HOME/org-roam-mcp/semantic.sqlite(default~/.cache/org-roam-mcp/;ORG_ROAM_MCP_CACHE_DIRsets another folder), never in the notes folder. It holds the text of the notes, so the folder is made readable only by you (0700) and the file too (0600), also when they were there before. The vectors are keyed by file, a hash of the file (with its titles and tags from the database and the model's limit) and model, so a call embeds only new and changed files; files no longer in the database are dropped. Deleting the file is safe; it is built again.First call. It loads the model (about 20 s) and embeds every note, which can take minutes and may be longer than the client waits for a tool. Run the comparison script once first (below); it fills the same cache. With 200 synthetic notes (307 pieces) on a busy 12-core laptop, embedding took about 150 s (0.5 s a piece); a query on the filled cache then took about 0.04 s.
Comparing it with the text search. Write your questions into a file, one
per line, optionally with | and the IDs of the notes that should be found:
how do I keep the soil moist | 1f0c2d4e-... 9a2e7b10-...
Wann wird der Kürbis geerntet?uv run --no-config --extra semantic scripts/compare_search.py questions.txtIt prints the database and the model, the time to index, and for each
question the top 10 of both searches side by side (expected IDs marked with
*), the time of each, and recall@10 when IDs are given, with averages at the
end. The text search needs every word of a question in a node, so for a
whole sentence it often finds nothing; that is part of the comparison.
Related MCP server: nvim-markdown-notes-memgraph
Install
Needs Python 3.10+ and uv. The repository is public, so no GitHub account is needed.
The simplest way: let uv fetch and run it, and register it with Claude Code in one line.
claude mcp add --scope user org-roam -- \
uvx --no-config --from git+https://github.com/ChristianGeng/org-roam-mcp org-roam-mcpThis needs a network connection the first time. To use a release instead of
the newest code, add the tag: …/org-roam-mcp@v0.1.0.
Check that it installs and which version runs:
uvx --no-config --from git+https://github.com/ChristianGeng/org-roam-mcp org-roam-mcp --version
uvx --no-config --from git+https://github.com/ChristianGeng/org-roam-mcp org-roam-mcp --help--help also explains how the database is found. Without arguments the
command starts the server, which then waits for an MCP client on standard
input; that is what Claude Code does, so it is not run by hand.
--no-config ignores custom package indexes from a surrounding uv config,
which may be unreachable (for example off a company VPN).
From a local clone
A clone starts offline after the first uv sync. Any folder works, for
example ~/src/org-roam-mcp:
git clone https://github.com/ChristianGeng/org-roam-mcp.git ~/src/org-roam-mcp
uv sync --no-config --directory ~/src/org-roam-mcp
claude mcp add --scope user org-roam -- \
uv run --no-config --directory ~/src/org-roam-mcp org-roam-mcpUpdate
With uvx, add --refresh once to fetch the new version. With a clone:
git -C ~/src/org-roam-mcp pull
uv sync --no-config --directory ~/src/org-roam-mcpThen restart the client (in Claude Code, /mcp and reconnect).
Check with claude mcp list; then in a session ask for
org_roam_find("some title").
Other clients
The server uses no API keys and no model of its own. The client (Claude
Code, OpenCode, an editor) brings the model and its key; the server only
reads the local org-roam database and, for org_roam_sync and
emacs_eval, talks to the local Emacs.
OpenCode
Add the server as a local MCP server, either with OpenCode's command:
opencode mcp add org-roam -- \
uvx --no-config --from git+https://github.com/ChristianGeng/org-roam-mcp org-roam-mcpor by hand in OpenCode's config: opencode.json (or opencode.jsonc) in a
project, or ~/.config/opencode/opencode.json for every project. With
OpenCode's current config format (V2), local servers go under
mcp.servers:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"org-roam": {
"type": "local",
"command": ["uvx", "--no-config", "--from",
"git+https://github.com/ChristianGeng/org-roam-mcp",
"org-roam-mcp"],
"environment": {
"ORG_ROAM_DB": "/home/you/.config/emacs/.local/cache/org-roam.db"
}
}
}
}
}environment is only needed when Emacs is not running and the database is
not in a standard place (see Finding the database);
otherwise leave it out. With the command, pass it as
opencode mcp add org-roam --env ORG_ROAM_DB=… -- uvx …. The older V1
format puts "org-roam" directly under "mcp" (with "enabled": true
instead of "disabled"); OpenCode still reads it. See OpenCode's
MCP servers and
config pages.
VS Code, Windsurf and others
VS Code (.vscode/mcp.json), Windsurf (~/.codeium/windsurf/mcp_config.json)
and other clients take the same command:
{
"servers": {
"org-roam": {
"command": "uvx",
"args": ["--no-config", "--from",
"git+https://github.com/ChristianGeng/org-roam-mcp",
"org-roam-mcp"]
}
}
}(Windsurf and Claude's JSON config call the key mcpServers.)
Finding the database
The server uses the first of these that holds an org-roam database (one
with org-roam's files and nodes tables):
A running Emacs. The server asks it for
org-roam-db-locationthroughemacsclient: first the default server (emacsclientitself readsEMACS_SERVER_FILE), then the server named byEMACS_SOCKET_NAMEif it is set, then the default sockets/run/user/<uid>/emacs/serverand/tmp/emacs<uid>/server. Emacs needs(server-start)and org-roam loaded.ORG_ROAM_DB, the full path oforg-roam.db.The standard places of vanilla Emacs and Doom Emacs:
~/.emacs.d/org-roam.db~/.emacs.d/.local/cache/org-roam.db$XDG_CONFIG_HOME/emacs/org-roam.db$XDG_CONFIG_HOME/emacs/.local/cache/org-roam.db
$XDG_CONFIG_HOMEis~/.configwhen it is not set.
If your database is somewhere else and Emacs is not running, set
ORG_ROAM_DB, for example in the client's command:
claude mcp add --scope user org-roam -e ORG_ROAM_DB="$HOME/path/to/org-roam.db" -- \
uvx --no-config --from git+https://github.com/ChristianGeng/org-roam-mcp org-roam-mcpAn Emacs server with another name (server-name) is found when
EMACS_SOCKET_NAME is set for the MCP server: the server passes it to
emacsclient as --socket-name, so this works with any Emacs version
(emacsclient reads the variable itself only from Emacs 27 on). A TCP
server (server-use-tcp) is found when EMACS_SERVER_FILE is set.
Otherwise use ORG_ROAM_DB.
If nothing is found, the error lists every place that was tried, in this order, and says how to fix it. A database that was found is used for 60 seconds without looking again, so an Emacs that does not answer does not slow down every query.
Skills
Skills are instructions for an AI agent that use this server's tools. They
live next to the server in skills/; the server itself does not change.
org-roam-infographic
skills/org-roam-infographic/ tells the agent how to make an infographic
from org-roam notes with code: it reads the notes through this server,
takes every number and date only from the notes, picks a form (timeline,
bar or line chart, comparison, process, map of linked notes), and draws
one SVG file (or one self-contained HTML file when it needs interaction).
It checks the file with check_svg.py, renders it once to look at it, and
saves it next to the note without overwriting anything. It sends nothing
anywhere: no image API, no upload. Image models draw text and numbers
badly; code draws them exactly, and the file can be edited later.
See the synthetic example.
Claude Code reads skills from ~/.claude/skills/ (all projects) or
.claude/skills/ (one project). Link the skill folder there, for example
from a local clone:
mkdir -p ~/.claude/skills
ln -s ~/src/org-roam-mcp/skills/org-roam-infographic ~/.claude/skills/org-roam-infographicOpenCode reads the same SKILL.md files. It looks in
~/.config/opencode/skills/ and .opencode/skills/, and also in
~/.claude/skills/ and .claude/skills/, so the link above works for both
(see OpenCode's skills page). To link it
for OpenCode only:
mkdir -p ~/.config/opencode/skills
ln -s ~/src/org-roam-mcp/skills/org-roam-infographic ~/.config/opencode/skills/org-roam-infographicThe skill needs this MCP server to be set up in the same client (see
Install and Other clients), and Python 3.10+
for check_svg.py. After git pull in the clone, the linked skill is up to
date.
Development
uv run pytest
uvx ruff check .Moved out of cgeng-ai-skills (mcps/org_roam) with its history.
Licence
MIT, see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Shared memory for AI agents, as a graph in your own Postgres. Writes never call an LLM.
Personal wiki and memory layer for AI assistants. Persistent, structured memory across sessions.
Persistent knowledge graph for AI agents. Remember, recall, and forget facts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants like Claude and Codex to read, write, search, and traverse Markdown notes stored in a self-hosted knowledge base.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query and interact with a graph database of markdown notes, extracting entities like wikilinks, mentions, and hashtags.MIT
- FlicenseNot gradedqualityDmaintenanceEnables MCP-capable agents to search, create, and link notes in an Org-roam knowledge base using a headless Emacs daemon, with graph diagnostics and backlink traversal.-
- FlicenseNot gradedqualityAmaintenanceEnables creating, linking, searching, exploring, and synthesizing atomic notes as a knowledge graph through MCP-compatible clients such as Claude. Supports tags, note types, semantic relationships, Markdown storage, and an SQLite index for efficient traversal.-