mcp-gen

Point it at an OpenAPI spec and it writes the MCP server. A 300-endpoint API becomes three tools and about 800 tokens of context, instead of 300 tool definitions the model has to read before it can do anything.

What mcp-gen Does

mcp-gen takes any OpenAPI specification and writes a TypeScript MCP server you can deploy. Feed it a spec URL or file, it outputs a deployable server with type-safe tools, credential management, and audit logging.

OpenAPI Spec → mcp-gen sync → Deployable MCP Server
The Token Problem

Most MCP servers register every tool upfront. When an LLM connects via tools/list, it receives the full catalog: every tool name, description, and JSON Schema input definition, injected into its context window. A hand-built Stripe MCP with 300 tools can burn 50-80K tokens before the user even asks a question.

This is why developers are ditching MCPs for raw CLI wrappers. But CLIs lose credential vaulting, access control, audit trails, and rate limiting: everything enterprises need.

Three Generation Modes
1. Generic mode: three tools, any API size

Registers exactly three tools regardless of whether the API has 10 or 1,000 endpoints.

ToolPurposeInput Schema
{name}_list_schemasDiscover endpoints by category or search{ category?, search? }
{name}_get_schemaGet detailed params/body schema for one endpoint{ operation }
{name}_api_callCall any endpoint with auto-routed params{ operation, params?, body? }

The LLM discovers progressively: browse → inspect → call. All endpoint metadata lives server-side in endpoint_map.json, never sent to the LLM until requested.

~800 tokens in the tools/list response. Always. Whether it's Petstore (20 endpoints) or Stripe (300+).

2. Per-endpoint mode: one tool per endpoint

One tool per API endpoint. Each tool has a typed input schema derived from the OpenAPI spec.

Best for small, focused APIs where every endpoint matters and you want the LLM to see the full surface area upfront.

~200-400 tokens per tool. A 20-endpoint API runs ~5K tokens. A 100-endpoint API runs ~30K+.

3. Curated mode: hand-picked, with a fallback

You choose 5-15 high-value endpoints as direct tools. Everything else is accessible through a fallback api_call tool.

curated:
  tools:
    - operation_id: createCustomer
    - operation_id: getInvoice
    - operation_id: createPaymentIntent
  fallback:
    enabled: true
  explorer:
    enabled: true

~2-4K tokens for 10 curated tools + fallback + explorer.

Token Usage Comparison
API SizeHand-BuiltPer-EndpointCurated (10)Generic
20 endpoints~8-12K~5-8K~3-4K~800
50 endpoints~20-30K~15-20K~3-4K~800
100 endpoints~40-60K~30-40K~3-4K~800
300 endpoints~100-150K~80-120K~3-4K~800
Estimated based on typical tool description + JSON Schema sizes.
Unified Parameter Schema

Most MCP servers force the LLM to understand HTTP routing: path params, query strings, headers. mcp-gen flattens everything into a single params object.

What other MCPs do:
path: { petId: "123" }
query: { status: "available" }
headers: { "X-API-Key": "sk-..." }
What mcp-gen does:
params: { petId: "123", status: "available" }
// Routing handled server-side. Credentials from vault.
What You Get Beyond Token Savings
-

Credential vaulting · Secrets pulled from Vault at runtime, never exposed to the LLM

-

Audit logging · Every tool invocation logged with the identity behind it

-

Multi-tenant support · Customer ID from JWT, isolated credential scopes

-

Type-safe inputs · Zod validation on every parameter

-

Deployable to Statio · One command to Cloud Run with gateway routing and billing

Connect your first server.

Three MCP servers and 5,000 calls a month, free and without a card. If you outgrow it the next plan is $19, and it stays $19 as the team grows.
Start free
  • Keys are encrypted at rest and never handed to an agent
  • Cancel anytime. You drop to Free, nothing is deleted
  • No card required, and no way to spend money on Free
How Statio handles credentials →