cd /news/ai-agents/i-turned-a-real-openapi-into-an-mcp-… · home topics ai-agents article
[ARTICLE · art-135344] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

I turned a real OpenAPI into an MCP server in 5 min (without losing custom code on regen)

A developer released MCP-Generator 2.1.5, an open-source CLI that converts OpenAPI specs into MCP servers for TypeScript, Python, and Go. The update replaces the one-endpoint-per-tool approach with tag-based grouping that collapses 200 operations into roughly 8 tools, and adds marker-based 3-way merge so custom handler code survives regeneration. The project reports validation via npm run build and 196 tests across 11 suites.

by read1 min views4 publishedSep 20, 2026

I built an OpenAPI to MCP server generator for TypeScript, Python and Go.

The v1 mistake: 1 endpoint = 1 tool. On a real API with 200 operations, you get a 200-tool server. Nobody can use that. That was the exact feedback I got on Reddit, and it was right.

What I changed in 2.1.5:

200 operations across 8 tags become ~8 tools. Each group routes internally by action.

node dist/cli/index.js generate -i api.yaml -o ./out --group-by tag

node dist/cli/index.js generate -i api.yaml -o ./out --include-tags pets --group-by tag

Filter before you generate

Only generate what you will use:

node dist/cli/index.js generate -i api.yaml -o ./out --path-prefix "/users/" node dist/cli/index.js generate -i api.yaml -o ./out --include-paths "/users/,/orders/ Regen without losing custom code

Your code lives between markers and survives regen with a 3-way merge:

// @@mcp-gen:start:get_pets

const user = await db.users.findById(args.id);

return { content: [{ type: "text", text: JSON.stringify(user) }] };

// @@mcp-gen🔚get_pets

node dist/cli/index.js generate -i api.yaml -o ./out --incremental

Reusable logic goes in handlers.custom.* — never overwritten without --force.

Fase 0 P0 fixes in 2.1.5

TypeScript: real query serialization (get_pets({ limit: 5 }) -> /pets?limit=5) Python: _build_query / _build_headers in --http mode, including grouped tools

Go: --http wired to the real APIClient, no more not yet wired stubs

Registry is v3-only with actionable errors for removed keys and v2 specs

Try it with the repo example

git clone [https://github.com/ChristopherDond/MCP-Generator.git](https://github.com/ChristopherDond/MCP-Generator.git)

cd MCP-Generator

npm ci

npm run build

node dist/cli/index.js generate -i examples/petstore.yaml -l typescript -o ./my-server

node dist/cli/index.js validate -i examples/petstore.yaml

Or install directly:

npm install -g @christopher_dondici/[mcp-gen@2.1.5](mailto:mcp-gen@2.1.5)

Repo: [https://github.com/ChristopherDond/MCP-Generator](https://github.com/ChristopherDond/MCP-Generator)

Validated with npm run build + npm test (11 suites, 196 tests).

── more in #ai-agents 4 stories · sorted by recency
── more on @mcp-generator 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-turned-a-real-open…] indexed:0 read:1min 2026-09-20 ·