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.
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
Configuration
IDE Setup
Create an MCP configuration file in your IDE's configuration directory:
- VS Code:
~/.vscode/mcp.json
or.vscode/mcp.json
(in your project) - Cursor:
~/.cursor/mcp.json
or.cursor/mcp.json
(in your project) - Windsurf:
~/.windsurf/mcp.json
or.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
Option 2: Using Username and 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
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
This server cannot be installed
MCP server that provides tools for exploring and testing APIs through Swagger/OpenAPI documentation.
Related MCP Servers
- -securityAlicense-qualityAn MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.Last updated -2PythonMIT License
- -securityAlicense-qualityA server that enables interaction with any API that has a Swagger/OpenAPI specification through Model Context Protocol (MCP), automatically generating tools from API endpoints and supporting multiple authentication methods.Last updated -61TypeScriptApache 2.0
- -securityAlicense-qualityAn MCP server that connects to a Swagger specification and helps an AI to build all the required models to generate a MCP server for that service.Last updated -19TypeScriptMIT License
- -securityAlicense-qualityMCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration.Last updated -35122TypeScriptMIT License