Skip to main content

mcp-docs-ask

CI PyPI Python 3.13+ License: MIT

Local RAG MCP for documentation. Point source at any markdown repository (local path or git URL).

The server does retrieval only (no answer LLM). ask_docs returns grounded passages and citations; the MCP host (Cursor / Claude) synthesizes the answer.

Features

  • ask_docs retrieval with configurable path-based layer filters
  • list_docs discovery for configured docs collections and layer filters
  • reindex rebuilds the local vector index; for git URL sources it also fetches updates

Requirements

  • Python 3.13+
  • uv
  • git on PATH (only if source is a git URL)
  • Git credentials on the machine when source is a private git URL (gh auth login, HTTPS credential helper, or SSH). No tokens in config.
  • First run downloads the embedding model weights once (sentence-transformers)

Quick start

git clone git@github.com:alyiox/mcp-docs-ask.git
cd mcp-docs-ask
uv sync
mkdir -p ~/.config/mcp-docs-ask
cp config.example.json ~/.config/mcp-docs-ask/config.json
# Prefer a local checkout while developing:
#   set docs.<id>.source to your docs repo path
npx -y @modelcontextprotocol/inspector uv run mcp-docs-ask

Configuration

Config path: ~/.config/mcp-docs-ask/config.json

Windows: %USERPROFILE%\.config\mcp-docs-ask\config.json

{
  "docs": {
    "product": {
      "source": "https://github.com/example/docs.git",
      "desc": "Product guides and API reference",
      "ref": "main",
      "include": ["**/*.md"],
      "exclude": ["archive/**"],
      "layers": {
        "guides": {
          "desc": "How-to and onboarding guides",
          "include": ["docs/guides/**"]
        },
        "api": {
          "desc": "HTTP API reference",
          "include": ["docs/api/**"]
        }
      },
      "embedding_model": "sentence-transformers/all-MiniLM-L6-v2"
    },
    "team-notes": {
      "source": "/path/to/docs",
      "desc": "Internal team notes (local path; ref unused)",
      "include": ["**/*.md"],
      "exclude": ["archive/**"]
    }
  },
  "default": {
    "docs": "product",
    "embedding_model": "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
    "top_k": 8,
    "chunk_max_chars": 1500
  }
}

product is a git URL (ref applies). team-notes is a filesystem path (ref unused). Optional desc on each docs collection and layer helps agents pick the right target.

embedding_model, top_k, and chunk_max_chars resolve as: docs.<id>.Xdefault.X → built-in. Omit per-docs keys to inherit.

Embedding model recommendation

Any Hugging Face id loadable by sentence-transformers works. Pick by language mix:

Docs / queries Recommended embedding_model
English-only (built-in when omitted) sentence-transformers/all-MiniLM-L6-v2
Chinese-only BAAI/bge-small-zh-v1.5
Multilingual (~50 langs) sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2

Changing embedding_model requires a reindex (the on-disk index stores the model name).

Field Description
docs.<id>.source Docs repo root: local path or git URL
docs.<id>.desc Short description for discovery (list_docs)
docs.<id>.ref Branch / tag / SHA for git URL sources only (default main; ignored for local paths)
docs.<id>.include Globs relative to repo root (default **/*.md)
docs.<id>.exclude Globs to skip
docs.<id>.layers.<name>.include Path globs for that layer (first match wins)
docs.<id>.layers.<name>.desc Short layer description for discovery
docs.<id>.embedding_model Optional override (see recommendation above)
docs.<id>.top_k Optional override for default retrieval count
docs.<id>.chunk_max_chars Optional override for max body chars per heading chunk
default.docs Default docs collection id
default.embedding_model Default sentence-transformers model id
default.top_k Default retrieval count
default.chunk_max_chars Default max body chars per heading chunk

Omit layers (or set "layers": {}) for flat repos — everything is other and ask_docs uses layer=all. Configure any names you need for multi-tree docs. First match wins. Layer names are case-insensitive; all / other are reserved.

Cache layout:

  • Repos (git URL): ~/.cache/mcp-docs-ask/repos/<docs-id>/
  • Indexes: ~/.cache/mcp-docs-ask/indexes/<docs-id>/

Tools

Tool Description
list_docs List configured docs collections and their layer filters
ask_docs Retrieve grounded passages + citations for a question
reindex Sync git source (if URL) and rebuild the vector index

list_docs returns a default block with the same keys as the config default block (docs, embedding_model, top_k, chunk_max_chars), plus a docs list where each entry carries its resolved values and a default flag.

MCP host examples

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "docs-ask": {
      "command": "uvx",
      "args": ["mcp-docs-ask"]
    }
  }
}

Claude Code

Add to your Claude Code MCP config:

{
  "mcpServers": {
    "docs-ask": {
      "command": "uvx",
      "args": ["mcp-docs-ask"]
    }
  }
}

Codex

[mcp_servers.docs-ask]
command = "uvx"
args = ["mcp-docs-ask"]

OpenCode

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "docs-ask": {
      "type": "local",
      "enabled": true,
      "command": ["uvx", "mcp-docs-ask"]
    }
  }
}

GitHub Copilot

{
  "inputs": [],
  "servers": {
    "docs-ask": {
      "type": "stdio",
      "command": "uvx",
      "args": ["mcp-docs-ask"]
    }
  }
}

Development

uv sync
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run pyright
uv run pytest

Notes

  • Local path: ask_docs rebuilds the index automatically when file mtimes/sizes change (fingerprint check). You do not need reindex after editing local docs.
  • Git URL: ask_docs never fetches. Call reindex to git fetch the configured ref and rebuild.
  • Changing embedding_model invalidates the on-disk index (rebuild on next use / reindex).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_docs_ask-0.1.1.tar.gz (97.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_docs_ask-0.1.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_docs_ask-0.1.1.tar.gz.

File metadata

  • Download URL: mcp_docs_ask-0.1.1.tar.gz
  • Upload date:
  • Size: 97.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_docs_ask-0.1.1.tar.gz
Algorithm Hash digest
SHA256 72b6f98b59d466e5f1139e7b4b2d8523386459da68593ffd832da41d5e3fd846
MD5 f9dd16ac761ef5cf7d1de888f0a3c53d
BLAKE2b-256 dbab18cafd62b8e4322cd653c6c59bd704f4a5bacca8383b39d5e1ce6d2c8d14

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_docs_ask-0.1.1.tar.gz:

Publisher: ci.yml on alyiox/mcp-docs-ask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_docs_ask-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcp_docs_ask-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_docs_ask-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29c25099ec8deb1e1aeb04a63b00d5eeecf964b8853024c6c634c6275718f586
MD5 fe32d19408e4c69d66c4248611c870f3
BLAKE2b-256 a42f05e2a14a3dca52c20bda87ed4818327324d07cbc8353563c1fee73c17580

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_docs_ask-0.1.1-py3-none-any.whl:

Publisher: ci.yml on alyiox/mcp-docs-ask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page