swagger-viewer
Swagger Viewer MCP Tool is designed for the Cursor editor to facilitate quick viewing and utilization of Swagger API documentation.
Swagger Viewer MCP 工具
这是一个用于 Cursor 编辑器的 MCP 工具,可以帮助你快速查看和使用 Swagger API 文档。
功能特点
- 自动读取用户根目录下的 swagger.json 配置文件
- 实时监控配置文件变化,自动更新 API 文档
- 支持模糊搜索 API 接口
- 自动生成接口调用代码
- 支持查看所有可用接口
安装
npm install
配置
在用户根目录下创建 swagger.json
文件,格式如下:
{
"swaggerUrl": "https://your-swagger-api-url/swagger.json"
}
npx:
"swagger-viewer": {
"command": "cmd",
"swagger-viewer": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@xc_angelwatch/swagger-viewer"]
}
}
使用方法
该工具提供以下 MCP 接口:
mcp_swagger_initialize()
: 初始化工具,加载配置mcp_swagger_search(query)
: 搜索接口mcp_swagger_generate_code(path, method, language)
: 生成接口调用代码mcp_swagger_get_all_endpoints()
: 获取所有可用接口
示例用法
// 初始化
await mcp_swagger_initialize();
// 搜索包含 "user" 的接口
const results = await mcp_swagger_search("user");
// 生成特定接口的代码
const code = await mcp_swagger_generate_code("/api/users", "GET", "javascript");
// 获取所有接口
const endpoints = await mcp_swagger_get_all_endpoints();
配置文件监控
工具会自动监控用户根目录下的 swagger.json
文件变化。当文件发生变化时,会自动重新加载最新的 API 文档。
支持的编程语言
目前支持生成以下语言的代码:
Related MCP Servers
View all developer_tools servers →context7
by upstash
Context7 MCP provides up-to-date, version-specific documentation and code examples directly into your prompt, enhancing the capabilities of LLMs by ensuring they use the latest information.
git-mcp
by idosal
GitMCP is a free, open-source, remote Model Context Protocol (MCP) server that transforms GitHub projects into documentation hubs, enabling AI tools to access up-to-date documentation and code.
exa-mcp-server
by exa-labs
A Model Context Protocol (MCP) server allows AI assistants to use the Exa AI Search API for real-time web searches in a secure manner.
Sequential Thinking
by modelcontextprotocol
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
Everything MCP Server
by modelcontextprotocol
The Everything MCP Server is a comprehensive test server designed to demonstrate the full capabilities of the Model Context Protocol (MCP). It is not intended for production use but serves as a valuable tool for developers building MCP clients.
gateway
by centralmind
CentralMind Gateway is a tool designed to expose databases to AI agents via MCP or OpenAPI protocols, providing secure, LLM-optimized APIs.
mcpdoc
by langchain-ai
MCP LLMS-TXT Documentation Server provides a structured way to manage and retrieve LLM documentation using the Model Context Protocol.