home / mcp / swagger mcp server

Swagger MCP Server

Provides dynamic Swagger/OpenAPI session management with fast search and lightweight caching for API exploration.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "alleyway-boop-swagger-mcp": {
      "command": "node",
      "args": [
        "path/to/swagger-mcp/build/index.js"
      ],
      "env": {
        "PORT": "3000",
        "NODE_ENV": "development",
        "LOG_LEVEL": "info"
      }
    }
  }
}

Improved Swagger MCP is a high‑performance MCP server designed for exploring Swagger/OpenAPI definitions with dynamic session management, fast multi‑dimensional search, and lightweight memory usage. It lets you configure API sessions on the fly, search large APIs instantly, and monitor session health and resource use while keeping memory footprint small.

How to use

You use this MCP server by running it as a local process (stdio) or by integrating it with a client that communicates via standard MCP commands. Start a session to load a Swagger/OpenAPI definition, then search endpoints, inspect details, and manage caches. All actions are designed to be fast, memory-efficient, and isolated per session so different APIs or environments don’t interfere with each other.

How to install

Prerequisites: Node.js version 14 or higher and npm or yarn.

1. Clone the project and navigate into the repository.

git clone https://github.com/readingdancer/swagger-mcp.git
cd swagger-mcp

2. Install dependencies.

npm install

3. Create a configuration file based on the example.

cp .env.example .env

4. Edit the configuration file to set your environment variables (port, environment, log level, etc.).

Additional sections

Configuration and startup details help you run and manage the Swagger MCP server effectively.

Starting the MCP server locally (stdio) requires running the built index file with Node. Use the final start command shown here to run the server.

node build/index.js

If you prefer a path that mirrors the original project structure, you can also start with the explicit path to the built file.

node path/to/swagger-mcp/build/index.js

Available tools

configure_swagger_session

Dynamically configure a Swagger session with on‑the‑fly settings, including swagger URLs, headers, and cache TTL.

search_swagger_endpoints

Perform fast endpoint searches without loading the full Swagger document, supporting keywords, tags, patterns, and method filtering.

get_endpoint_details

Fetch on‑demand detailed information for specific endpoints within a session.

get_session_stats

Retrieve real‑time stats for a session and the system, including memory and cache status.

clear_swagger_cache

Manage and clear cached Swagger data to optimize memory usage.

get_search_suggestions

Provide smart suggestions for searches and frequently accessed endpoints.

getSwaggerDefinition

Download a Swagger definition from a given URL.

listEndpoints

List all endpoints from a loaded Swagger definition.

listEndpointModels

List all models used by a specific endpoint.

generateModelCode

Generate TypeScript code for a Swagger model.

generateEndpointToolCode

Generate a complete MCP tool definition for an endpoint.