Skip to main content
Glama
mcp-server-docs-search

mcp-server-docs-search

mcp-server-docs-search

MCP server (Model Context Protocol) that lets Claude Code, Cursor, and other AI agents search your project's local Markdown docs. BM25 ranking, section-level results with line numbers, zero dependencies, no embeddings or API keys.

CI License: MIT Python 3.10+ Dependencies: none MCP

Your agent should read your docs before it guesses. Point this server at a docs/ folder (or the whole repo) and the agent gets three tools: search the docs, read one section, list what exists. Results are sections (split at headings), so the agent pulls 10 relevant lines instead of a 600-line page.

Quick start (under a minute)

pipx install git+https://github.com/metraflaxtech-png/mcp-server-docs-search.git
# or: uvx --from git+https://github.com/metraflaxtech-png/mcp-server-docs-search.git mcp-server-docs-search --help

Claude Code

claude mcp add docs-search -- mcp-server-docs-search serve --root ./docs

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "docs-search": {
      "command": "mcp-server-docs-search",
      "args": ["serve", "--root", "./docs"]
    }
  }
}

Claude Desktop / other MCP clients: same command and args, with an absolute --root.

Try it without an MCP client:

mcp-server-docs-search search "how do I rotate api keys" --root ./docs

Related MCP server: doctree-mcp

Example output

Against the sample docs in examples/docs:

$ mcp-server-docs-search search "how do I rotate api keys" --root examples/docs -k 3
1. guides/authentication.md:7  [Authentication > Rotating keys]  score=5.68
   Rotate keys every 90 days. Old keys keep working for 24 hours after rotation so deploys do not break.
2. guides/authentication.md:3  [Authentication > API keys]  score=4.05
   Create an API key in the dashboard under Settings > Keys. Send it in the `Authorization: Bearer <key>` header.
3. guides/rate-limits.md:1  [Rate limits]  score=1.36
   Every API key gets 600 requests per minute. When you go over, the API returns HTTP 429 with a `Retry-After` header.

read_doc over stdio, fetching just one section:

> {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"read_doc","arguments":{"path":"guides/rate-limits.md","heading":"Retrying"}}}
< {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"## Retrying\n\nBack off exponentially and respect `Retry-After`. Batch endpoints count as one request."}],"isError":false}}

Tools

Tool

Arguments

What it returns

search_docs

query, top_k (default 5), path_glob

Ranked sections: path:start-end [Heading > Sub], score, snippet

read_doc

path, optional heading

The whole doc, or one section by heading or Parent > Child breadcrumb

list_docs

optional path_glob

Every indexed doc and its section headings

How it works

  • Indexes .md, .mdx, .markdown, .rst, and .txt under --root, skipping hidden folders, node_modules, virtualenvs, build output, and files over 1 MB.

  • Splits each doc at Markdown headings (ignoring # lines inside code fences) and keeps the heading breadcrumb.

  • Ranks with BM25 (k1 = 1.5, b = 0.75). Heading words count double, and identifiers like max_tokens match both whole and in parts.

  • Re-indexes automatically when a doc is added, removed, or edited, so the agent never searches stale docs.

  • Read-only, local, no network calls. Paths that escape the root, including through symlinks, are refused.

FAQ

Why BM25 instead of embeddings / vector search? For project docs, the words people search with (function names, config keys, error codes) usually appear in the docs verbatim, and keyword ranking handles that well with zero setup: no model download, no API key, no vector database. Hybrid ranking is a welcome contribution; see the issues.

How do I give Claude Code access to my documentation? Run claude mcp add docs-search -- mcp-server-docs-search serve --root ./docs in your project, then ask Claude a question about your project. It can call search_docs and read_doc.

Is this RAG? It is the retrieval half of RAG, exposed as tools so the agent decides when to search. The agent's model does the generation.

How big a docs folder can it handle? It keeps the index in memory and rebuilds when files change. That is comfortable for typical project docs (hundreds of files). Very large doc sets would benefit from incremental re-indexing, which is an open issue.

Does it work with Windsurf, Zed, VS Code, or other MCP clients? Any client that runs MCP servers over stdio should work. It implements initialize, ping, tools/list, and tools/call (protocol versions 2025-06-18, 2025-03-26, 2024-11-05).

Development

python3 -m pip install -e ".[dev]"
python3 -m pytest

CI runs the tests on Python 3.10–3.13 plus a real stdio smoke test. See CONTRIBUTING.md and the good first issues. Questions or ideas? Open a discussion. Please follow the Code of Conduct.

License

MIT © 2026 Sangram More

More from metraflaxtech-png

  • agent-toolbelt: ready-to-use skills, rules, and prompts for AI coding agents (Claude Code, Cursor, AGENTS.md)

  • prompttest: regression-test LLM prompts with YAML suites in CI

  • mcp-server-repo-context: MCP server giving Claude Code and Cursor token-budgeted repo context

  • agents-md-sync: one source for AGENTS.md, CLAUDE.md, Cursor rules, and Copilot instructions

  • llm-tool-schema-lint: lint LLM function-calling and MCP tool schemas before your model sees them

Available Tools

3 tools
list_docsA

List every indexed doc with its section headings, to see what documentation exists.

Inputs: path_glob.

read_docA

Read a whole doc, or just one section of it by heading (as returned by search_docs).

Inputs: path (required), heading.

search_docsA

Search the project's local documentation (Markdown, MDX, reStructuredText, text) by keywords. Returns the best-matching sections with path, heading, line numbers and a snippet. Use before answering questions about how this project works.

Inputs: query (required), top_k, path_glob.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool maps to a distinct retrieval mode: keyword search (search_docs), content retrieval (read_doc), and enumeration of the index (list_docs). There is no realistic scenario where an agent cannot pick the right one, and the descriptions explicitly cross-reference each other's outputs (headings, line numbers).

    Naming Consistency5/5

    All three names follow the same verb_noun pattern (search_docs, read_doc, list_docs) with the same 'doc(s)' noun, and the singular/plural distinction is used naturally between collection-level and single-item operations.

    Tool Count5/5

    Three tools is exactly the right surface for a read-only documentation lookup server — search to find, read to retrieve, list to survey. Nothing is padded and nothing feels arbitrarily omitted.

    Completeness4/5

    Discovery (list, search) and retrieval (whole doc or section) cover the core read lifecycle with no dead ends for a read-only domain. Minor gaps: no way to read a file that isn't indexed, and search offers no filtering (by file type, path, or result count).

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to search local Markdown documents using natural language, with automatic indexing and section-level retrieval.
      10
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables agentic document retrieval over markdown, CSV, and JSONL using BM25 and tree navigation, without vector databases or embeddings, allowing AI agents to search, browse, and retrieve structured document sections.
      34 npm
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Indexes your project's markdown documentation and exposes it to AI agents via local hybrid search (lexical + semantic) with progressive disclosure tools.
      3
      127 npm
      5
      MIT