claude-code-docs
This server provides fast, local semantic search over Claude Code documentation via MCP tools.
search_docs: Query the official Claude Code docs and get ranked snippets with metadata (chunk ID, category, source file). Supports filtering by category, custom result limits, and aliases.
reload_docs: Force a refresh of the documentation and rebuild the search index.
get_status: Check server health, trust mode, docs source, index age, load errors, and active warnings.
dump_index_metadata: Inspect indexing details such as categories, chunk counts, headings, code literals, config keys, and distinctive terms.
Supports caching, stale-fallback, and configurable trust modes for reliable local search.
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., "@claude-code-docs search for Claude Code plugin setup"
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.
claude-code-docs MCP Server
Version: 1.0.0
Runtime: Node.js >=18 (TypeScript, ESM)
Key dependencies: @modelcontextprotocol/sdk, zod, yaml, stemmer
License: Not specified in this package
Problem Statement
Claude Code's documentation is large and frequently updated, but most MCP clients need fast, local search results rather than full-document scans. This server fetches the official docs, chunks them into semantic sections, builds an in-memory BM25 index, and exposes MCP tools that return ranked snippets.
The result is a small, focused MCP server that provides deterministic, query-focused results with minimal client integration surface: a stdio transport, four tools, and a cache-backed indexing pipeline.
Related MCP server: MCP Context Manager
Quick Start
From this directory, install dependencies:
npm installBuild the server:
npm run buildStart the MCP server (stdio transport):
npm start
To use the server from an MCP client, see Client Configuration below.
How It Works
Pipeline overview:
Fetch official docs from the configured URL and parse
Source:markers into sections.Synthesize frontmatter (topic/id/category) and chunk each section at semantic boundaries.
Tokenize and build a BM25 index (with heading-based score boosting).
Serve MCP tool calls against the in-memory index.
Design properties:
Two-cache model: a raw content cache (TTL-based) and a serialized index cache (version-gated).
Fail-open on expected fetch/validation errors by falling back to stale cache when allowed.
Fail-closed on programmer errors to avoid masking regressions.
Concurrency-safe index loading with a shared in-flight promise and retry backoff.
Configuration
Environment variables:
Variable | Default | Purpose | Constraints / Behavior |
|
| Source documentation URL. | Validated on startup; must be a valid |
|
| Trust mode controlling source validation and canary policy. |
|
|
| Retry backoff for failed index loads. | Validated on startup; must be an integer between |
|
| Content cache freshness window in milliseconds. | Integer >=0. |
|
| Maximum allowed age for stale cache fallback. | Validated on startup; must be an integer >=0. |
| (unset) | Override for the canary's index floor. | Integer >=0. Unset → canary uses its trust-mode default (official: 40, unsafe: 3). |
|
| Max serialized index size in bytes before writing cache. | Validated on startup; must be an integer >0. If exceeded, index cache write is skipped (server keeps in-memory index). |
|
| Max HTTP response size in bytes. | Integer >0. If declared or streamed size exceeds, fetch fails and falls back to stale cache when available. |
|
| HTTP fetch timeout in milliseconds. | Integer >=0. |
| unset | Override the content cache file path. | Must include a filename (not just a directory). Does not move the index cache. |
| unset | Base cache directory for defaults. | When set, affects default content and index cache paths. |
Default cache locations:
macOS content cache:
~/Library/Caches/claude-code-docs/llms-full.txtmacOS index cache:
~/Library/Caches/claude-code-docs/llms-full.index.jsonLinux content cache:
$XDG_CACHE_HOME/claude-code-docs/llms-full.txt(or~/.cache/claude-code-docs/llms-full.txt)Linux index cache: same directory,
llms-full.index.json
Notes:
CACHE_PATHoverrides only the content cache file path. The index cache always uses the default cache directory derived fromXDG_CACHE_HOMEor OS defaults.Content cache writes use a lock file (
.lock) to coordinate concurrent writers.
Tools
search_docs
Searches the indexed Claude Code docs.
Parameters:
Name | Type | Required | Default | Notes |
| string | yes | - | Max 500 chars, trimmed, must be non-empty. |
| integer | no |
| 1-20. |
| string | no | - | Canonical categories or aliases (see below). |
Canonical categories:
hooks, skills, commands, agents, plugins, plugin-marketplaces, mcp, channels, settings, memory, overview, getting-started, cli, best-practices, interactive, security, providers, gateways, environments, ide, ci-cd, automation, agent-sdk, desktop, integrations, config, operations, troubleshooting, changelog, uncategorized
Aliases:
subagents -> agents, sub-agents -> agents, slash-commands -> commands, claude-md -> memory, configuration -> config, gateway -> gateways
Return shape:
Field | Type | Description |
| object | Array of matches. |
| string | Chunk identifier. |
| string | Full chunk content. |
| string | Snippet best matching the query. |
| string | Derived category. |
| string | Source URL/path. |
| object | Index provenance attached to each search response. |
| string | Active trust mode: |
| string or null | How content was obtained: |
| string or null | ISO timestamp when the BM25 index was built. Null if not yet loaded. |
| integer or null | Milliseconds since the corpus content was obtained ( |
| string | Present only on failure. |
reload_docs
Forces a refresh of the docs and rebuilds the index.
Parameters: none.
Return:
Text message indicating success, chunk count, and any parse warnings.
get_status
Returns a lightweight runtime status snapshot. Use this to check index health, trust configuration, and canary evaluation results without triggering a reload or dumping the full metadata.
Parameters: none.
Return shape:
Field | Type | Description |
| string | Active trust mode: |
| string | Hostname of the documentation source URL. |
| string | Full documentation source URL. |
| string or null | How content was obtained: |
| string or null | ISO timestamp when the BM25 index was built. Null if not yet loaded. |
| number or null | Milliseconds since corpus content was obtained. Null if no corpus loaded. |
| string or null | ISO timestamp when corpus content was obtained. Null if no corpus loaded. |
| string or null | ISO timestamp of the most recent load attempt. Null if never attempted. |
| string or null | Error message from the most recent failed load. Null if last load succeeded. |
| string[] | Active warning codes: |
| boolean | Whether a load/reload is currently in progress. |
dump_index_metadata
Returns structured index metadata useful for debugging ingestion, category mapping, and chunk coverage without dumping the full corpus.
Parameters: none.
Return shape:
Field | Type | Description |
| string | Serialized index format version. |
| string | ISO timestamp for the response build time. |
| string or null | Content hash for the currently loaded docs. |
| object | Per-category chunk metadata. |
| string | Canonical category name. |
| string[] | Accepted aliases for the category. |
| integer | Number of chunks in the category. |
| object | Chunk-level metadata for debugging and inventory building. |
Resources
None.
Transport
The server uses stdio transport via the MCP SDK.
Client Configuration
Example .mcp.json entry:
{
"mcpServers": {
"claude-code-docs": {
"command": "node",
"args": ["/absolute/path/to/claude-code-docs/dist/index.js"]
}
}
}Tests
Run:
npm test
The suite covers parser, chunker, loader, lifecycle, fetcher, metadata, and cache behavior. Special cases:
tests/integration.test.tsis skipped unlessINTEGRATION=1.tests/corpus-validation.test.tsdepends on a populated content cache.
Known Limitations
Stdio transport only; no HTTP/SSE transport.
No background refresh loop; use
reload_docsfor refreshes.Category filtering is limited to the predefined list above.
Available Tools
4 toolsdump_index_metadataDump Index MetadataA
Dump full BM25 index metadata: categories, chunk IDs, headings, code literals, config keys, and distinctive terms. No parameters.
Inputs: no named parameters. Returns: built_at, categories, docs_epoch, index_version, +1 more
get_statusGet Server StatusA
Get current status of the claude-code-docs server: trust mode, documentation source, index age, and any active warnings.
Inputs: no named parameters. Returns: docs_url, is_loading, trust_mode, docs_origin, +7 more
reload_docsReload Claude Code DocsA
Force reload of Claude Code documentation. Use after editing docs to refresh search index.
Inputs: no named parameters.
search_docsSearch Claude Code DocsA
Search Claude Code documentation (extensions, setup, security, providers, IDE integration, CI/CD, and more). Use specific queries.
Inputs: query (required), limit, category. Returns: meta, error, results
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: reloading docs, searching, getting server status, and dumping index metadata. No overlap or ambiguity.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., reload_docs, search_docs, get_status, dump_index_metadata), making them predictable.
Four tools is well-scoped for a documentation management server, covering all necessary operations without being excessive or insufficient.
The tool set covers the core lifecycle: reloading, searching, status, and metadata inspection. A minor gap could be a tool to add or update documentation sources, but current set is largely complete.
Maintenance
Related MCP Connectors
Search the official docs of Claude Code, Cursor, OpenAI Codex and MCP, refreshed daily.
Search and read the Claude Platform documentation and API reference.
Token-efficient search for coding agents over public and private documentation.
Search and read Vector Panda docs: API operations, pricing, storage tiers, measured benchmarks.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceProvides hybrid semantic and keyword code search for Claude Code using BM25 and vector retrieval. It enables indexing and searching local codebases with language-aware chunking and local embeddings.-
- AlicenseAqualityDmaintenanceEnables efficient code navigation and retrieval through natural language search, BM25 ranking, and fuzzy matching across multiple programming languages. It drastically reduces token usage by allowing Claude to query specific code symbols and logic instead of reading entire files.13100 npm13MIT
- AlicenseAqualityDmaintenanceSemantic search across Claude Code conversations. Hybrid vector + keyword search, fully local, background indexing.621 npm11MIT
- AlicenseAqualityDmaintenanceEnables semantic search over codebases using natural language queries, returning relevant code snippets with source locations. Integrates with Claude Code for automatic codebase exploration.11MIT