TM

thoughtworks/mcp4openapi

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

6 stars 3 forks 质量 43 趋势 6

任何符合 Openapi 的端点的 MCP 服务器

概览

这是一个执行多功能的OpenAPI MCP服务器的Concept-Concept项目,可用于以MCP服务器协议代理任何OpenAPI兼容API后端. 这篇文章的POC内容是让AI Economic 凌驾于API之上 这一实施表明,像工具和资源这样的MCP能力是RESTFUL API的直接一对一映射,可以根据它们在OpenAPI中的规格动态生成. 我们不需要为RESTFUL API明确和具体地建立MCP服务器. 作为新增的功能,这一实施允许通过配置文件来添加MCP Express来丰富后端API生成的MCP工具与资源.

概述(AI 翻译)

这是一个执行多功能的OpenAPI MCP服务器的Concept-Concept项目,可用于以MCP服务器协议代理任何OpenAPI兼容API后端. 这篇文章的POC内容是让AI Economic 凌驾于API之上

这一实施表明,像工具和资源这样的MCP能力是RESTFUL API的直接一对一映射,可以根据它们在OpenAPI中的规格动态生成. 我们不需要为RESTFUL API明确和具体地建立MCP服务器. 作为新增的功能,这一实施允许通过配置文件来添加MCP Express来丰富后端API生成的MCP工具与资源.

该项目还有一个实例,即OpenAPI应用程序托管了一些带一些制造数据的样本银行API,一个演示的MCP客户端应用程序提供了一个MCP客户端与MCP服务器交互的用例,它代理样本银行API和LLM(通过LMStudio托管)之间的一些样本问题.

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP-OpenAPI Model Context Protocol wrapper for OpenAPI compliant endpoints

This is a Proof-of-Concept project implementing a multi-purpose OpenAPI MCP Server that can be used to proxy any OpenAPI compliant API backend with an MCP Server protocol. It is POC for this article about enabling AI Economy over APIs

This implementation showcases that MCP capabilities like tools and resources are a direct 1-to-1 mapping for RESTFUL APIs and can be dynamically generated based on their specifications in OpenAPI. We do not need to explicitly and specifically code/build MCP servers for RESTFUL APIs. As an added feature, this implementation allows the addition of MCP Prompts, via configuration files, to enrich the MCP tools & resources generated from the backend APIs.

The project also comes with an example OpenAPI application hosting some sample banking APIs with some manufactured data, a demo MCP Client application that provides an example use-case of an MCP Client interacting with the MCP Server proxying some sample problems between the sample banking APIs and an LLM (hosting via LMStudio).

Demo/Testing can also be done without the demo MCP application or LM Studio via integrating the MCP server with an MCP enabled tools such as Cursor IDE (tested) or Windsurf (not tested), etc.

All the above are structured under 3 separate folders under this project:

  1. mcp-openapi is the reference implementation of the OpenAPI MCP proxy
  2. mcp-test-client is the demo test client with some sample questions based on the manufactured data in the sample banking app
  3. sample-banking-api is the sample banking application with a number of OpenAPI endpoints and manufactured data

NOTE: This mcp-openapi app is not a replacement for https://github.com/ReAPI-com/mcp-openapi project that is enabling IDEs like Cursor to connect to open api specs to support api development.

🔄 Integration Flow

Sample Banking API ←→ MCP OpenAPI Server ←→ Demo/Test Banking MCP Client ←→ LLM via LM Studio

or

Sample Banking API ←→ MCP OpenAPI Server ←→ Cursor IDE

🏗️ Project Structure

This repository contains three applications:

🔌 mcp-openapi/

This contain the main application, a multi-purpose, configurable MCP server that automatically generates MCP tools and resources from OpenAPI specifications:

  • Automatic tool/resource generation from OpenAPI specs
  • Token passthrough authentication
  • Addition of custom prompt templates
  • Multiple deployment modes (stdio/HTTP)

Quick Start:

cd mcp-openapi
npm install
npm run build
npm run dev

The “dev” startup is pre-configured to integrate with the sample banking api app. Please refer to the README in the app folder for more details.

📊 sample-banking-api/

An example Sample banking API implementation with:

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →