swagger-viewer

swagger-viewer

3.3

Swagger Viewer MCP Tool is designed for the Cursor editor to facilitate quick viewing and utilization of Swagger API documentation.

Swagger Viewer MCP Tool is a powerful utility for developers working with Swagger API documentation within the Cursor editor. It automates the process of reading and updating API documentation by monitoring changes in the swagger.json configuration file located in the user's root directory. The tool supports fuzzy searching of API endpoints, automatic code generation for API calls, and provides a comprehensive view of all available endpoints. This enhances productivity by streamlining the workflow of accessing and utilizing API documentation.

Features

  • Automatic reading of swagger.json configuration file from the user's root directory.
  • Real-time monitoring of configuration file changes with automatic API documentation updates.
  • Support for fuzzy searching of API endpoints.
  • Automatic generation of API call code.
  • Capability to view all available API endpoints.

MCP Tools

  • {'mcp_swagger_initialize': 'Initializes the tool and loads the configuration.'}
  • {'mcp_swagger_search': 'Searches for API endpoints based on a query.'}
  • {'mcp_swagger_generate_code': 'Generates code for API calls given a path, method, and language.'}
  • {'mcp_swagger_get_all_endpoints': 'Retrieves all available API endpoints.'}

Usage with Different Platforms

npm_installation

bash
npm install

npx_command


"swagger-viewer": {
      "command": "cmd",
      "swagger-viewer": {
      "command": "cmd",
      "args": ["/c", "npx", "-y", "@xc_angelwatch/swagger-viewer"]
    }
}

example_usage

javascript
// Initialize
await mcp_swagger_initialize();

// Search for endpoints containing "user"
const results = await mcp_swagger_search("user");

// Generate code for a specific endpoint
const code = await mcp_swagger_generate_code("/api/users", "GET", "javascript");

// Get all endpoints
const endpoints = await mcp_swagger_get_all_endpoints();