Your SvelteKit 2 app already has +server.ts routes and form actions handling JSON traffic; here's how to expose them as MCP tools an agent can call, without writing a parallel API layer.
wmcp.sh is not affiliated with the Svelte project or Anthropic. SvelteKit and +server.ts are Svelte project features.
Route files at src/routes/**/+server.ts exporting GET / POST / PATCH handlers, plus form actions at +page.server.ts. Running under adapter-node, adapter-cloudflare, adapter-vercel, or adapter-netlify.
A Model Context Protocol server with typed tool schemas. wmcp.sh reads an OpenAPI 3 document describing your routes and emits the MCP server at https://wmcp.sh/mcp/<your-id>.
Plain SvelteKit 2; the OpenAPI bit is what wmcp.sh ingests.
// src/routes/api/inventory/+server.ts — SvelteKit 2
import { json, error } from '@sveltejs/kit';
import { z } from 'zod';
import type { RequestHandler } from './$types';
const Body = z.object({
sku: z.string().min(1),
warehouse: z.string().optional(),
});
export const POST: RequestHandler = async ({ request }) => {
const parsed = Body.safeParse(await request.json());
if (!parsed.success) throw error(400, 'invalid body');
const { sku, warehouse } = parsed.data;
const row = await lookupInventory(sku, warehouse);
return json({ sku, warehouse: warehouse ?? 'default', on_hand: row.qty });
};
// Publish OpenAPI at /openapi.json (hand-written or generated from Zod).
// Register: curl 'https://wmcp.sh/api/v1/tools?url=https://acme.example.com/openapi.json'
| Capability | Hand-rolled | wmcp.sh + SvelteKit OpenAPI |
|---|---|---|
| Tool schemas in sync with routes | ⚠️ Manual; drifts on every refactor | ✅ Spec is source of truth; one re-ingest on deploy |
| Form actions exposed | ⚠️ Possible via FormData → JSON wrapper | ✅ Same wrapper; spec it once, agents see it |
| SSE / Streamable HTTP transport | ⚠️ You build it on top of +server.ts | ✅ MCP transport served at https://wmcp.sh/mcp/<your-id> |
| Multi-adapter portability | ⚠️ Tied to one runtime | ✅ wmcp.sh proxies any HTTPS origin |
| CSRF handling | ⚠️ You configure handle hooks per route | ✅ Configurable per-spec; or wmcp.sh forwards a matching Origin |
| Per-tool auth | ⚠️ Custom middleware | ✅ Bearer / API-key / OAuth 2.1 declared in securitySchemes |
src/routes/openapi.json/+server.ts, convert your Zod schemas with @asteasolutions/zod-to-openapi, or factor handlers into a Hono sub-app and use its generator.+server.ts RequestHandler shape works identically.Audit your +server.ts routes, emit a typed spec, deploy 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.