Swagger MCP Server
Uses .ENV files for configuration management, allowing users to set server parameters and authentication credentials through environment variables.
Ingests Swagger/OpenAPI specifications and automatically generates MCP tools from API endpoints, supporting multiple authentication methods including Basic Auth, Bearer Token, API Key, and OAuth2.
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 Serverfetch user data from the GitHub 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 server that ingests and serves Swagger/OpenAPI specifications through the Model Context Protocol (MCP).
Features
Loads Swagger/OpenAPI specifications
Supports multiple authentication methods:
Basic Auth
Bearer Token
API Key (header or query)
OAuth2
Automatically generates MCP tools from API endpoints
Server-Sent Events (SSE) support for real-time communication
TypeScript support
Related MCP server: OpenAPI to MCP Server
Security
This is a personal server!! Do not expose it to the public internet. If the underlying API requires authentication, you should not expose the MCP server to the public internet.
TODO
secrets - the MCP server should be able to use secrets from the user to authenticate requests to the API
Comprehensive test suite
Prerequisites
Node.js (v18 or higher)
Yarn package manager
TypeScript
Installation
Clone the repository:
git clone https://github.com/dcolley/swagger-mcp.git
cd swagger-mcpInstall dependencies:
yarn installCreate a
.envfile based on the example:
cp .env.example .envConfigure your Swagger/OpenAPI specification:
Place your Swagger file in the project (e.g.,
swagger.json)Or provide a URL to your Swagger specification
Update the configuration in
config.jsonwith your server settings:
{
"server": {
"host": "localhost",
"port": 3000
},
"swagger": {
"url": "url-or-path/to/your/swagger.json",
"apiBaseUrl": "https://api.example.com", // Fallback if not specified in Swagger
"defaultAuth": { // Fallback if not specified in Swagger
"type": "apiKey",
"apiKey": "your-api-key",
"apiKeyName": "api_key",
"apiKeyIn": "header"
}
}
}Note: The server prioritizes settings from the Swagger specification over the config file:
If the Swagger file contains a
serversarray, the first server URL will be used as the base URLIf the Swagger file defines security schemes, they will be used for authentication
The config file settings serve as fallbacks when not specified in the Swagger file
Usage
Start the development server:
yarn devBuild for production:
yarn buildStart the production server:
yarn startAPI Endpoints
GET /health- Check server health statusGET /sse- Establish Server-Sent Events connectionPOST /messages- Send messages to the MCP server
Testing
Run the test suite:
# Run tests once
yarn test
# Run tests in watch mode
yarn test:watch
# Run tests with coverage report
yarn test:coverageAuthentication
The server supports various authentication methods. Configure them in the config.json file as fallbacks when not specified in the Swagger file:
Basic Auth
{
"defaultAuth": {
"type": "basic",
"username": "your-username",
"password": "your-password"
}
}Bearer Token
{
"defaultAuth": {
"type": "bearer",
"token": "your-bearer-token"
}
}API Key
{
"defaultAuth": {
"type": "apiKey",
"apiKey": "your-api-key",
"apiKeyName": "X-API-Key",
"apiKeyIn": "header"
}
}OAuth2
{
"defaultAuth": {
"type": "oauth2",
"token": "your-oauth-token"
}
}Development
Start the development server:
yarn devLicense
This project is licensed under the Apache 2.0 License.
Environment Variables
PORT: Server port (default: 3000)API_USERNAME: Username for API authentication (fallback)API_PASSWORD: Password for API authentication (fallback)API_TOKEN: API token for authentication (fallback)DEFAULT_API_BASE_URL: Default base URL for API endpoints (fallback)DEFAULT_SWAGGER_URL: Default Swagger specification URL
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.8MIT
- AlicenseDqualityCmaintenanceA tool that creates MCP (Model Context Protocol) servers from OpenAPI/Swagger specifications, enabling AI assistants to interact with your APIs.350 npm50MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that creates tools from API configurations defined in YAML files, allowing easy integration of external APIs into an MCP ecosystem without coding.75 npm7MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that converts OpenAPI/Swagger specifications to MCP format, enabling AI assistants to interact with REST APIs through standardized protocol.76TypeScriptMIT