I turned a real OpenAPI into an MCP server in 5 min (without losing custom code on regen)
Description and use
The MCP generator now groups operations by tags, producing a manageable number of tools, supports filtering, incremental regeneration, and preserves custom code.
Problem
Generating an MCP server from a large OpenAPI spec produced too many tools (one per operation), making the server unusable.
Outcome
The generator now produces a manageable number of tools, supports selective generation, preserves custom code across regenerations, and offers improved language support and validation.
Workflow
- 1. Run generator with grouping:
node dist/cli/index.js generate -i api.yaml -o ./out --group-by tag - 2. Optionally filter by tags or paths:
--include-tags pets --group-by tagor--path-prefix "/users/" - 3. Add custom code between markers (
// @@mcp-gen:start:…and// @@mcp-gen🔚…) to survive regeneration - 4. Regenerate incrementally:
node dist/cli/index.js generate -i api.yaml -o ./out --incremental - 5. Validate spec:
node dist/cli/index.js validate -i examples/petstore.yaml
Evidence
200 operations across 8 tags become ~8 tools. Each group routes internally by action.
Your code lives between markers and survives regen with a 3‑way merge
- Record date: 2026-09-22T07:30:31.296Z