swagger-api-mcp-server
Parses Swagger 2.0 and OpenAPI 3.x specifications, exposing API structure through MCP tools for browsing, searching, and calling APIs defined by the spec.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@swagger-api-mcp-server load the Petstore API spec and list all endpoints"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Swagger API MCP Server
An MCP (Model Context Protocol) server that parses Swagger 2.0 and OpenAPI 3.x specifications, exposing API structure through MCP tools. Features a local file-cache architecture that reduces token usage by 85-95% compared to inline responses.
Features
Swagger 2.0 & OpenAPI 3.x — Full dual-format support
Smart Caching — Spec parsed once, stored as local JSON files; tools return compact summaries + file paths (~200 chars vs 5-20KB)
11 MCP Tools — Load, browse, search, call APIs, and manage auth dynamically
3 MCP Prompts — Guided workflows for exploring, searching, and integrating APIs
3 MCP Resources — Direct access to cached API info, endpoints, and schemas
Two Transport Modes — stdio (for CLI/IDE integration) and HTTP (for multi-session web use)
2-Phase API Calls — Preview requests before executing them
Zero External Parsers — Custom
$refresolver with circular reference protection
Related MCP server: OpenAPI MCP Server
Prerequisites
Node.js >= 24
Quick Start
Install from npm
npm install -g swagger-api-mcp-serverOr clone and build
git clone https://github.com/NekoTarou/swagger-api-mcp-server.git
cd swagger-api-mcp-server
npm install
npm run buildRun
# stdio mode (default) — for MCP clients like Claude Desktop
npm start
# Auto-load a spec on startup
SWAGGER_URL=https://petstore.swagger.io/v2/swagger.json npm start
# HTTP mode — multi-session with Express
npm run start:httpMCP Client Configuration
Claude Desktop
Add to your Claude Desktop config file (claude_desktop_config.json):
{
"mcpServers": {
"swagger-api": {
"command": "npx",
"args": ["-y", "swagger-api-mcp-server"],
"env": {
"SWAGGER_URL": "https://petstore.swagger.io/v2/swagger.json"
}
}
}
}Cursor / VS Code
Add to your MCP settings:
{
"mcpServers": {
"swagger-api": {
"command": "npx",
"args": ["-y", "swagger-api-mcp-server"],
"env": {
"SWAGGER_URL": "https://your-api.example.com/openapi.json"
}
}
}
}Tools
Tool | Description |
| Load a Swagger/OpenAPI spec from URL, parse and cache it |
| Re-fetch spec and rebuild cache |
| Get API metadata (title, version, servers, auth schemes) |
| List all tags with endpoint counts |
| List endpoints with filtering (tag, method, keyword) and pagination |
| Get endpoint summary + cached file path for full details |
| List schema definitions with filtering and pagination |
| Get schema summary + cached file path for full definition |
| Search across endpoints and schemas by keyword |
| Execute HTTP requests with 2-phase confirmation |
| Dynamically set or clear the Authorization header at runtime |
Prompts
Prompt | Arguments | Description |
|
| Guided workflow to load and fully explore an API spec |
|
| Search for endpoints by keyword and view full details |
|
| Find the right endpoint for a task and execute an API call |
Resources
Resource | URI | Description |
|
| API basic information (title, version, servers, auth) |
|
| Index of all API endpoints |
|
| Index of all schema/model definitions |
Cache Architecture
When a spec is loaded, it's parsed once and stored as structured JSON files:
.swagger-cache/
├── meta.json # Cache metadata (URL, counts, timestamp)
├── info.json # Full API info (title, servers, auth)
├── tags.json # Tag list with endpoint counts
├── paths-index.json # Endpoint index for fast lookup
├── schemas-index.json # Schema index for fast lookup
├── endpoints/ # One file per endpoint (deep-resolved)
│ └── GET__users__{id}.json
└── schemas/ # One file per schema (deep-resolved)
└── User.jsonTools return brief summaries with file paths. The LLM reads full details on demand via the Read tool — saving 85-95% of tokens per call.
Environment Variables
Variable | Default | Description |
| (empty) | Auto-load spec on startup |
|
| Transport mode: |
|
| HTTP server port |
|
| HTTP server host |
| (empty) | Override API base URL for calls |
| (empty) | Initial Authorization header value (can be updated at runtime via |
|
| Custom cache directory path |
|
| HTTP session timeout (30 min) |
|
| Max concurrent HTTP sessions |
Development
npm run dev # Dev mode with auto-reload (tsx watch)
npm test # Run tests
npm run build # TypeScript compilation → dist/
npm run clean # Remove dist/License
Available Tools
11 toolsswagger_call_apiCall API EndpointADestructive
Execute an actual HTTP request to an API endpoint. Uses a 2-phase confirmation: first call shows a preview of the request, second call with confirmed=true executes it. Uses the base URL from the spec, API_BASE_URL env var, or the base_url parameter.
Inputs: path (required), method (required), body, headers, +4 more.
swagger_get_endpointGet Endpoint DetailsARead-onlyIdempotent
Get a brief summary of a specific API endpoint and the path to its cached JSON file containing complete details (parameters, request body, responses, security). Use the Read tool on the returned file path to see the full endpoint definition.
Inputs: path (required), method (required).
swagger_get_infoGet API InfoARead-onlyIdempotent
Get general metadata about the loaded API specification. Returns a brief summary and the path to info.json which contains full details (title, version, description, servers, authentication schemes, contact info). Use the Read tool on the file path to see complete information.
Inputs: no named parameters.
swagger_get_schemaGet Schema DetailsARead-onlyIdempotent
Get a brief summary of a specific schema/model and the path to its cached JSON file containing the complete deep-resolved definition (all properties, types, required fields, enums, defaults, nested structures). Use the Read tool on the returned file path to see the full schema.
Inputs: name (required).
swagger_list_pathsList API EndpointsARead-onlyIdempotent
List all API endpoints with method, path, summary, and tags. Supports filtering by tag, HTTP method, and keyword search. Use pagination (limit/offset) for large APIs. Each entry includes a cacheFile path for detailed info.
Inputs: tag, limit, method, offset, +1 more.
swagger_list_schemasList Schema DefinitionsARead-onlyIdempotent
List all model/schema definitions in the API spec. Shows schema name, type, description, and property count. Supports keyword filtering and pagination.
Inputs: limit, offset, keyword.
swagger_list_tagsList API TagsARead-onlyIdempotent
List all tags defined in the API spec. Tags are used to group related endpoints. Also shows how many endpoints belong to each tag.
Inputs: no named parameters.
swagger_load_specLoad Swagger/OpenAPI SpecARead-onlyIdempotent
Load and parse a Swagger 2.0 or OpenAPI 3.x specification from a URL. Supports both JSON and YAML formats. The loaded spec is parsed, cached to local JSON files, and used by all subsequent tools. Must be called first before using other tools (unless SWAGGER_URL env var is set).
Inputs: url (required), headers.
swagger_searchSearch API SpecARead-onlyIdempotent
Search across the API specification by keyword. Searches in endpoint paths, summaries, descriptions, operation IDs, and schema names. Returns matching items with their cache file paths for detailed lookup.
Inputs: keyword (required), scope.
swagger_set_authSet Auth TokenAIdempotent
Dynamically set or clear the Authorization header used by swagger_call_api. The token value is used as-is for the Authorization header (no automatic Bearer prefix). Pass clear=true to remove the current token.
Inputs: clear, token.
swagger_update_cacheUpdate Spec CacheAIdempotent
Re-fetch the Swagger/OpenAPI spec and rebuild the local file cache. Use this when the upstream spec has changed. Optionally provide a new URL.
Inputs: url, headers.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct resource or action: loading/updating the spec, metadata, lists of paths/tags/schemas, detailed endpoint/schema lookups, search, API execution, and auth management. No two tools overlap; even similar get_endpoint and get_schema differ clearly by target resource.
All tools use a consistent snake_case pattern with the swagger_ prefix and a clear verb_noun structure (load_spec, list_paths, get_schema, call_api, set_auth). No mixed conventions or vague verbs.
11 tools is well-scoped for a Swagger/OpenAPI explorer, covering spec loading, introspection, search, and API invocation without redundancy. Each tool earns its place.
The toolset covers the full lifecycle of working with an API spec: load/update, metadata, path/tag/schema enumeration, deep details, search, auth setup, and making real calls. No obvious gaps for the intended purpose.
Maintenance
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Find, document and execute authenticated API calls across 1000+ apps via one MCP server
327 dev tools via REST API and MCP. Generate Dockerfiles, schemas, K8s, APIs, and more.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceDynamically generates MCP tools from Swagger/OpenAPI specifications by extracting swagger.json files at runtime. Enables natural language interaction with any REST API that has Swagger documentation.-
- AlicenseNot gradedqualityDmaintenanceExposes OpenAPI specifications as MCP tools, enabling AI assistants to explore and understand API structures, endpoints, schemas, and documentation through semantic queries.19 npmMIT
- AlicenseAqualityDmaintenanceA read-only MCP server for navigating OpenAPI / Swagger specifications, enabling agents to search endpoints, retrieve parameters and schemas, and inspect authentication without loading the full spec into context.97 npmMIT
- AlicenseNot gradedqualityDmaintenanceDynamically exposes any REST API as MCP tools by parsing its OpenAPI specification.MIT