How to set up QMD for Claude
Walks through installing qmd, indexing projects, adding it as an MCP server, and configuring Claude to use it before reading files.
What this file does
Walks through installing qmd, indexing projects, adding it as an MCP server, and configuring Claude to use it before reading files.
When to use it
- You want Claude to search your local codebase instead of reading files directly
- You maintain many projects and need fast semantic search across them
- You're setting up Claude Code with MCP tools for the first time
- You want to reduce token usage by having Claude search before reading
Assumes this stack
How to set up QMD for Claude
Here’s the full setup, step by step.
Step 1: Install qmd
First, install Bun if you don’t have it:
curl -fsSL https://bun.sh/install | bash
Then install qmd:
bun install -g github:tobi/qmd
Step 2: Index your projects
For each project you work on:
qmd collection add ./my-project --name myproject
This indexes all markdown and JSON files by default. You can customize the file patterns with --mask:
qmd collection add ./my-project --name myproject --mask "**/*.{ts,tsx,md,json}"
Then generate vector embeddings for semantic search:
qmd embed
You can verify everything is indexed:
qmd status
I have 27 collections with 181 indexed documents across all my projects. The index is lightweight and fast.
To keep the index up to date as your code changes:
qmd update
Step 3: Add qmd as an MCP server in Claude Code
Open your Claude Code MCP config at ~/.claude/settings.json and add qmd:
{
"mcpServers": {
"qmd": {
"command": "qmd",
"args": [
"mcp"
]
}
}
}
Restart Claude Code. It now has access to qmd’s search tools natively — search, vsearch, query, get, and multi_get.
Step 4: The secret sauce — CLAUDE.md
This is the most important step, and the one most people skip.
Claude Code doesn’t know it should use qmd unless you tell it. By default, it will fall back to its usual Read/Glob/Grep behavior.
Add this to your project’s CLAUDE.md (or ~/.claude/CLAUDE.md for a global rule that applies everywhere):
Rule: always use qmd before reading files
Before reading files or exploring directories, always use qmd to search for information in local projects.
Available tools:
qmd search “query”— fast keyword search (BM25)qmd query “query”— hybrid search with reranking (best quality)qmd vsearch “query”— semantic vector searchqmd get <file>— retrieve a specific document
Use qmd search for quick lookups and qmd query for complex questions. Use Read/Glob only if qmd doesn’t return enough results.
Once this is in place, Claude will always search the index first. It will only fall back to reading full files when it genuinely can’t find what it needs through the index.
What's inside
4 setup steps, 6 shell commands, 1 JSON config snippet, 1 CLAUDE.md rule block
Change this for your project
- Replace
tobi/qmdwith the correct package name if it differs - Replace
./my-projectandmyprojectwith your actual project paths and names - Replace
~/.claude/settings.jsonwith your actual config file path if different
Where it goes
Reference documentation for a retrieval pipeline. Keep with the ingestion or retrieval code it describes.
Related Documents
SUMMARY
Proposes three on-prem AI architectures, modular, hybrid, and fully local RAG, with hardware specs and vendor lists.
Retrieval & Prompts
Explains how CharMemory's extraction prompt and Vector Storage settings determine memory retrieval quality in SillyTavern.
Advanced RAG Techniques
Surveys advanced RAG architectures, Agentic, Corrective, Self-RAG, Graph RAG, RAPTOR, Multimodal, Temporal, with design trade-offs and decision guidance.
RFC-BLite: High-Performance Embedded Document Database for .NET
Specifies an embedded document database for.NET with zero-allocation I/O, C-BSON format, and ACID transactions.