文档搜索服务器

MCP服务器提供文档搜索、依赖漏洞扫描和项目模板生成功能,支持Claude Desktop和Cursor等MCP客户端。

  • by gemini2026
  • Python
  • 本地部署
  • 8 星标
  • 更新于
在 GitHub 查看 anton-prosterity/documentation-search-mcp

使用说明

文档搜索MCP服务器

MCP服务器,用于搜索文档、扫描漏洞依赖关系和生成项目样板。适用于Claude Desktop、Cursor和其他MCP客户端。

📚 阅读综合教程 查看详细的示例和工作流程。

特性

  • 使用可选的语义向量搜索搜索190多个精心策划的文档源
  • 扫描Python项目的漏洞(Snyk、安全、OSV)
  • 生成FastAPI和React项目启动程序
  • 学习路径和代码示例

安装

# Recommended: use uvx (install uv from https://docs.astral.sh/uv)
uvx documentation-search-enhanced@1.9.0

# Or with pip in a virtual environment
pip install documentation-search-enhanced==1.9.0

# Optional: AI semantic search (Python 3.12 only, adds ~600MB)
pip install documentation-search-enhanced[vector]==1.9.0

配置

克劳德桌面版

找到你的uvx路径: which uvx

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "documentation-search-enhanced": {
      "command": "/Users/yourusername/.local/bin/uvx",
      "args": ["documentation-search-enhanced@1.9.0"],
      "env": {
        "SERPER_API_KEY": "optional_key_here"
      }
    }
  }
}

替换 /Users/yourusername/.local/bin/uvx 与你的实际紫外线路径。

Codex CLI

# Find your uvx path first
which uvx

# Then add with full path (replace with your actual path)
codex mcp add documentation-search-enhanced \
  -- /Users/yourusername/.local/bin/uvx documentation-search-enhanced@1.9.0

# Or if uvx is in PATH:
codex mcp add documentation-search-enhanced \
  -- uvx documentation-search-enhanced@1.9.0

使用SERPER API密钥 (启用实时网络搜索):

codex mcp add documentation-search-enhanced \
  --env SERPER_API_KEY=your_key_here \
  -- /Users/yourusername/.local/bin/uvx documentation-search-enhanced@1.9.0

没有SERPER API密钥 (使用GitHub Release中的预构建索引):

codex mcp add documentation-search-enhanced \
  -- /Users/yourusername/.local/bin/uvx documentation-search-enhanced@1.9.0

如果您在首次运行时超时,请预下载依赖项:

uvx documentation-search-enhanced@1.9.0

环境变量

  • SERPER_API_KEY -可选。启用实时网络搜索。如果没有它,则使用GitHub Release中的预构建索引。
  • DOCS_SITE_INDEX_AUTO_DOWNLOAD -设置为 false 禁用自动索引下载
  • DOCS_SITE_INDEX_PATH -文档索引的自定义路径

集 server_config.features.real_time_search=false 在您的配置中禁用实时爬网。

语义搜索(可选)

这 [vector] extra添加了使用句子转换器(全MiniLM-L6-v2)的语义搜索,并具有混合重排序功能:

  • 50%语义相似度(余弦)
  • 30%关键字匹配
  • 20%来源权限

仅适用于Python 3.12(PyTorch限制)。Python 3.13用户获得基于关键字的搜索。

要禁用矢量搜索,即使已安装:

semantic_search(query="FastAPI auth", libraries=["fastapi"], use_vector_rerank=False)

可用工具

核心MCP工具:

  • semantic_search -搜索文档
  • get_docs -获取特定文档
  • get_learning_path -制定学习路线图
  • get_code_examples -查找代码片段
  • scan_project_dependencies -漏洞扫描
  • snyk_scan_project -详细的Snyk分析
  • generate_project_starter -创建项目样板
  • manage_dev_environment -生成docker组合文件
  • compare_library_security -比较库漏洞

发展

git clone https://github.com/anton-prosterity/documentation-search-mcp.git
cd documentation-search-mcp
uv sync --all-extras
uv run python -m documentation_search_enhanced.main

测试

uv run pytest --ignore=pytest-test-project  # Core tests
uv run ruff check src                       # Linting
uv run ruff format src --check              # Format check

配置

使用 get_current_config 将当前设置导出到的工具 config.json。使用以下方式进行验证:

uv run python src/documentation_search_enhanced/config_validator.py

贡献

看 CONTRIBUTING.md 作为指导方针。对提交消息使用常规提交。

许可证

MIT许可证-请参阅 LICENSE 了解详情。