contextqmd-mcp
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., "@contextqmd-mcp install react 19 docs and search for useRef examples"
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.
contextqmd-mcp
MCP server for local-first, version-aware library documentation. Install, search, and retrieve docs for any library directly from your AI coding assistant.
What it does
ContextQMD is an alternative to context7 that keeps documentation local. It downloads doc packages from the ContextQMD registry, indexes them with QMD (BM25 + vector + LLM reranking), and serves results through the Model Context Protocol.
Install flow is bundle-first:
search the library catalog and choose a library/version
fetch manifest
download a
tar.gzdocs bundle when availableverify SHA256 checksum and unpack into the local cache
index with QMD
search locally
If a compatible bundle is missing, the server falls back to page-index plus per-page fetches. Installs are atomic with rollback on failure.
Related MCP server: docsGround
Install
npm install -g contextqmd-mcpOr run directly with npx:
npx contextqmd-mcpMCP Configuration
Add to your MCP client configuration (e.g., Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"contextqmd": {
"command": "npx",
"args": ["-y", "contextqmd-mcp"]
}
}
}Or if installed globally:
{
"mcpServers": {
"contextqmd": {
"command": "contextqmd-mcp"
}
}
}CLI Options
--transport <type> Transport type: stdio (default) or http
--port <number> HTTP port (default: 3001)
--registry <url> Registry URL override
--token <token> API token
--cache-dir <path> Cache directory overrideAvailable Tools
Tool | Description |
| Search the remote library catalog. Returns candidates with versions, aliases, source metadata, and local install status. |
| Install a documentation package. Bundle-first with SHA256 verification; falls back to page API. Atomic with rollback. Idempotent — skips if already installed with same manifest checksum. |
| Update installed docs to latest version or refresh when manifest checksum changes. Rolls back on failure. |
| Search installed documentation locally. Returns page-level results with snippets, line anchors, and scores. Supports auto/fts/vector/hybrid modes. |
| Read a bounded slice from a locally installed page by |
| List all locally installed documentation packages with metadata. |
| Remove an installed documentation version or all versions for a library. Cleans up both cache and search index. |
Search Modes
search_docs supports four modes via the mode parameter:
auto (default) — Smart routing based on query classification: short keyword queries use FTS, conceptual/how-to questions use vector, complex multi-aspect queries use hybrid.
fts — BM25 full-text search (fast, keyword-based). Best for API names, function lookups, and code patterns.
vector — Semantic vector search. Best for conceptual questions. Falls back to FTS on timeout.
hybrid — Combined BM25 + vector with LLM reranking (best quality, slower). Falls back to FTS on timeout.
Cross-library searches always use FTS regardless of mode.
Progressive Retrieval
The server uses a progressive retrieval model — search returns small snippets with line anchors, then get_doc allows bounded expansion:
Discover candidate libraries:
search_libraries({ query: "react refs" })Install the exact docs package:
install_docs({ library: "react", version: "19.2.0" })Search the local index:
search_docs({ query: "how can i optimize refs", library: "react", version: "19.2.0" })Read a bounded excerpt from the best result:
get_doc({ library: "react", version: "19.2.0", doc_path: "reference/react/useRef.md", from_line: 40, max_lines: 30 })
search_docs results
Each result includes: doc_path, page_uid, title, content_md, score, snippet, line_start, line_end, search_mode, and url.
search_docs is local-only. If the library is not installed, it returns a NOT_INSTALLED error instead of silently fetching from the network.
get_doc reading modes
Sequential:
from_line+max_lines(default: line 1, 60 lines)Context window:
around_line+before/after(default: 30 before, 60 after)Line numbers: set
line_numbers: trueto get line-number-prefixed output
Upgrade Note
Older installed libraries may still have legacy page_uid.md paths in the local QMD index. The server lazily rebuilds those indexes on first search. If the rebuild is interrupted, rerun update_docs or reinstall the affected library version.
Configuration
Config file location: ~/.config/contextqmd/config.json
{
"registry_url": "https://contextqmd.com",
"local_cache_dir": "~/.cache/contextqmd",
"default_install_mode": "slim",
"preferred_search_mode": "auto"
}Environment variables:
CONTEXTQMD_API_TOKEN— API token for authenticated endpoints
Architecture
src/
index.ts # CLI entry point, MCP server, 7 tool handlers
lib/
types.ts # TypeScript interfaces for the API contract
config.ts # Config loader (~/.config/contextqmd/config.json)
registry-client.ts # HTTP client for the ContextQMD registry API
local-cache.ts # Local filesystem cache manager (atomic installs, page layout)
doc-indexer.ts # QMD-backed search indexer (FTS, vector, hybrid, query classifier)Key design patterns:
Local-first: All search is local-only.
search_docsnever touches the network.Bundle-first installs: Prefers
tar.gzbundles; falls back to page-by-page API fetches.Atomic installs: Staged temp directories with backup/restore for safe upgrades.
Idempotent operations:
install_docsis a no-op when the same version/checksum is already installed.Security: Bundle extraction validates against path traversal, symlinks, and unsupported entry types.
Development
npm install # install dependencies
npm run build # compile TypeScript to dist/
npm run dev # watch mode
npm run check # type-check without emitting
npm test # run tests (vitest)
npm run test:watch # watch mode testsSet SKIP_INTEGRATION=1 to skip integration tests that require a running registry at localhost:3000.
Requirements
Node.js >= 22.0.0
License
MIT
Available Tools
8 toolsadd_local_docsAdd Local DocsA
Index local files or directories as a searchable documentation package. Use this to make project docs, READMEs, or any local markdown files searchable via search_docs.
Inputs: paths (required), name.
get_docGet DocARead-only
Read a bounded slice from a locally installed markdown page. Use doc_path or page_uid, and either from_line/max_lines or around_line/before/after.
Inputs: library (required), after, before, version, +6 more.
install_docsInstall DocsA
Install or refresh documentation for a library. This is idempotent: if the requested library/version is already installed with the same manifest checksum, it is a no-op. Otherwise it prefers a registry bundle, falls back to page fetches, and indexes everything locally for search.
Inputs: library (required), version.
list_installed_docsList Installed DocsARead-only
List all locally installed documentation packages with their versions, install modes, and page counts.
Inputs: no named parameters.
remove_docsRemove DocsA
Remove one installed documentation version or every installed version for a library from the local cache and local QMD index.
Inputs: library (required), version.
search_docsSearch DocsARead-only
Search installed documentation locally and return matching page metadata with snippets. Use get_doc to read full page content. This tool never fetches from the network. If a requested library/version is not installed, it returns NOT_INSTALLED.
Inputs: query (required), mode, library, version, +1 more.
search_librariesSearch LibrariesARead-only
Search the remote library catalog and return candidate libraries, available versions, and local install status. Use this first when you do not already know the exact canonical slug.
Inputs: query (required), limit.
update_docsUpdate DocsA
Update installed documentation to the latest resolved version. Also refreshes same-version installs when the manifest checksum changes.
Inputs: library.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools target clearly distinct operations: remote catalog search vs local docs search, install vs remove, list vs get. However, install_docs and update_docs overlap slightly because both can refresh existing documentation, which could cause occasional misselection when the goal is simply to refresh an installed version.
All tool names use a consistent snake_case verb-first pattern: search_libraries, install_docs, update_docs, search_docs, list_installed_docs, get_doc, remove_docs, add_local_docs. The resource naming is predictable and readable throughout.
Eight tools is well-scoped for a documentation management server, covering discovery, installation, updating, local indexing, listing, reading, searching, and removal without excessive surface area.
The tool set covers the full lifecycle: discovering libraries, installing docs, updating them, indexing local docs, searching local docs, reading page content, listing installed packages, and removing versions. No obvious operational gaps remain for the stated documentation-cache purpose.
Maintenance
Related MCP Connectors
Versioned documentation registry and semantic search for AI tools and coding assistants.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation for…
@latest documentation and code examples to 9000+ libraries for LLMs and AI code editors in a singl…
Docsy gives AI assistants current, version-specific documentation for libraries, frameworks and SDKs. Resolve library IDs and versions, then search and fetch focused official documentation with original source links using five read-only MCP tools. Hosted Streamable HTTP with OAuth 2.1 sign-in.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI coding assistants to search and retrieve information from a locally ingested knowledge base using hybrid search, grounded in user-curated documentation.17MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI coding agents to search, index, and manage documentation libraries with hybrid retrieval and live web fallback, all self-hosted and offline.1MIT
- AlicenseAqualityBmaintenanceEnables AI agents to retrieve exact-version library documentation from the project's lockfile and installed packages, providing cited API signatures and doc comments offline without rate limits.31MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to search codebases by meaning using local AI embeddings, so they can find relevant code even when terminology differs, while also offering package version lookup, indexing, cache, workspace, and status tools.114 npmMIT