Swagger API

by dcolley

47 stars
281 downloads
Not rated
GitHub

About

Transforms Swagger/OpenAPI specifications into tools that enable interaction with any documented API through multiple authentication methods and real-time communication.

Details

Author
dcolley
Repository
dcolley/swagger-mcp
GitHub stars
47
Downloads
281
License
Apache License 2.0
Categories
Developer Tools, Design, Workplace, File Management, AI, API, Security, Other
Tags
#web, #integration

- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Swagger API
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Clone the repository:

git clone https://github.com/dcolley/swagger-mcp.git
cd swagger-mcp

2. Install dependencies:

yarn install

3. Create a .env file based on the example:

cp .env.example .env

4. Configure your Swagger/OpenAPI specification:
- Place your Swagger file in the project (e.g., swagger.json)
- Or provide a URL to your Swagger specification

5. 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"
}
}
}

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "swagger api": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

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

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

1. Clone the repository:

git clone https://github.com/dcolley/swagger-mcp.git
cd swagger-mcp

2. Install dependencies:

yarn install

3. Create a .env file based on the example:

cp .env.example .env

4. Configure your Swagger/OpenAPI specification:
- Place your Swagger file in the project (e.g., swagger.json)
- Or provide a URL to your Swagger specification

5. 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"
}
}
}

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.