A server that ingests and serves Swagger/OpenAPI specifications through the Model Context Protocol (MCP).
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.
git clone https://github.com/dcolley/swagger-mcp.git
cd swagger-mcp
yarn install
.env file based on the example:cp .env.example .env
Configure your Swagger/OpenAPI specification:
swagger.json)Update the configuration in config.json with 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:
servers array, the first server URL will be used as the base URLyarn dev
yarn build
yarn start
GET /health - Check server health statusGET /sse - Establish Server-Sent Events connectionPOST /messages - Send messages to the MCP serverRun the test suite:
# Run tests once
yarn test
# Run tests in watch mode
yarn test:watch
# Run tests with coverage report
yarn test:coverage
The server supports various authentication methods. Configure them in the config.json file as fallbacks when not specified in the Swagger file:
{
"defaultAuth": {
"type": "basic",
"username": "your-username",
"password": "your-password"
}
}
{
"defaultAuth": {
"type": "bearer",
"token": "your-bearer-token"
}
}
{
"defaultAuth": {
"type": "apiKey",
"apiKey": "your-api-key",
"apiKeyName": "X-API-Key",
"apiKeyIn": "header"
}
}
{
"defaultAuth": {
"type": "oauth2",
"token": "your-oauth-token"
}
}
yarn dev
This project is licensed under the Apache 2.0 License.
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 URL2 commits
TypeScript
91.6%
JavaScript
8.4%
A server that ingests and serves Swagger/OpenAPI specifications through the Model Context Protocol (MCP).
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.
git clone https://github.com/dcolley/swagger-mcp.git
cd swagger-mcp
yarn install
.env file based on the example:cp .env.example .env
Configure your Swagger/OpenAPI specification:
swagger.json)Update the configuration in config.json with 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:
servers array, the first server URL will be used as the base URLyarn dev
yarn build
yarn start
GET /health - Check server health statusGET /sse - Establish Server-Sent Events connectionPOST /messages - Send messages to the MCP serverRun the test suite:
# Run tests once
yarn test
# Run tests in watch mode
yarn test:watch
# Run tests with coverage report
yarn test:coverage
The server supports various authentication methods. Configure them in the config.json file as fallbacks when not specified in the Swagger file:
{
"defaultAuth": {
"type": "basic",
"username": "your-username",
"password": "your-password"
}
}
{
"defaultAuth": {
"type": "bearer",
"token": "your-bearer-token"
}
}
{
"defaultAuth": {
"type": "apiKey",
"apiKey": "your-api-key",
"apiKeyName": "X-API-Key",
"apiKeyIn": "header"
}
}
{
"defaultAuth": {
"type": "oauth2",
"token": "your-oauth-token"
}
}
yarn dev
This project is licensed under the Apache 2.0 License.
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 URL2 commits
TypeScript
91.6%
JavaScript
8.4%