node-llama-cpp), and LLM re-ranking without any cloud dependencies.
Prerequisites
- Linux or WSL2 (Ubuntu / AlmaLinux) environment.
- Node.js v22+ and
npm. crontabutility for automated background synchronization.
1. Clean Installation Without Root Conflicts
To prevent root permission issues during global NPM package installation, configure a user-scoped NPM directory (~/.npm-global).
2. Multi-Project Collection Scoping (Query Latency Optimization)
Utilize-c <collection> scoping by default in all local search scripts to minimize SQLite FTS5 query latency and restrict matches to the active workspace collection.
Register unique collection names for each project workspace to prevent index collisions in ~/.cache/qmd/index.sqlite.
3. Incremental Indexing Routines
QMD uses SHA-256 content hashes and file modification timestamps (mtime) to perform fast incremental scans. Unchanged files are skipped automatically during embedding calculations.
4. Automated Hourly Background Sync
To guarantee that on-device search indices remain updated without manual intervention, configure an automated hourly cron job.Create Sync Script (~/.local/bin/qmd-sync-hourly.sh)
Install Crontab Job
5. Model Context Protocol (MCP) & FastMCP Integration
QMD can be integrated with AI IDEs (Cursor / Claude / Gemini) through two mechanisms:A. Direct FastMCP Server Integration (tools/mcp/server.py)
The DSOM FastMCP server includes qmd_search directly, enabling AI IDEs to run on-device hybrid search queries (note that collection scoping is not automatic and callers must explicitly pass the active collection parameter, e.g. collection="myproj-docs"):
B. Standalone Stdio MCP Server Configuration
Register QMD as a standalone MCP tool server in~/.gemini/config/mcp_config.json or workspace mcp.json. Resolve the executable path dynamically via command -v qmd or fallback to $HOME/.npm-global/bin/qmd:
mcp_config.json, configure the server command with the resolved path stored in $QMD_PATH (e.g. /home/user/.npm-global/bin/qmd or /usr/local/bin/qmd):
6. Verification and Querying
Execute verification queries to confirm proper indexation:Deep State of Mind (DSOM) For My AI Protocol | Harisfazillah Jamel (LinuxMalaysia) | 2026-10-09 Standard: UK English | DBP-standard Bahasa Melayu Malaysia (Piawai) | GNU General Public License v3.0