MCP Catalogs
首页

mcp-openapi

by ReAPI-com·86·综合分 41

一个加载 OpenAPI 规范并通过 MCP 协议使 LLM 能够在 IDE 中理解和使用 API 的 MCP 服务器。

developer-toolsai-llm
16
Forks
7
活跃 Issue
14 个月前
最近提交
2 天前
收录于

概述

@reapi/mcp-openapi 是一个模型上下文协议 (MCP) 服务器,它将 OpenAPI 规范与 LLM 驱动的开发环境连接起来。它从目录加载多个 OpenAPI 文件,解引用架构以提供完整上下文,并通过 MCP 暴露 API 操作。该服务器使 Cursor IDE 等工具能够实现智能代码补全、API 感知的代码生成和集成辅助功能。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:在 IDE 中生成具有 API 感知的代码片段和客户端
:为 API 端点提供上下文感知的代码补全
:从 OpenAPI 规范自动生成 API 文档
:支持哪些 OpenAPI 版本?
:如何处理具有相似路径的多个 API 规范?

什么时候选它

当您使用多个OpenAPI规范,并在IDE中需要LLM集成用于API文档、客户端生成或架构理解时,选择此服务器

什么时候不要选它

如果您需要实时API模拟或测试功能,请不要选择此服务器,因为它专注于静态API文档和架构信息

此 server 暴露的工具

从 README 抽取出 7 个工具
  • refresh-api-catalog

    Refresh the API catalog

  • get-api-catalog

    Get the complete API catalog with all specifications, operations, and schemas

  • search-api-operations

    Search for API operations across specifications

  • search-api-schemas

    Search for schemas across specifications

  • load-api-operation-by-operationId

    Load an API operation by operation ID

  • load-api-operation-by-path-and-method

    Load an API operation by path and HTTP method

  • load-api-schema-by-schemaName

    Load an API schema by schema name

可对比工具

swagger-mcpapi-spec-mcpopenapi-generator-cliredoc

安装

使用 npm 安装 MCP 服务器:

npm install -g @reapi/mcp-openapi

在 Cursor IDE 中通过创建 .cursor/mcp.json 进行配置:

{
  "mcpServers": {
    "@reapi/mcp-openapi": {
      "command": "npx",
      "args": ["-y", "@reapi/mcp-openapi@latest", "--dir", "./specs"],
      "env": {}
    }
  }
}

将您的 OpenAPI 规范放在 ./specs 目录中,并在 Cursor 设置 > MCP 中启用服务器。

FAQ

支持哪些 OpenAPI 版本?
该服务器支持 JSON 和 YAML 格式的 OpenAPI 3.x 规范,文件扩展名为 .json、.yaml 或 .yml。
如何处理具有相似路径的多个 API 规范?
在 OpenAPI info 对象中使用 'x-spec-id' 字段为您的规范分配自定义 ID,这有助于区分相似资源。

Hacker News 讨论

开发者社区最近的相关讨论。

mcp-openapi 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。