Your Astro 5 site already has server endpoints handling content, search, and form submissions — here's how to expose them as MCP tools an agent can call, without abandoning Astro's content-first model.
wmcp.sh is not affiliated with The Astro Technology Company or Anthropic. Astro and Astro server endpoints are Astro project features.
Server endpoints under src/pages/api/*.ts exporting GET / POST handlers that take Astro.request and return a Response. They run under @astrojs/node, @astrojs/cloudflare, @astrojs/vercel, or another adapter.
A discoverable MCP server with tool schemas. wmcp.sh reads an OpenAPI 3 document describing your endpoints and emits the MCP server at https://wmcp.sh/mcp/<your-id> — no Astro changes required.
Plain Astro 5; the OpenAPI bit is what wmcp.sh ingests.
// src/pages/api/search.ts — Astro 5 server endpoint
import type { APIRoute } from 'astro';
import { z } from 'zod';
export const prerender = false;
const Query = z.object({ q: z.string().min(2), limit: z.number().int().max(50).default(10) });
export const POST: APIRoute = async ({ request }) => {
const input = Query.parse(await request.json());
const results = await searchContent(input.q, input.limit);
return new Response(JSON.stringify({ q: input.q, results }), {
headers: { 'content-type': 'application/json' },
});
};
// Publish OpenAPI at /openapi.json (hand-written, or generated from your Zod
// schemas with @asteasolutions/zod-to-openapi). Then point wmcp.sh at it.
Register the spec: curl 'https://wmcp.sh/api/v1/tools?url=https://acme.example.com/openapi.json'. Details at /integration/openapi.
| Capability | Hand-rolled | wmcp.sh + Astro OpenAPI |
|---|---|---|
| Tool schemas | ⚠️ Hand-write tools.ts, keep in sync with endpoint files | ✅ Generated from OpenAPI; one source of truth |
| SSE / Streamable HTTP transport | ⚠️ You build it | ✅ Served at https://wmcp.sh/mcp/<your-id> with full MCP spec |
| Static-site compatibility | ❌ Needs a runtime | ⚠️ Still needs server endpoints — output: 'server' or 'hybrid' |
| Multi-adapter portability | ⚠️ Tied to one adapter's runtime | ✅ wmcp.sh proxies any HTTPS origin — Node, CF Pages, Vercel |
| Auth forwarding | ⚠️ Per-endpoint middleware | ✅ Bearer / API-key / OAuth 2.1 proxy |
| Spec drift detection | ❌ Silent breakage | ✅ Re-ingest on deploy; mismatches surface immediately |
output: 'server' or 'hybrid' in astro.config.mjs plus an adapter (Node, Cloudflare, Vercel). Static pages can still coexist; only endpoints need to be server-rendered.src/pages/openapi.json.ts, use @asteasolutions/zod-to-openapi at build time, or factor handlers into Hono / tRPC sub-apps with their own generators.Authorization), OAuth 2.1 DCR proxy at /mcp/<provider>, or per-tool API keys declared in your spec's securitySchemes.APIRoute shape works identically.Audit your endpoints, 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.