roam-semantic-search
Provides semantic search over a Roam Research graph, enabling meaning-based queries, incremental index refresh, and index statistics retrieval.
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., "@roam-semantic-searchfind why the human must stay responsible"
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.
roam-semantic-search
Fully local semantic search over a Roam Research graph: fetch clear-text content through the Roam Local API, embed it with a locally hosted model, store vectors in a single SQLite file, and answer meaning-based queries from a CLI or an MCP server. Nothing about the graph's content ever leaves the machine — that constraint is the project's founding requirement, and it is enforced in code: the embedding client refuses any non-loopback server URL.
Roam Desktop ──(Local API, localhost HTTP)──► fetch ──► normalize ──► embed ──► store
▲ │
Ollama (localhost) SQLite (FTS5 + vector blobs)
│
MCP server (stdio) ◄── query ◄───────┘
CLI (roam-semantic-search search)Full design, phase results, and decision log: docs/design-plan.md.
How it works
Fetch — one flat Datalog pull of every entity carrying a
:block/uid(pages and blocks alike) through the Roam Local API; ~1 s for a 10k-entity graph. For an encrypted graph, the running Roam Desktop client is the only clear-text doorway, so the indexer runs on the same machine.Normalize — each block embeds with its breadcrumb: the page title plus ancestor block texts, root-first (ordered by ancestor count, never by wire order, which is creation order and diverges from depth on ~12% of nested blocks). Roam markup is cleaned to prose (
[[refs]]→ text,((uid))references resolve to their target's text one level deep);roam/jsandroam/csspages are skipped, and daily-note pages are indexed (skippable with--no-daily-notes). Each record also carries retrieval emphasis in three weight tiers: the page names its own text references ([[Page]]and#tagalike — its concepts, highest), its direct-childtags::values (its tags, middle), and its plain words plus its whole subtree's folded text (base). The keyword leg realizes the tiers as per-column BM25 weights (4/2/1); the vector leg by embed-input composition (labeled concept/tag segments, descendant text truncated first).Embed — a local Ollama server running
nomic-embed-text(768-dim), with the model'ssearch_document:/search_query:retrieval prefixes. Loopback-only, enforced.Store — one SQLite file (default
~/.cache/roam-semantic-search/<graph>.db): records + float32 embedding blobs, an FTS5 keyword mirror, and provenance meta. No SQLite extensions; vector KNN is a brute-force numpy matrix product (milliseconds at this scale).Query — hybrid retrieval: cosine KNN and BM25 rankings fused by reciprocal rank fusion, so paraphrase ("where do I argue…") and exact identifiers both rank.
Refresh — incremental: re-fetch + re-normalize everything (cheap), then re-embed only records whose content hash changed and delete vanished uids. Selection is by content hash alone — an edit changes descendants' breadcrumbs and referrers' resolved text, which no per-entity timestamp can see. A no-change refresh takes ~2 s.
Related MCP server: ragi
Requirements
Roam Desktop running locally with the Local API enabled (port, graph name, and a bearer token from Roam → Settings)
Ollama with the embedding model pulled:
ollama pull nomic-embed-text(brew services start ollamakeeps it running at login)Python ≥ 3.14 and a sibling checkout of guffin (the Local API transport layer)
Install
python3.14 -m venv .venv
.venv/bin/pip install -e ../guffin
.venv/bin/pip install -e ".[dev]"Configuration
The CLI and MCP server read the same environment the guffin tools use:
Variable | Meaning |
| Roam Local API port (backs |
| Graph name (backs |
| Local API bearer token (backs |
| Explicit index DB path (else |
| Embedding server URL (default |
CLI
roam-semantic-search build # full fetch → normalize → embed → store (~100 s for ~8k records)
roam-semantic-search refresh # incremental: re-embed only what changed (~2 s when idle)
roam-semantic-search search "why the human must stay responsible" -k 5
roam-semantic-search stats # store provenance: model, counts, build/refresh momentsA hit shows the Roam uid (usable as a ((ref))), the fused score, each ranking's
position (v: vector, k: keyword), the breadcrumb, and the text:
1. ((9KMmmo5aH)) [block score 0.0323 v:2 k:2]
The new Programmer (in the age of AI assistants) › The human Programmer/engineer
The human also remains the accountability boundary. The assistant can propose; ...MCP server
roam-semantic-search-mcp serves the index over stdio to any MCP client, with
three tools: semantic_search (hits plus index meta, so a caller can judge
staleness), refresh_index, and index_stats. Register with Claude Code:
claude mcp add --scope user roam-semantic-search --env GUFFIN_ROAM_GRAPH_NAME=<graph> -- $(pwd)/.venv/bin/roam-semantic-search-mcpThe Local API port and token are inherited from the shell environment rather than
stored in the client's config; without them refresh_index fails cleanly while
search keeps working.
Development
.venv/bin/black .
.venv/bin/ruff check --fix src/ tests/
.venv/bin/pyright # strict
.venv/bin/pytestConventions follow guffin's (Python 3.14, src layout, pyright strict,
@validate_call, regex not re, 120-char lines). The index DB contains the
graph's text in clear form — treat it like an export, and keep it out of anything
synced or shared.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables semantic search and retrieval from your local markdown brain (Remember.md) via MCP tools, running entirely offline with local embeddings.Last updated341MIT
- AlicenseAqualityBmaintenanceLocal-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.Last updated39MIT

Roam MCPofficial
Flicense-qualityBmaintenanceMCP server for Roam Research that enables AI assistants like Claude and Cursor to read, write, search, and query your Roam graph with full write access.Last updated53- FlicenseAqualityDmaintenanceProvides semantic vector search over local codebases via MCP, enabling hybrid search (dense + sparse + RRF) for any MCP client like GitHub Copilot or Claude Desktop.Last updated58
Related MCP Connectors
Local-first RAG engine with MCP server for AI agent integration.
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/jpanico/roam-semantic-search'
If you have feedback or need assistance with the MCP directory API, please join our Discord server