Used as the runtime environment for the MCP server, with specific version recommendations for compatibility.
Used for package management and running the MCP server, both locally and via npx for the latest version.
Used for development of the MCP server, with build steps to compile TypeScript code to JavaScript.
解除 OpenAPI MCP 服务器捆绑
该项目提供了一个模型上下文协议 (MCP) 服务器,其中包含一些工具,可用于将 OpenAPI 规范文件拆分为多个文件,或将特定端点提取到一个新文件中。它允许 MCP 客户端(例如 AI 助手)以编程方式操作 OpenAPI 规范。
先决条件
- Node.js(推荐 LTS 版本,例如 v18 或 v20)
- npm(Node.js 附带)
用法
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Unbundle OpenAPI MCP Server:
使用此服务器的最简单方法是通过npx
,这可以确保您始终使用最新版本,而无需全局安装。
或者,您可以全局安装它(通常不推荐):
服务器将启动并监听标准输入/输出 (stdio) 上的 MCP 请求。
客户端配置
要将此服务器与 VS Code、Cline、Cursor 或 Claude Desktop 等 MCP 客户端一起使用,请将其配置添加到相应的设置文件中。推荐使用npx
。
VS Code / Cline / 光标
将以下内容添加到您的用户settings.json
(可通过Ctrl+Shift+P
> Preferences: Open User Settings (JSON)
)或工作区根目录中的.vscode/mcp.json
文件。
克劳德桌面
将以下内容添加到您的claude_desktop_config.json
文件中。
添加配置后,重新启动客户端应用程序以使更改生效。
提供的 MCP 工具
split_openapi
**描述:**执行redocly split
命令,根据 OpenAPI 定义文件的结构将其解绑为多个较小的文件。
参数:
apiPath
(字符串,必需):输入 OpenAPI 定义文件的绝对路径(例如,openapi.yaml
)。outputDir
(字符串,必需):保存分割输出文件的目录的绝对路径。如果该目录不存在,则会创建。
返回:
- 成功时:包含来自
redocly split
命令的标准输出的文本消息(通常是确认消息)。 - 失败时:包含命令执行的标准错误或异常详细信息的错误消息,标记为
isError: true
。
使用示例(概念 MCP 请求):
extract_openapi_endpoints
**描述:**从大型 OpenAPI 定义文件中提取特定端点,并创建一个新的、较小的 OpenAPI 文件,该文件仅包含这些端点及其引用的组件。它通过拆分原始文件、修改结构以仅保留指定路径,然后打包结果来实现此目的。
参数:
inputApiPath
(字符串,必需):大型输入 OpenAPI 定义文件的绝对路径。endpointsToKeep
(字符串数组,必需):最终输出中要包含的确切端点路径(字符串)列表(例如,["/api", "/api/projects/{id}{.format}"]
)。原始规范中未找到的路径将被忽略。outputApiPath
(字符串,必需):最终较小的打包 OpenAPI 文件的绝对路径。如果目录不存在,则会创建该目录。
返回:
- 成功时:一条文本消息,指示所创建文件的路径和来自
redocly bundle
命令的标准输出。 - 失败时:包含失败步骤(拆分、修改、捆绑)详细信息的错误消息,标记为
isError: true
。
使用示例(概念 MCP 请求):
**注意:**此服务器内部使用npx @redocly/cli@latest
extract_openapi_endpoints
执行底层split
和bundle
命令。如果@redocly/cli
未缓存,则可能需要互联网连接才能让npx
获取该命令。extract_openapi_endpoints 过程中会创建临时文件,并会自动清理。
发展
如果您想贡献或从源代码运行服务器:
- **克隆:**克隆此存储库。
- 导航:
cd unbundle_openapi_mcp
- 安装依赖项:
npm install
- 构建:
npm run build
(将 TypeScript 编译为dist/
) - 运行:
npm start
(使用dist/
中的编译代码启动服务器)
You must be authenticated.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
解除 OpenAPI 规范 MCP 捆绑
Related MCP Servers
- -securityFlicense-qualityA MCP server that exposes OpenAPI schema information to LLMs like Claude. This server allows an LLM to explore and understand large OpenAPI schemas through a set of specialized tools, without needing to load the whole schema into the contextLast updated -375JavaScript
- -securityFlicense-qualityAn MCP server that provides access to Naver OpenAPI services, enabling users to search blogs, news, books, images, and other content through standardized Model Context Protocol interfaces.Last updated -Python
- -securityAlicense-qualityGenerate an MCP server for any OpenAPI documented endpoint.Last updated -201GoApache 2.0
- -securityAlicense-qualityMCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration.Last updated -3012TypeScriptMIT License