Install
$ agentstack add mcp-christopherdond-mcp-generator ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
MCP-Generator
> Also available in: [Português (Versão em Português)](README.pt-BR.md)
Generate MCP servers from OpenAPI specs.
> Status: 🚀 Version v2.0.0 Released! View changes
mcp-gen turns an OpenAPI v3 spec into an MCP server in TypeScript or Python. It maps each route to a tool and keeps custom code when you regenerate.
Quick start
npm install
npm run build
Generate a server from a local spec:
mcp-gen generate -i examples/petstore.json -l typescript -o ./my-server
Validate a spec without generating files:
mcp-gen validate -i examples/petstore.yaml
Run the interactive CLI if you prefer prompts:
npm run dev
What it does
sequenceDiagram
participant User
participant CLI
participant Parser
participant Generator
participant Output
User->>CLI: mcp-gen generate --input api.yaml --lang python
CLI->>Parser: validate and parse OpenAPI v3 (JSON or YAML)
Parser->>Generator: internal AST (tools, models, examples)
Generator->>Output: render Handlebars templates
Output-->>User: TypeScript or Python MCP server project
Each route becomes an MCP tool with:
- typed input from parameters and request bodies
- example responses from the spec
- optional incremental code preservation
Requirements
- Node.js 20+
- npm 9+ or yarn
- (Optional) Python 3.8+ for Python projects
To install:
npm install -g mcp-gen
Installation
git clone https://github.com/ChristopherDond/MCP-Generator.git
cd MCP-Generator
npm install
npm run build
CLI
Commands
mcp-gen generateormcp-gen gcreates a server from a spec.mcp-gen validateormcp-gen vchecks a spec without generating files.mcp-gen initdownloads a known public spec and can generate a project.mcp-gen watchwatches a file or URL and regenerates on changes.
Generate
mcp-gen generate -i ./api/openapi.yaml -l typescript -o ./my-server
mcp-gen generate -i ./api/openapi.yaml -l python -o ./my-server
Useful flags:
--force,-foverwrites existing files.--incrementalkeeps code between@@mcp-gen:startand@@mcp-gen:end.--namesets the server name.--server-versionsets the server version.--pluginloads a plugin module or folder.
Validate
mcp-gen validate -i ./api/openapi.yaml
Valid input formats are .json, .yaml, .yml, or a URL.
Init
init uses the built-in registry:
mcp-gen init --from list
mcp-gen init --from stripe
mcp-gen init --from stripe --generate -o ./stripe-mcp
Available registry keys:
| Key | Description | |-----|-------------| | stripe | Stripe Payment API | | github | GitHub REST API | | slack | Slack Web API | | openai | OpenAI API | | petstore | Swagger Petstore example | | twilio | Twilio Communications API | | shopify | Shopify Admin API | | kubernetes | Kubernetes API | | digitalocean | DigitalOcean API | | azure | Azure Resource Manager API |
Watch
mcp-gen watch -i ./api/openapi.yaml -o ./my-server
mcp-gen watch -i https://example.com/spec.json --interval 60000
For URL inputs, --interval controls the polling interval. --once runs generation once and exits after the first change.
Plugins
Plugins can override templates and register extra Handlebars helpers.
Basic structure:
templates/typescript/...ortemplates/python/...for.hbstemplate overridesindex.jsthat exportsregisterHandlebars(handlebars)for custom helpers
Example:
mcp-gen generate -i ./api/openapi.yaml --plugin ./my-plugin
mcp-gen watch -i ./api/openapi.yaml --plugin ./my-plugin
Plugin templates override core templates when they use the same path under templates//.
Generated project structure
TypeScript:
my-server/
├── src/
│ ├── server.ts # MCP server — tool definitions + handlers
│ └── models.ts # TypeScript interfaces from OpenAPI schemas
├── .github/
│ └── workflows/
│ └── ci.yml
├── Dockerfile
├── package.json
├── tsconfig.json
└── README.md
Python:
my-server/
├── server.py # FastMCP server — tool definitions + handlers
├── models.py # Pydantic models from OpenAPI schemas
├── requirements.txt
├── .github/
│ └── workflows/
│ └── ci.yml
├── Dockerfile
└── README.md
Connect to Claude Desktop
TypeScript:
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/absolute/path/to/my-server/dist/server.js"]
}
}
}
Python:
{
"mcpServers": {
"my-server": {
"command": "python",
"args": ["/absolute/path/to/my-server/server.py"]
}
}
}
Restart Claude Desktop. Your API tools appear automatically.
Implement handlers
Generated files return spec examples by default. Replace stubs with real logic.
TypeScript (src/server.ts):
case "get_users_id": {
// @@mcp-gen:start:get_users_id
const user = await db.users.findById(args.id);
return { content: [{ type: "text", text: JSON.stringify(user) }] };
// @@mcp-gen:end:get_users_id
}
Python (server.py):
@mcp.tool()
async def get_users_id(id: float) -> Any:
# @@mcp-gen:start:get_users_id
user = await db.users.find_by_id(id)
return user
# @@mcp-gen:end:get_users_id
Code between @@mcp-gen:start and @@mcp-gen:end markers is preserved when you re-run generate --incremental.
Development
npm test
npx tsc --noEmit
# TypeScript example
node dist/cli/index.js generate --input examples/petstore.json --out /tmp/ts-test --force
# Python example
node dist/cli/index.js generate --input examples/petstore.yaml --lang python --out /tmp/py-test --force
# Incremental example
node dist/cli/index.js generate --input examples/petstore.json --out /tmp/ts-test --incremental
Roadmap
| Week | Status | Scope | |------|--------|-------| | 0–1 | ✅ Done | CLI, OpenAPI v3 parser, TypeScript generator, 7-file scaffold | | 2 | ✅ Done | YAML input, Python/FastMCP target, incremental generation | | 3 | ✅ Done | oneOf/anyOf support, auth stubs, integration tests | | 4 | ✅ Done | Interactive CLI mode, npm/pip publish | | 5 | ✅ Done | mcp-gen init --from stripe — built-in spec registry | | 6 | ✅ Done | Release candidate v1.0.0-rc.1 — in testing, feedback welcome! | | 7+ | 📋 Planned | Custom plugins, improvements from feedback, v1.0.0 final |
Known limitations
- OpenAPI v2 (Swagger) is not supported — v3.x only
oneOf/anyOf/discriminatorschemas are partially handledcopy-templatesscript usescp— on Windows, change toxcopyinpackage.json
License
MIT © 2026 - Christopher D.
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: ChristopherDond
- Source: ChristopherDond/MCP-Generator
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.