Swagger MCP Server
An MCP server that loads a Swagger or OpenAPI spec and turns every API endpoint into a tool the agent can call.
- 115 ★ on the repository
- Last commit
- Apache-2.0
Broad access
Why this level
- The agent calls any API method, including ones that change or delete data, with your credentials.
- Secrets sit in `config.json` and `.env` as plain text, and the server must not be exposed publicly.
Install
- Works in
Manual install
git clone https://github.com/dcolley/swagger-mcp.gitThen `yarn install`, `cp .env.example .env`, edit `config.json` and `yarn dev`.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The agent calls any API method, including ones that change or delete data, with your credentials.
- Secrets sit in `config.json` and `.env` as plain text, and the server must not be exposed publicly.
This is third-party code. Review the repository files before installing.
What it does
Swagger MCP Server reads a Swagger or OpenAPI spec from a file or URL and automatically creates MCP tools from its endpoints. The agent calls the service API without knowing its URLs and parameters in advance. The server handles Basic Auth, bearer tokens, an API key in a header or query parameter and OAuth2. The base URL and security schemes come from the spec itself, and `config.json` acts as a fallback. The client connects over SSE, and `GET /health` reports server state. Put the spec next to the project or point to it by URL.
Who it is for. Developers who want to give an agent quick access to their own or a third-party REST API that has a spec.
Good fit when
- A service has a `swagger.json` and its API must be called from an agent chat.
- Endpoints of an internal service are tried without writing a client.
- A tool set should come straight from an OpenAPI file.
- The API requires a key or token for authorization.
Not a fit when
- You plan to expose the server to the internet: the author calls it personal and asks not to.
- There is no spec or it is incomplete: tools are built only from it.
- The API changes data and nobody supervises the agent.
Example request
Load the spec from `swagger.json`, list the API methods and then fetch the list of pets.MCP
- Transport
- sse
- Authentication
- key is optional
Environment variables
DEFAULT_SWAGGER_URL- Default Swagger specification URL
DEFAULT_API_BASE_URL- Default API base URL when the spec omits it
API_TOKENsecret- Token used to authorize API requests
API_USERNAMEsecret- Username for Basic Auth
API_PASSWORDsecret- Password for Basic Auth
PORT- Server port, 3000 by default
Limitations
The author calls the server personal: do not expose it to the public internet, especially when the API needs authorization. Secrets in `config.json` and environment variables are stored as plain text, and user secret support is on the TODO list. The author also calls the test suite incomplete. It needs Node.js 18 or newer, Yarn and TypeScript; there is no npm package, so you install from a cloned repository. The last commit was in July 2026.
How to disable. Stop the server and remove its address from the MCP client settings. Delete the keys and tokens from `config.json` and `.env`.
FAQ
Where do the API address and authorization come from?
From the spec: the first `servers` URL and the security schemes take priority. `config.json` applies only when the file lacks them.
Which authorization methods exist?
Basic Auth, a bearer token, an API key in a header or query and OAuth2 with a ready token.
How do I check the server works?
With `GET /health`. The client connects to `GET /sse` and messages go to `POST /messages`.
Which environment variables does the server read?
`PORT`, `API_USERNAME`, `API_PASSWORD`, `API_TOKEN`, `DEFAULT_API_BASE_URL` and `DEFAULT_SWAGGER_URL`. All are fallbacks.
Can I expose the server to the internet?
No. The author calls it personal and asks not to expose it, especially when the API needs authorization.
Discussion
No questions or reviews yet.
Related
MCP serversA Pingora gateway that turns existing HTTP services into MCP servers from an OpenAPI spec, with no changes to their code
Apollo's MCP server: turns chosen GraphQL operations into tools the agent uses to work with your API
An MCP server and plugin for agents that generate web APIs from OpenAPI, AsyncAPI, GraphQL, gRPC and SQL specs on a Rust core.
mcp-graphql: MCP server for GraphQL APIs
mcp-graphql
Two GraphQL tools for MCP clients: the agent fetches your API schema and runs queries against a single endpoint
A Laravel and Lumen package that adds an MCP endpoint to your app's routes and attaches your own tools to it
A single Go binary turns a SQL database into a REST API with roles and an MCP server for Claude Code, Cursor and VS Code
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Swagger MCP Server (this card) | no | key is optional | 115 | |
| openapi-mcp-generator | no | 644 | generates a standalone MCP server from OpenAPI; Swagger MCP Server reads the spec at runtime | |
| OpenAPI MCP Server | yes | not required | 302 | gives the agent an overview of the spec; Swagger MCP Server creates callable tools for each endpoint |
README in short
The TypeScript server runs through `yarn dev`, or `yarn start` after a build. Settings live in `config.json` and `.env`.