MCP OpenAPI Generator
Supports generating Python clients targeting the aiohttp asynchronous HTTP framework from OpenAPI specifications.
Supports generating TypeScript Axios client SDKs from OpenAPI specifications.
Supports generating Go Gin API/client code from OpenAPI specifications.
Supports generating Kotlin clients, including Kotlin Spring, from OpenAPI specifications.
Supports generating Python clients from OpenAPI specifications.
Supports generating Rust clients from OpenAPI specifications.
Supports generating Spring and Spring Boot Java code from OpenAPI specifications.
Supports generating Swift 5 clients from OpenAPI specifications.
Supports generating TypeScript clients targeting Axios, Fetch, or Node from OpenAPI specifications.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP OpenAPI Generator
An MCP (Model Context Protocol) server that provides OpenAPI code generation and validation capabilities to AI assistants. Wraps industry-standard tools:
Code Generation:
openapi-generatorandswagger-codegenfor 50+ target languages/frameworksValidation:
SpectralandVacuumfor OpenAPI specification lintingProject Intelligence: Auto-detects project type and suggests appropriate targets
Features
Capability | Tools | Description |
Generate Client | openapi-generator, swagger-codegen | Generate SDKs for TypeScript, Python, Java, Go, Rust, Swift, C#, Kotlin, and more |
Validate Spec | Spectral, Vacuum | Lint OpenAPI specs with customizable rulesets |
List Generators | — | Discover available generators and targets |
Infer Project | — | Auto-detect project type (Node, Python, Rust, Go, Java, etc.) and suggest targets |
Related MCP server: Open API MCP Server
Quick Start
Installation
# Via pip (recommended)
pip install mcp-openapi-generator
# Or via Smithery (for MCP clients)
smithery install @mkabdullahi/mcp-openapi-generatorUsage as MCP Server
Configure in your MCP client (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"openapi-generator": {
"command": "python",
"args": ["-m", "mcp_openapi_generator.server"]
}
}
}For a local VS Code setup, create .vscode/mcp.json with the following
configuration after creating and installing into the project virtual
environment:
python3 -m venv .venv
.venv/bin/python -m pip install -e .{
"servers": {
"openapi-generator": {
"type": "stdio",
"command": "${workspaceFolder}/.venv/bin/python",
"args": ["-m", "mcp_openapi_generator.server"],
"cwd": "${workspaceFolder}"
}
}
}In VS Code, open the MCP server controls and start openapi-generator. This
workspace configuration is ignored by Git because it points to a local virtual
environment.
Usage as CLI Tool
# Generate TypeScript client from Petstore
mcp-openapi-generator generate https://petstore.swagger.io/v2/swagger.json \
--target typescript-axios \
--output ./petstore-client
# Validate a spec
mcp-openapi-generator validate https://petstore.swagger.io/v2/swagger.json
# List available generators
mcp-openapi-generator generators
# Infer project config
mcp-openapi-generator inferAvailable Tools (MCP)
Tool | Description | Parameters |
| Generate client code from OpenAPI spec |
|
| Validate OpenAPI specification |
|
| List available generators and targets | — |
| Detect project type and suggest target | — |
Tool: generate-client
{
"spec": {
"source": "url",
"location": "https://api.example.com/openapi.yaml",
"format": "yaml"
},
"target": "typescript-axios",
"output_dir": "./generated",
"package_name": "my-api-client",
"package_version": "1.0.0",
"additional_properties": {
"supportsES6": "true",
"npmName": "@myorg/api-client"
},
"generate_tests": true,
"post_process": true
}Tool: validate-spec
{
"spec": {
"source": "file",
"location": "./openapi.yaml"
},
"tool": "spectral",
"ruleset": "spectral:oas",
"fail_on_warnings": false
}Supported Targets
Category | Targets |
TypeScript |
|
Python |
|
Java |
|
Kotlin |
|
Go |
|
Rust |
|
Swift |
|
C# |
|
Run mcp-openapi-generator generators for the full list (depends on installed generators).
Prerequisites
The server wraps external CLI tools. Install them for full functionality:
# Code generators (choose one or both)
npm install -g @openapitools/openapi-generator-cli
npm install -g swagger-codegen
# Validators
npm install -g @stoplight/spectral-cli
npm install -g vacuumOr use the Docker image which includes everything:
docker run --rm -v $(pwd):/workspace ghcr.io/mkabdullahi/mcp-openapi-generator generate ...Configuration
Project Auto-Detection
The server automatically detects your project type:
File | Detected As |
| TypeScript/JavaScript |
| Python |
| Rust |
| Go |
| Java/Kotlin |
Default Targets by Language
Language | Default Target |
TypeScript |
|
Python |
|
Java |
|
Kotlin |
|
Go |
|
Rust |
|
Swift |
|
C# |
|
Development
Setup
git clone https://github.com/mkabdullahi/mcp-openapi-generator
cd mcp-openapi-generator
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install in development mode
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit installRunning Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=mcp_openapi_generator --cov-report=html
# Run only unit tests (skip integration)
pytest -m "not integration"Code Quality
# Format
ruff format .
# Lint
ruff check .
# Type check
mypy src/Publishing
To PyPI
# Build
python -m build
# Publish
twine upload dist/*To Smithery
# Build Docker image
docker build -t ghcr.io/mkabdullahi/mcp-openapi-generator:latest .
# Push
docker push ghcr.io/mkabdullahi/mcp-openapi-generator:latest
# Publish to Smithery
smithery publishArchitecture
mcp_openapi_generator/
├── server.py # MCP server implementation
├── cli.py # CLI entry points
├── tools/
│ ├── generate.py # Code generation wrapper
│ └── validate.py # Validation wrapper
├── utils/
│ ├── config_inference.py # Project type detection
│ ├── spec_resolver.py # Spec fetching & resolution
│ └── post_process.py # Formatting & test stubs
└── types/
└── __init__.py # Type definitions (dataclasses, enums)License
MIT License - see LICENSE for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Run tests and linting
Submit a PR
Related
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Related MCP Connectors
Generate a typed SDK, CLI, and MCP server from any OpenAPI or GraphQL spec, and keep them current.
Detect breaking changes, generate changelogs, diff, and validate OpenAPI specs.
Package intelligence MCP for AI agents — 22 tools, 19 ecosystems, AGPL SDK, free.
Convert, lint and generate LLM tool schemas for OpenAI, Anthropic, Gemini and MCP
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to understand and interact with OpenAPI specifications, providing deep insight into API structures for faster and more accurate API integration.916 npm1MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI assistants with access to OpenAPI specifications, enabling API discovery, schema retrieval, and direct API execution with support for OAuth 2.0 and other authentication methods.6 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with OpenAPI documents for analysis, validation, and management through structured interfaces.3ISC
- AlicenseAqualityDmaintenanceEnables AI clients to validate OpenAPI specs, compare versions, detect breaking changes, and generate changelogs.4MIT