Swagger MCP Server
Fetches and parses Swagger/OpenAPI documentation from any URL, enabling exploration of API schemas, testing of endpoints, and validation of API responses. Supports various authentication methods including API keys, basic auth, and bearer tokens.
Processes Swagger/OpenAPI documentation in YAML format, enabling the parsing and exploration of API definitions specified in YAML.
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 MCP Serverlist all endpoints for the user management API"
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 MCP Server
A Model Context Protocol (MCP) server that provides tools for exploring and testing APIs through Swagger/OpenAPI documentation. This server automatically detects configuration files from multiple IDEs and provides comprehensive API interaction capabilities.
Features
๐ Fetch and parse Swagger/OpenAPI documentation from any URL
๐งช Test API endpoints directly through the MCP interface
๐ Explore API schemas and understand data structures
๐ง Multi-IDE support - automatically detects config from VS Code, Cursor, Windsurf, and more
๐ Flexible authentication - supports API keys, basic auth, and bearer tokens
โก Auto-discovery - can find documentation URLs automatically
Related MCP server: MCP-QA
Configuration
IDE Setup
Create an MCP configuration file in your IDE's configuration directory:
VS Code:
~/.vscode/mcp.jsonor.vscode/mcp.json(in your project)Cursor:
~/.cursor/mcp.jsonor.cursor/mcp.json(in your project)Windsurf:
~/.windsurf/mcp.jsonor.windsurf/mcp.json(in your project)Any IDE:
mcp.json(in your project root) or.mcp/config.json
Authentication Options
Option 1: Using API Key
"swagger-mcp": {
"command": "npx",
"args": [
"-y",
"swagger-mcp@latest"
],
"env": {
"API_BASE_URL": "https://api.example.com",
"API_DOCS_URL": "https://api.example.com/swagger.json",
"API_KEY": "your-api-key-here"
}
}Option 2: Using Username and Password
"swagger-mcp": {
"command": "npx",
"args": [
"-y",
"swagger-mcp@latest"
],
"env": {
"API_BASE_URL": "https://api.example.com",
"API_DOCS_URL": "https://api.example.com/swagger.json",
"API_USERNAME": "your-username",
"API_PASSWORD": "your-password"
}
}Configuration Options
API_BASE_URL- Base URL for your API (e.g.,https://api.example.com) [Required]API_DOCS_URL- Direct URL to Swagger/OpenAPI JSON/YAML (optional, will be auto-discovered)API_KEY- API key for authentication (used as Bearer token)API_USERNAME- Username for basic authenticationAPI_PASSWORD- Password for basic authentication
Authentication Flow
The server intelligently handles authentication:
For API requests: Uses API_KEY as Bearer token, falls back to Basic auth
For authentication endpoints: Auto-injects username/password credentials
Token management: Automatically stores and reuses tokens from login responses
Auto-refresh: Attempts to refresh tokens on 401 Unauthorized responses
Available Tools
fetch_swagger_info
Fetches and parses Swagger/OpenAPI documentation from a given URL to discover available API endpoints.
list_endpoints
Lists all available API endpoints after fetching Swagger documentation, showing methods, paths, and summaries.
get_endpoint_details
Gets detailed information about a specific API endpoint including parameters, request/response schemas, and examples.
execute_api_request
Executes an API request to a specific endpoint with authentication, parameters, headers, and body handling.
validate_api_response
Validates an API response against the schema definitions from Swagger documentation to ensure compliance.
Usage Examples
Once configured, you can use the MCP server in your AI-powered editor to:
Explore APIs: "Show me the available endpoints in this API"
Test endpoints: "Test the POST /users endpoint with this data"
Understand schemas: "Explain the User model structure"
Debug API calls: "Help me troubleshoot this API request"
Validate responses: "Check if this response matches the API schema"
Supported IDEs
The server automatically detects configuration files from:
VS Code (
.vscode/mcp.json)Cursor (
.cursor/mcp.json)Windsurf (
.windsurf/mcp.json)Root directory (
mcp.json)Alternative location (
.mcp/config.json)
Development
# Clone the repository
git clone https://github.com/amrsa1/SwaggerMCP.git
cd SwaggerMCP
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build for production
npm run buildLicense
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Available Tools
5 toolsexecute_api_requestC
Execute an API request to a specific endpoint
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | HTTP method (GET, POST, PUT, DELETE, etc.) | |
| path | Yes | The endpoint path (e.g., '/users/123') | |
| params | No | Query parameters as key-value pairs | |
| body | No | Request body as a JSON object (for POST/PUT/PATCH) | |
| headers | No | Custom headers as key-value pairs |
fetch_swagger_infoC
Fetch Swagger/OpenAPI documentation to discover available API endpoints
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to the swagger.json or swagger.yaml file. If not provided, will try to use the base URL with common Swagger paths. |
get_endpoint_detailsB
Get detailed information about a specific API endpoint
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The endpoint path to get details for (e.g., '/users/{id}') | |
| method | Yes | The HTTP method (GET, POST, PUT, DELETE, etc.) |
list_endpointsB
List all available API endpoints after fetching Swagger documentation
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
validate_api_responseB
Validate an API response against the schema from Swagger documentation
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The endpoint path | |
| method | Yes | The HTTP method | |
| statusCode | Yes | The HTTP status code | |
| responseBody | Yes | The response body to validate |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
- First observed
execute_api_request - First observed
fetch_swagger_info - First observed
get_endpoint_details - First observed
list_endpoints - First observed
validate_api_response
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: fetching documentation, listing endpoints, getting endpoint details, executing requests, and validating responses. The descriptions make it easy to tell them apart, and there is no ambiguity in their functions.
All tool names follow a consistent verb_noun pattern (e.g., execute_api_request, fetch_swagger_info). The naming is uniform and predictable, using snake_case throughout without any deviations or mixed conventions.
With 5 tools, the server is well-scoped for its purpose of interacting with Swagger/OpenAPI documentation and executing API requests. Each tool serves a specific role in the workflow, and the count is neither too sparse nor excessive for the domain.
The tool set provides complete coverage for the Swagger/OpenAPI domain: it supports fetching documentation, discovering endpoints, getting details, executing requests, and validating responses. There are no obvious gaps, and agents can perform a full lifecycle from discovery to execution and validation.
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
MCP server for the Seline Analytics API
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
MCP server that delivers up-to-date Bitrix24 REST API documentation.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceMCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration.507 npm76MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server for the comprehensive analysis of Swagger 2.0 and OpenAPI 3.x contracts. It allows users to extract detailed information about endpoints, request/response schemas, parameters, and security configurations from API documentation.-
- AlicenseNot gradedqualityCmaintenanceA dynamic MCP server that automatically discovers and generates tools from any REST API using OpenAPI/Swagger specifications, enabling instant endpoint access with zero manual configuration.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to explore, search, and query API definitions from OpenAPI/Swagger JSON files.18 npmMIT