MCP Swagger Server

MCP Swagger Server

Automatically generates MCP servers from OpenAPI/Swagger specifications, enabling users to interact with any REST API through natural language with flexible endpoint filtering and authentication support.

Category
Visit Server

README

MCP Swagger Server

Generate MCP (Model Context Protocol) servers from Swagger/OpenAPI specifications with flexible filtering.

Features

  • Dynamic Tool Generation: Automatically creates MCP tools from OpenAPI endpoints
  • Flexible Filtering: Control exposed endpoints via HTTP methods, paths, tags, and operation IDs
  • Authentication: Built-in Bearer token support
  • Type Safety: Automatic parameter validation and conversion
  • FastMCP Integration: Built on the FastMCP framework for reliable MCP server implementation

Installation

# Install from source
pip install -e .

# Or install dependencies directly
pip install -r requirements.txt

Quick Start

# Basic usage (exposes GET endpoints by default)
mcp-swagger path/to/swagger.json

# With authentication
mcp-swagger swagger.json --api-token "your-token"

# Custom base URL
mcp-swagger swagger.json --base-url "https://api.example.com"

Filtering Options

Control which endpoints are exposed:

  • HTTP Methods: --methods get post put delete
  • Path Patterns: --paths "/api/*" --exclude-paths "/admin/*"
  • Tags: --tags public documents --exclude-tags internal
  • Operation IDs: --operation-ids list_docs get_doc --exclude-operation-ids delete_all

Examples

# Public read-only API
mcp-swagger api.json --methods get --tags public --exclude-paths "/admin/*"

# Specific operations only
mcp-swagger api.json --operation-ids list_docs get_doc search_docs

# Preview generated tools without starting server
mcp-swagger api.json --dry-run --methods get post

Configuration

Command Line Options

  • --host: Server host (default: localhost)
  • --port: Server port (default: 8080)
  • --transport: Transport protocol: sse or streamable-http (default)
  • --timeout: Request timeout in seconds (default: 30)
  • --dry-run: Preview tools without starting server

Environment Variables

  • API_BASE_URL: Default base URL for the API
  • API_TOKEN: API token for authentication

Docker

# Build image
docker build -t mcp-swagger .

# Run with configuration
docker run -p 8080:8080 \
  -e API_BASE_URL=https://api.example.com \
  -e API_TOKEN=your-token \
  -v $(pwd)/swagger.json:/app/swagger.json \
  mcp-swagger /app/swagger.json --methods get post

Architecture

  • config/: CLI parsing and settings
  • filters/: Endpoint filtering logic
  • generators/: MCP tool generation
  • parsers/: OpenAPI spec parsing
  • api_client/: HTTP client and auth
  • models/: Data models
  • utils/: Utilities and logging

How It Works

  1. Load OpenAPI/Swagger specification (file or URL)
  2. Apply filters to select endpoints
  3. Generate FastMCP tools with parameter validation and auth
  4. Start MCP server with generated tools

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured