内容
# OpenAPI MCP Server
MCP server 将任何 OpenAPI/Swagger 规范转换为可查询的工具,以供您的 LLM 使用。搜索端点,获取端点详细信息,并从您的 API 文档中探索模式。
## Claude Code 的设置
添加到您的 `.mcp.json`、`.claude.json` 或 `claude_desktop_config.json` 中。
```json
{
"mcpServers": {
"my-api": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/puelpan/openapi-spec-mcp.git@main",
"openapi-spec-mcp",
"/path/to/your/openapi.yaml"
]
}
}
}
```
或者使用远程 URL:
```json
{
"mcpServers": {
"my-api": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/puelpan/openapi-spec-mcp.git@main",
"openapi-spec-mcp",
"https://api.example.com/openapi.json"
]
}
}
}
```
## 可用工具
- **search_endpoints**: 按关键字查找端点
- **get_endpoint**: 获取详细的端点信息(参数、响应等)
- **list_all_endpoints**: 列出所有可用的端点
- **search_schemas**: 按名称查找模式定义
- **get_schema**: 获取带有解析引用的模式详细信息
## 支持的格式
- 本地文件: `.yaml`、`.yml`、`.json`
- 远程 URL: 任何 OpenAPI 规范 URL(格式自动检测)