mcpField
S
Swagger Viewer

Swagger Viewer

Local
github.com/xiezhuo0513Developer Tools0Updated 79w ago

About Swagger Viewer

Swagger Viewer is an MCP tool for Cursor that loads and monitors Swagger API documentation. It supports endpoint search, listing, and code generation.

Key features

  1. 01Load swagger.json configuration
  2. 02Watch config changes and reload docs
  3. 03Fuzzy-search API endpoints
  4. 04Generate API call code
  5. 05List available endpoints

Use cases

  1. 01Find endpoints matching a query
  2. 02Review all project endpoints
  3. 03Generate call code for an endpoint

MCP support

It provides MCP clients such as Cursor with tools to initialize, search endpoints, generate code, and retrieve the endpoint list.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"swagger-viewer": {
"command": "npx",
"args": [
"-y",
"@xc_angelwatch/swagger-viewer"
]
}
}
}
Run commandnpx -y @xc_angelwatch/swagger-viewer

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@xc_angelwatch/swagger-viewer

Tools

4

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
swaggerUrlstringYesURL of the Swagger document

Details

From the project README

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 接口:

  1. mcp_swagger_initialize(): 初始化工具,加载配置
  2. mcp_swagger_search(query): 搜索接口
  3. mcp_swagger_generate_code(path, method, language): 生成接口调用代码
  4. 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 文档。

支持的编程语言

目前支持生成以下语言的代码:

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.