Home / MCP / Swagger MCP Server
Parses Swagger/OpenAPI docs to generate TypeScript types and framework-specific API clients via the MCP protocol.
Configuration
View docs{
"mcpServers": {
"swagger_mcp": {
"command": "node",
"args": [
"start-server.js"
]
}
}
}Swagger MCP Server is a specialized MCP server that parses Swagger/OpenAPI documents and generates TypeScript types and API clients. It optimizes handling of large docs, supports multiple OpenAPI versions, and exposes its capabilities via MCP for easy integration with large language models and automation workflows.
You interact with the Swagger MCP Server through an MCP client. Start by running the local server, then issue MCP commands to parse OpenAPI definitions, generate TypeScript types, or produce API clients. The server supports both standard and optimized parsing modes, and can tailor outputs for different client frameworks such as Axios, Fetch, or React Query.
Prerequisites: you need Node.js installed on your system. Ensure you have a supported runtime environment for running MCP servers.
Step 1: Install dependencies using your preferred package manager.
npm install
# or
pnpm installStep 2: Start the server. The default communication transport is standard input/output (stdio). Run the startup command shown in the example.
node start-server.jsStep 3: Connect with an MCP client over stdio. Use the provided examples to issue commands for parsing Swagger/OpenAPI documents, generating TypeScript types, or creating API clients.
Optional: If you need to run a debugging session with the MCP Inspector, use a pipe-based connection to the server as shown in the debugging flow.
The server is designed to work over stdio by default. You can customize behavior via commands and options issued through MCP messages. For large Swagger/OpenAPI documents, enable optimized parsing with caching and lazy loading to reduce memory usage and speed up responses.
Caching is stored in the project’s .api-cache directory. If you need to clear cached data, delete the directory or disable caching in your requests.
The server exposes a set of MCP tools to cover common OpenAPI workflows. These include parsing documents, generating TypeScript definitions, and producing client code for multiple frameworks.
Parse an OpenAPI document to extract operations and schemas. Generate corresponding TypeScript types and then create an API client in your framework of choice. All steps can be driven through a single MCP session or split into separate sessions for modular workflows.
When running locally, follow best practices for securing access to your development environment. If you expose the server to networks, consider restricting access and using authenticated MCP clients where supported.
Parse Swagger/OpenAPI documents to return API operation information and basic schema details.
Optimized parsing of Swagger/OpenAPI with caching, lazy loading, and advanced options for large documents.
Lightweight parsing optimized for very large docs to return essential information quickly.
Generate TypeScript type definitions from an OpenAPI document.
Optimized TypeScript type generation with caching and selective schema inclusion.
Generate API client code for a chosen framework from the OpenAPI document.
Optimized API client generation with caching, lazy loading, and framework-specific options.
Write content to the file system as part of your MCP workflow.