home / mcp / swagger mcp server

Swagger MCP Server

MCP server that provides tools for exploring and testing APIs through Swagger/OpenAPI documentation.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "amrsa1-swagger-mcp": {
      "url": "https://api.example.com/swagger.json",
      "headers": {
        "API_KEY": "YOUR_API_KEY",
        "API_BASE_URL": "https://api.example.com",
        "API_DOCS_URL": "https://api.example.com/swagger.json",
        "API_PASSWORD": "YOUR_PASSWORD",
        "API_USERNAME": "YOUR_USERNAME"
      }
    }
  }
}

Swagger MCP Server is an MCP server that helps you fetch, parse, and interact with Swagger/OpenAPI documentation directly from your editor. It lets you explore API schemas, test endpoints, and manage authentication in one streamlined workflow, improving API understanding and testing efficiency.

How to use

You configure the MCP client in your editor to automatically discover and interact with Swagger/OpenAPI documentation. Use the client to fetch docs from a URL, list available endpoints, inspect request/response schemas, and run API requests with your credentials. Authenticate using your API key, username/password, or Bearer tokens, and let the server manage tokens and automatic refreshes during testing.

How to install

Prerequisites you need before installation are Node.js and npm. Ensure your environment can run MCP configurations in your editor.

Clone the project repository, install dependencies, and start the development server with the following steps.

Configuration and usage notes

The server supports two primary connection methods. Use the HTTP method to point to a Swagger/OpenAPI URL, or run the server locally via a stdio command for development and testing.

Development

Install dependencies, then run in development mode and build for production.

Available tools

fetch_swagger_info

Fetches and parses Swagger/OpenAPI documentation from a URL to discover available API endpoints.

list_endpoints

Lists all available API endpoints with methods, paths, and summaries after Swagger parsing.

get_endpoint_details

Provides detailed information about a specific endpoint, including parameters and schemas.

execute_api_request

Performs an API request to a chosen endpoint with authentication, parameters, headers, and body handling.

validate_api_response

Validates API responses against Swagger schema definitions to ensure conformance.