Your Next.js 15 app already has API routes; here's how to expose them as MCP tools without rewriting a single handler. Publish an OpenAPI spec, point wmcp.sh at it, and any MCP-compatible agent (Claude Desktop, Cursor, Codex) gets typed tools.
wmcp.sh is not affiliated with Vercel or Anthropic. App Router and Route Handlers are Next.js features.
Route Handlers under app/api/**/route.ts serving your web app, with typed inputs (Zod, valibot, or hand-rolled), Vercel deployment, and probably some Zod-to-OpenAPI generator emitting a spec.
A Model Context Protocol server exposing each route as a tool with JSON Schema inputs and structured outputs. wmcp.sh generates it from your existing OpenAPI doc — no new handler, no new framework.
A real, runnable example. The handler is plain Next.js 15; the OpenAPI bit is what wmcp.sh ingests.
// app/api/quotes/route.ts — Next.js 15 App Router
import { NextResponse } from 'next/server';
import { z } from 'zod';
export const runtime = 'edge';
const QuoteInput = z.object({
symbol: z.string().min(1).max(12),
size: z.number().positive(),
});
export async function POST(req: Request) {
const body = QuoteInput.parse(await req.json());
const mid = await fetchMid(body.symbol);
return NextResponse.json({
symbol: body.symbol,
bid: mid * 0.999,
ask: mid * 1.001,
size: body.size,
issued_at: new Date().toISOString(),
});
}
// Publish OpenAPI at /api/openapi (next-rest-framework, zod-to-openapi, or hand-rolled).
// Then point wmcp.sh at https://acme.example.com/api/openapi and every route
// becomes an MCP tool the agent can call.
Once the spec is live, register it once: curl 'https://wmcp.sh/api/v1/tools?url=https://acme.example.com/api/openapi'. See /integration/openapi for the full spec-ingest contract.
| Capability | Hand-rolled MCP server | wmcp.sh + Next.js OpenAPI |
|---|---|---|
| Tool schema generation | ⚠️ You write a tools.ts and keep it in sync with Route Handlers | ✅ Auto-generated from the OpenAPI spec your build already emits |
| Streamable HTTP transport | ⚠️ You implement the MCP spec server yourself | ✅ Served at https://wmcp.sh/mcp/<your-id> with SSE + HTTP fallback |
| Authentication forwarding | ⚠️ Custom middleware in every Route Handler | ✅ Bearer / OAuth 2.1 / API-key passthrough configured per spec |
| Edge Runtime support | ✅ Yes, if you keep the MCP server edge-compatible | ✅ wmcp.sh runs on Cloudflare Workers; your origin can be Edge or Node |
| Per-tool rate limit | ⚠️ Manual | ✅ Token-bucket per MCP client at the proxy edge |
| Spec drift detection | ❌ Silent breakage when handler diverges from tools.ts | ✅ Spec is the source of truth; re-ingest on deploy |
app/api/**/route.ts files stay as-is. wmcp.sh consumes an OpenAPI document describing them and generates MCP tool definitions. Most teams generate the spec with a Zod-to-OpenAPI library or hand-write a small static file.Authorization), OAuth 2.1 proxy at /mcp/<provider> for DCR-compliant origins, or per-tool API keys declared in your spec's securitySchemes.&tag=public to the ingest URL. Untagged or excluded operations stay invisible to MCP clients.Audit your Route Handlers, emit a typed spec, deploy a hosted MCP at mcp.yourbrand.com. Starter $499 one-time setup; Managed Retainer $999/mo for ongoing maintenance; Enterprise $4,999+/mo for SLA + private deploy.