@stackcurious/openapi-to-ts-mcp
v0.1.0
Published
Generate a TypeScript MCP server from any OpenAPI 3.x spec — one command, ready to publish.
Maintainers
Readme
@stackcurious/openapi-to-ts-mcp
One command. OpenAPI 3.x spec in. A TypeScript MCP server package out — ready to npm install && npm run build && npm publish.
npx @stackcurious/openapi-to-ts-mcp https://api.example.com/openapi.json @stackcurious/example-mcpThat generates a directory containing:
package.json— scoped, MIT, includes@modelcontextprotocol/sdk+zodtsconfig.json— ES2022, strict, declaration outputsrc/index.ts— MCP server with one tool per OpenAPI operationREADME.md— install + setup + tool list
What it generates
For each (method, path) in the spec it emits one MCP tool:
GET /products→<prefix>_get_productsGET /products/{id}→<prefix>_get_products_by_idPOST /checkouts→<prefix>_post_checkouts(or usesoperationIdif present)
Path / query / header parameters are mapped to zod-validated tool inputs. Bodies become a single body arg of type z.record(z.string(), z.unknown()).
Authentication scheme is inferred from components.securitySchemes:
- HTTP bearer →
Authorization: Bearer ${process.env.<PREFIX>_ACCESS_TOKEN} - API key in header →
<header-name>: ${process.env.<PREFIX>_API_KEY} - API key in query → appended to URL
- Otherwise → no auth (and a warning at startup)
Limits in v0.1
- Caps at 18 tools per spec (signal-to-noise — most APIs over 18 are noisy in MCP context)
- OpenAPI 3.x only (2.x / Swagger requires conversion first)
- No
$refresolution beyond what the spec inlines (nested schemas serialized asz.unknown()) - Cookie params skipped
- No streaming / Server-Sent Events tools
- Generated code uses native
fetch, no SDK dependency on the target API
Why
Q ships an MCP server per pitched dev-tool company. Hand-writing each is 1 day. This generates a working server in 30 seconds, leaving the day for what actually matters: voice, demo content, the pitch itself.
Built by Q. Companion to @stackcurious/polar-mcp, @stackcurious/revenuecat-charts-mcp.
License
MIT.
