SDK文档搜索服务器

一个可配置的模型上下文协议(MCP)服务器,提供对多个AI/ML SDK文档和源代码的可搜索访问,支持OpenAI Agents SDK和Google ADK,并易于扩展其他SDK。

  • by arunmenon
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 arunmenon/sdk-mcp-server

使用说明

SDK MCP服务器

一个可配置的模型上下文协议(MCP)服务器,提供对多个AI/ML SDK文档和源代码的可搜索访问。目前支持OpenAI代理SDK和Google ADK,可轻松扩展其他SDK。

目的

使用AI/ML SDK时,您通常需要:

  • 了解类和方法在不同SDK中的内部工作方式
  • 比较不同框架之间的实现
  • 找到正确的方法签名和参数
  • 查看实际实现示例
  • 通过检查SDK源代码调试问题

此MCP服务器为Claude等AI助手提供了对多个SDK源的即时访问,使其成为多SDK项目的强大开发伙伴。

快速开始

  1. 安装依赖项:
pip install -r requirements.txt
  1. 下载SDK源代码:
python src/download_sdk.py

这将从下载所有配置的SDK sdks.yaml.

  1. 在Claude桌面中配置:

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "sdk-mcp-server": {
      "command": "python",
      "args": ["/absolute/path/to/sdk-mcp-server/src/server.py"]
    }
  }
}

可用工具

每个配置的SDK都有自己的一组带有SDK前缀的工具。当前配置:

OpenAI代理SDK工具(前缀: openai_agents_)

  • openai_agents_list_files() -列出所有可用的OpenAI SDK源文件
  • openai_agents_get_source(filename) -获取特定文件的源代码
  • openai_agents_search_code(query) -搜索术语、方法或模式
  • openai_agents_get_class(class_name) -提取完整的类定义
  • openai_agents_find_examples(topic) -查找使用示例和模式

谷歌ADK工具(前缀: google_adk_)

  • google_adk_list_files() -列出所有可用的Google ADK源文件
  • google_adk_get_source(filename) -获取特定文件的源代码
  • google_adk_search_code(query) -搜索术语、方法或模式
  • google_adk_get_class(class_name) -提取完整的类定义
  • google_adk_find_examples(topic) -查找使用示例和模式

跨SDK工具(即将推出)

  • list_available_sdks() -显示所有已配置的SDK
  • search_all_sdks(query) -同时搜索所有SDK
  • compare_implementations(concept, sdk_ids) -比较SDK中的类似概念

使用示例

比较SDK:

You: "How do OpenAI and Google handle agent creation differently?"
Claude: [Uses openai_agents_get_class("Agent") and google_adk_get_class("Agent")]
*Compares the different approaches and APIs*

学习新的SDK:

You: "Show me how to use tools in Google ADK"
Claude: [Uses google_adk_search_code("tool") and google_adk_find_examples("tool")]
*Explains Google's approach with real examples*

跨SDK调试:

You: "Why does handoff work in OpenAI but not in my Google ADK code?"
Claude: [Searches both SDKs for handoff implementations]
*Identifies the differences and helps fix the issue*

配置

添加新SDK

编辑 sdks.yaml 要添加新的SDK:

sdks:
  your_sdk:
    name: "Your SDK Name"
    description: "Description of the SDK"
    source:
      type: "github"
      repo: "org/repo-name"
      branch: "main"
      path: "src"
    file_patterns:
      - "**/*.py"
    tools:
      prefix: "your_sdk"
      descriptions:
        list_files: "List all Your SDK source files"
        # ... other tool descriptions

支持的源类型

  • GitHub 仓库 -带有Python/TypeScript代码的公共存储库
  • 直接URL (即将推出)-ZIP/TAR档案
  • 本地路径 (即将推出)-本地SDK安装

文件结构

sdk-mcp-server/
├── src/
│   ├── server.py           # Main MCP server implementation
│   └── download_sdk.py     # SDK downloader and indexer
├── data/                   # Downloaded SDK files (git-ignored)
│   ├── openai_agents/      # OpenAI SDK files
│   └── google_adk/         # Google ADK files
├── sdks.yaml              # SDK configuration
├── requirements.txt       # Python dependencies
└── run_server.sh         # Server startup script

更新中

要获取最新的SDK源代码:

python src/download_sdk.py

这将从中所有配置的SDK中获取最新代码 sdks.yaml.

最佳结果提示

  1. 指定SDK -说出您正在使用的SDK
  2. 使用SDK前缀 -每个工具都以SDK名称作为前缀
  3. 比较实现 -询问SDK之间的差异
  4. 请求示例 -每个SDK都有示例查找功能

为什么这有帮助

  • 多SDK支持 -无缝地使用多个框架
  • 即时回答 -无需浏览多个仓库或文档
  • 直接比较 -了解不同的SDK如何解决类似的问题
  • 准确的信息 -始终来自最新的源代码
  • 上下文感知 -AI了解跨SDK的完整实现

贡献

要添加对新SDK的支持:

  1. 将配置添加到 sdks.yaml
  2. 测试用 python src/download_sdk.py
  3. 提交拉取请求

许可证

MIT许可证-有关详细信息,请参阅许可证文件。