OpenAPI-MCP: Dockerized MCP Server to allow your AI agent to access any API with existing api docs
@ckanthony
Dockerized MCP Server to allow your AI agent to access any API with existing api docs
概要
What is OpenAPI-MCP?
OpenAPI-MCP is a Dockerized MCP server that reads a Swagger/OpenAPI specification file and automatically generates corresponding Model Context Protocol (MCP) tool definitions. It allows MCP-compatible clients like Cursor to interact with any API that has existing OpenAPI documentation, without additional coding.
How to use OpenAPI-MCP?
Install via Docker (pull ckanthony/openapi-mcp:latest from Docker Hub or build locally). Run the container with docker run, providing the spec file (local path or remote URL) and optional API key configuration via flags, environment variables, or a .env file. The server listens on port 8080 by default.
Key features of OpenAPI-MCP
- Supports both OpenAPI v2 (Swagger) and v3 specifications.
- Generates MCP tool schemas from operation parameters and definitions.
- Securely injects API keys into requests without exposing them to the client.
- Works with local spec files or remote URLs.
- Includes filtering options for operations and tags.
Use cases of OpenAPI-MCP
- Enable an AI assistant to call any public or private API that provides an OpenAPI specification.
- Rapidly integrate a weather API (e.g., Weatherbit) with a Cursor agent using an existing Swagger file.
- Automate tool generation for thousands of endpoints without manual configuration.
- Securely proxy authenticated APIs to MCP clients while keeping keys hidden.
FAQ from OpenAPI-MCP
What OpenAPI versions does OpenAPI-MCP support?
OpenAPI-MCP supports both OpenAPI v2 (Swagger) and OpenAPI v3 specification formats.
How does OpenAPI-MCP handle API keys?
It injects API keys into requests (via header, query, path, or cookie) based on command-line flags. Keys can be provided directly, via environment variables, or from a local .env file, and are never exposed to the MCP client.
Can I use a remote OpenAPI specification?
Yes, you can pass a remote URL to the --spec flag. The server will fetch the specification and generate tools accordingly.
What runtime is required to run OpenAPI-MCP?
OpenAPI-MCP is Dockerized. The recommended approach is to use the pre-built Docker Hub image. For local development, you can build the image from source using Go.
How do I filter which endpoints become MCP tools?
Use the command-line flags --include-tag, --exclude-tag, --include-op, and --exclude-op to include or exclude specific operations or tag groups.