Skip to main content
Glama
JacerOmri
by JacerOmri

🤖 OpenAPI MCP 服务器

asciicast

将任何 OpenAPI 服务转换为模型上下文协议 (MCP) 服务器的命令行工具,实现与支持 MCP 规范的 AI 代理和工具的无缝集成。

此工具仍处于早期开发阶段。路线图请点击此处

什么是模型上下文协议(MCP)?

模型上下文协议 (MCP) 是 AI 代理与外部工具和服务交互的标准化协议。它为 AI 模型提供了一种一致的方式,使其能够通过统一的接口发现、理解和利用各种功能,从而更轻松地构建能够与多种服务交互的 AI 应用。

Related MCP server: mcpify

什么是 OpenAPI?

OpenAPI(以前称为 Swagger)是一种机器可读接口文件的规范,用于描述、生成、使用和可视化 RESTful Web 服务。它允许人类和计算机无需访问源代码或其他文档即可发现和理解服务的功能。

关于此项目

该中间件充当 OpenAPI 服务和 MCP 客户端之间的桥梁。它:

  1. 将 OpenAPI 规范文件作为输入

  2. 自动生成符合 MCP 标准的服务器

  3. 将传入请求代理到实际的 OpenAPI 服务

  4. 在 MCP 和 REST 约定之间进行转换

这使得任何具有 OpenAPI 规范的现有 REST API 都可以立即被理解 MCP 的 AI 代理访问,而无需对原始服务进行任何修改。

安装

npm install -g openapi-mcp-proxy

用法

npx openapi-mcp-proxy --spec ./path/to/openapi.yml --target http://your-api.com --port 3000

选项

  • -s, --spec <path> (必需):OpenAPI 规范文件的路径(环境: OMP_OPENAPI_SPEC_FILE

  • -t, --target <url> (可选):API 服务的目标 URL(默认值:“ http://localhost:8080 ”,环境变量: OMP_TARGET_BASE_URL

  • -p, --port <number> (可选): 运行 MCP 服务器的端口 (默认值: "3000", 环境变量: PORT )

  • -V, --version :显示版本号

  • -h, --help :显示命令帮助

例子

为 Petstore API 启动 MCP 服务器

npx openapi-mcp-proxy --spec resources/petstore.openapi.yml --target https://petstore.swagger.io/v2

测试

MCP 检查器

要测试您的 MCP 服务器,您可以使用模型上下文协议:

  1. 安装 MCP 检查器:

npx @modelcontextprotocol/inspector
  1. 启动 MCP 服务器

  2. 导航到检查器的 UI 并填写/mcp结尾的正确服务器路径,例如http://localhost:3000/mcp

  3. 现在您可以与 MCP 服务器进行交互了。MCP 检查器将显示有关请求和响应的详细信息。

使用 VS Code

使用 VS Code 的内置代理模式更容易做到这一点:

  1. 打开 VS Code 并启用代理模式:

    • Cmd/Ctrl + Shift + P

    • 输入“切换 GitHub Copilot 代理模式”

    • 选择“启用”

  2. 添加您的 MCP 服务器:

    • Cmd/Ctrl + Shift + P

    • 输入“MCP:添加服务器”

    • 输入您的 MCP 服务器 URL,例如http://localhost:3000/mcp,以/mcp结尾

  3. 您的 github copilot 聊天应该会采用它所拥有的新工具!

  4. 现在,您可以通过 VS Code 的代理界面与 MCP 服务器进行交互。尝试询问它“现在有多少只宠物可用?”

有关如何在 VS Code 中使用 MCP 服务器的更多信息, 请参阅

贡献

欢迎贡献!请随时提交 Pull 请求。路线图在这里

执照

麻省理工学院

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Turns any OpenAPI specification into a fully working MCP server with a single command, enabling AI agents to call APIs without writing any glue code.
    8
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Automatically generates MCP server tools from OpenAPI specifications, enabling LLMs to interact with any API defined by an OpenAPI spec through natural language.
    19
    MIT

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

  • Generate a typed SDK, CLI, and MCP server from any OpenAPI or GraphQL spec, and keep them current.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JacerOmri/openapi-mcp-proxy'

If you have feedback or need assistance with the MCP directory API, please join our Discord server