docs-mcp-server
Grounded Docs:您的 AI 最新文档专家
Docs MCP Server 通过为您的 AI 编码助手提供个人化的、始终保持最新的文档索引,解决了 AI 幻觉和知识过时的问题。它从网站、GitHub、npm、PyPI 和本地文件中获取官方文档,使您的 AI 能够查询您正在使用的确切版本。

✨ 为什么选择 Grounded Docs MCP Server?
这是 Context7、Nia 和 Ref.Tools 的开源替代方案。
✅ 最新上下文: 按需直接从官方来源获取文档。
🎯 特定版本: 查询目标为您项目中使用的确切库版本。
💡 减少幻觉: 让大语言模型 (LLM) 基于真实文档进行回答。
🔒 私有且本地: 完全在您的机器上运行;您的代码永远不会离开您的网络。
🧩 广泛兼容: 适用于任何兼容 MCP 的客户端(Claude、Cline 等)。
📁 多源支持: 索引网站、GitHub 仓库、本地文件夹和 zip 压缩包。
📄 丰富的文件支持: 处理 HTML、Markdown、PDF、Office 文档(Word、Excel、PowerPoint)、OpenDocument、RTF、EPUB、Jupyter Notebooks 以及 90 多种源代码语言。
Related MCP server: Documentation Search MCP Server
📄 支持的格式
分类 | 格式 |
文档 | PDF, Word (.docx/.doc), Excel (.xlsx/.xls), PowerPoint (.pptx/.ppt), OpenDocument (.odt/.ods/.odp), RTF, EPUB, FictionBook, Jupyter Notebooks |
归档 | ZIP, TAR, gzipped TAR (内容会被单独提取和处理) |
网页 | HTML, XHTML |
标记语言 | Markdown, MDX, reStructuredText, AsciiDoc, Org Mode, Textile, R Markdown |
源代码 | TypeScript, JavaScript, Python, Go, Rust, C/C++, Java, Kotlin, Ruby, PHP, Swift, C#, 以及 更多 |
数据 | JSON, YAML, TOML, CSV, XML, SQL, GraphQL, Protocol Buffers |
配置 | Dockerfile, Makefile, Terraform/HCL, INI, dotenv, Bazel |
请参阅 支持的格式 以获取包括 MIME 类型和处理细节在内的完整参考。
🚀 快速入门
CLI 优先
对于代理和脚本,CLI 通常是使用 Grounded Docs 最简单的方式。
1. 索引文档 (需要 Node.js 22+):
npx @arabold/docs-mcp-server@latest scrape react https://react.dev/reference/react对于使用哈希路由的单页应用 (SPA) 文档站点,请显式启用哈希保留:
npx @arabold/docs-mcp-server@latest scrape my-spa https://docs.example.com/#/guide --preserve-hashes2. 查询索引:
npx @arabold/docs-mcp-server@latest search react "useEffect cleanup" --output yaml3. 将单个页面获取为 Markdown:
npx @arabold/docs-mcp-server@latest fetch-url https://react.dev/reference/react/useEffect输出行为
在非交互式运行中,结构化命令默认在标准输出 (stdout) 上输出整洁的 JSON。
使用
--output json|yaml|toon选择结构化格式。纯文本命令(如
fetch-url)将其文本负载保留在标准输出上。诊断信息通过共享日志记录器处理,在非交互式运行中不会输出到标准输出。
使用
--quiet抑制非错误诊断信息,或使用--verbose启用调试输出。
代理技能
skills/ 目录包含 Agent Skills,它们教导 AI 编码助手如何使用 CLI——涵盖文档搜索、索引管理和 URL 获取。
MCP 服务器
如果您需要为 Claude、Cline、Copilot、Gemini CLI 或其他 MCP 客户端提供长期运行的 MCP 端点:
1. 启动服务器:
npx @arabold/docs-mcp-server@latest2. 打开 Web UI,地址为 http://localhost:6280 以添加文档。
3. 连接您的 AI 客户端,通过将其添加到您的 MCP 设置中(例如 claude_desktop_config.json):
{
"mcpServers": {
"docs-mcp-server": {
"type": "sse",
"url": "http://localhost:6280/sse"
}
}
}请参阅 连接客户端 以获取 VS Code (Cline, Roo) 和其他设置选项。
scrape_docs 也接受 preserveHashes: true,适用于使用基于哈希的客户端路由的文档站点。
仅对哈希路由的 SPA 使用此选项;普通站点通常使用哈希片段作为页内锚点。
docker run --rm \
-v docs-mcp-data:/data \
-v docs-mcp-config:/config \
-p 6280:6280 \
ghcr.io/arabold/docs-mcp-server:latest \
--protocol http --host 0.0.0.0 --port 6280🧠 配置嵌入模型 (推荐)
使用嵌入模型是可选的,但通过启用语义向量搜索,可以显著提高搜索质量。
示例:启用 OpenAI 嵌入
OPENAI_API_KEY="sk-proj-..." npx @arabold/docs-mcp-server@latest请参阅 嵌入模型 以配置 Ollama、Gemini、Azure 等。
📚 文档
入门指南
安装:Docker、Node.js (npx) 和嵌入模式的详细设置指南。
连接客户端:如何连接 Claude、VS Code (Cline/Roo) 和其他 MCP 客户端。
基本用法:使用 Web UI、CLI 和抓取本地文件。
配置:配置文件和环境变量的完整参考。
支持的格式:完整的文件格式和 MIME 类型参考。
嵌入模型:配置 OpenAI、Ollama、Gemini 和其他提供商。
哈希路由的 SPA
仅对使用
#/guide等 URL 进行路由的文档站点使用--preserve-hashes、MCPpreserveHashes或 Web UI 中的“保留哈希路由”复选框。当在
scrapeMode=fetch下启用时,抓取器会自动将任务升级为 Playwright,因为普通的 fetch 无法评估客户端哈希路由。刷新操作默认重用存储的
preserveHashes设置,CLI/Web 刷新入口点可以显式覆盖它。
关键概念与架构
🤝 贡献
我们欢迎贡献!请参阅 CONTRIBUTING.md 获取开发指南和设置说明。
许可证
本项目采用 MIT 许可证授权。详情请参阅 LICENSE。
Available Tools
12 toolscancel_jobADestructive
Cancel a queued or running indexing job. Use the 'list_jobs' tool to find the job ID.
Inputs: jobId (required).
fetch_urlARead-only
Fetch a single URL and convert its content to Markdown. Use this tool to read the content of any web page.
Inputs: url (required), followRedirects.
find_versionBRead-only
Find the best matching version for a library. Use to identify available or closest versions.
Inputs: library (required), targetVersion.
get_job_infoARead-only
Get details for a specific indexing job. Use the 'list_jobs' tool to find the job ID.
Inputs: jobId (required).
list_jobsBRead-only
List all indexing jobs. Optionally filter by status.
Inputs: status.
list_librariesARead-only
List all indexed libraries and their versions. Use this to find the correct library name.
Inputs: no named parameters.
list_pagesBRead-only
List the indexed pages of a library version, with an optional URL filter and pagination.
Inputs: library (required), limit, offset, version, +1 more.
read_pageARead-only
Read the full content of an indexed documentation page, for example a URL returned by search_docs or list_pages. Long pages are returned in parts; the response says how to continue.
Inputs: library (required), pathOrUrl (required), version, maxChars, +1 more.
refresh_versionA
Re-scrape a previously indexed library version, updating only changed pages.
Inputs: library (required), version.
remove_docsADestructive
Remove indexed documentation for a library version. Use only if explicitly instructed.
Inputs: library (required), version.
scrape_docsADestructive
Scrape and index documentation from a URL for a library. Use this tool to index a new library or a new version. Scraping a library version that already exists is rejected unless replace is true; use refresh_version to update an existing version in place.
Inputs: url (required), library (required), scope, replace, +7 more.
search_docsARead-only
Search up-to-date documentation for a library or package. Examples:
{library: "react", query: "hooks lifecycle"} -> matches latest version of React
{library: "react", version: "18.0.0", query: "hooks lifecycle"} -> matches React 18.0.0 or earlier
{library: "typescript", version: "5.x", query: "ReturnType example"} -> any TypeScript 5.x.x version
{library: "typescript", version: "5.2.x", query: "ReturnType example"} -> any TypeScript 5.2.x version
Inputs: query (required), library (required), limit, version.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a clearly distinct action or resource: indexing (scrape_docs, refresh_version), retrieval (search_docs, read_page, list_pages), library/version discovery (list_libraries, find_version), job management (list_jobs, get_job_info, cancel_job), removal (remove_docs), and generic URL fetching (fetch_url). Potential overlaps like scrape_docs vs refresh_version and read_page vs fetch_url are explicitly clarified by the descriptions.
All tool names use snake_case and follow a predictable verb_noun pattern: list_pages, scrape_docs, refresh_version, search_docs, read_page, list_libraries, find_version, list_jobs, get_job_info, cancel_job, remove_docs, fetch_url. There are no mixed conventions or vague standalone verbs.
The 12 tools are well-scoped for a documentation indexing and search server. Each tool earns its place across indexing, search/read, library/version discovery, job management, and removal, with no obvious redundancy or missing operational area.
The tool surface covers the full lifecycle: creating indexes (scrape_docs), updating them (refresh_version), reading/searching content (search_docs, read_page, list_pages), discovering libraries/versions (list_libraries, find_version), managing indexing jobs (list_jobs, get_job_info, cancel_job), deleting docs (remove_docs), and fetching arbitrary URLs (fetch_url). No significant gaps or dead ends are apparent for the stated domain.
Maintenance
Related MCP Connectors
MCP server for querying Forkast documentation
Versioned documentation registry and semantic search for AI tools and coding assistants.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server for ingesting, chunking and semantically searching documentation files, with support for markdown, Python, OpenAPI, HTML files and URLs.-
- AlicenseCqualityDmaintenanceA Model Context Protocol server that enables intelligent searching across documentation for 30+ programming libraries and frameworks, fetching relevant information from official sources.238MIT
- AlicenseNot gradedqualityBmaintenanceSelf-hosted MCP server that indexes documentation from various sources and makes it searchable by AI assistants via the Model Context Protocol and REST API.94Apache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP server for documentation search that automatically indexes web documentation sites and provides semantic, full-text, or hybrid search capabilities.8 npmMIT