Automatically converts REST APIs with Swagger/OpenAPI documentation into MCP tools, enabling interaction with any Swagger-documented API through dynamically generated tools that handle path, query, and body parameters.
MCP Swagger Server
An MCP (Model Context Protocol) server that automatically converts REST APIs with Swagger/OpenAPI documentation into MCP tools, making them accessible to MCP-compatible clients.
Features
🔄 Automatic Tool Generation: Converts Swagger/OpenAPI endpoints to MCP tools
🔒 SSL Certificate Handling: Option to ignore SSL certificate errors for internal APIs
🏷️ Custom Tool Prefixes: Organize tools with custom prefixes for better organization
📡 Stdio Transport: Uses stdio format as the default transport mechanism
🌐 Flexible Input: Supports both URL and local file swagger documentation
🔧 Parameter Support: Handles path, query, and body parameters
📝 Type Mapping: Maps Swagger types to JSON Schema types for proper validation
Installation
Global Installation
From Source
Usage
Command Line Options
Examples
Load from URL with custom prefix
Load from local file
With authentication
Override base URL
Configuration
The server can be configured through command-line arguments or environment variables:
CLI Option | Environment Variable | Description |
|
| URL to swagger documentation |
|
| Path to local swagger file |
|
| Custom prefix for generated tools |
|
| Override base URL for API calls |
|
| Ignore SSL certificate errors |
|
| Authentication header |
Using Environment Variables
You can set environment variables to avoid passing command-line arguments repeatedly:
Environment Variables in MCP Configuration
You can also use environment variables in your MCP client configuration:
MCP Integration
Add to your Agent configuration (e.g. claude_desktop_config.json
or ~/.gemini/settings.json
):
Other MCP Clients
The server uses the standard MCP stdio transport, so it should work with any MCP-compatible client. Start the server and connect via stdin/stdout.
Generated Tools
Tool Naming Convention
Tools are named using the following pattern:
{prefix}_{method}_{path_segments}
Path parameters are converted to
by_{parameter_name}
Examples:
GET /v1/users/
→myapi_get_v1_users
GET /v1/users/{id}
→myapi_get_v1_users_by_id
POST /v1/users/
→myapi_post_v1_users
Parameter Mapping
Path parameters: Included in the URL path
Query parameters: Added as URL query string
Body parameters: Sent as JSON request body
Header parameters: Added to request headers
Type Mapping
Swagger Type | JSON Schema Type |
|
|
|
|
|
|
|
|
|
|
Sample Swagger Document
The server has been tested with the following sample swagger document structure:
This would generate tools like:
example_get_v1_hosts
- List hosts with optional filteringexample_get_v1_hosts_by_name
- Get specific host by name
Error Handling
The server includes comprehensive error handling:
SSL Certificate Errors: Can be ignored with
--ignore-ssl
flagNetwork Errors: Returned as error responses with details
Invalid Swagger: Validation errors are reported during startup
Missing Parameters: Parameter validation based on swagger schema
HTTP Errors: API response errors are captured and returned
Development
Building
Testing
Linting
Troubleshooting
Common Issues
SSL Certificate Errors
Use
--ignore-ssl
flag for internal APIs with self-signed certificates
Tool Name Conflicts
Use
--tool-prefix
to add unique prefixes to avoid naming conflicts
Base URL Issues
Use
--base-url
to override the base URL from swagger documentation
Authentication Failures
Provide proper authentication header with
--auth-header
Debug Mode
The server logs important information to stderr:
Swagger document loading status
Number of tools generated
Tool generation details
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
Support
For issues and questions:
Create an issue on GitHub
Check the troubleshooting section above
Review the sample configurations
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Automatically converts REST APIs with Swagger/OpenAPI documentation into MCP tools, making any documented API accessible to MCP-compatible clients. Supports authentication, SSL handling, and flexible configuration for seamless API integration.
Related MCP Servers
- AsecurityAlicenseAqualityA tool that creates MCP (Model Context Protocol) servers from OpenAPI/Swagger specifications, enabling AI assistants to interact with your APIs.Last updated -3525MIT License
- -securityFlicense-qualityA service that converts OpenAPI specifications into MCP tools, enabling AI assistants to interact with your API endpoints through natural language.Last updated -
- AsecurityAlicenseAqualityMCP server that provides tools for exploring and testing APIs through Swagger/OpenAPI documentation.Last updated -5205MIT License
- AsecurityFlicenseAqualityA service that dynamically generates MCP tools from Swagger/OpenAPI documentation, allowing Claude Desktop to directly invoke REST APIs through natural language.Last updated -53