h3-mcp
MCP servers, built on H3
Lightweight Model Context Protocol server utilities for H3. Dual-era, zero MCP SDK dependency.
import { H3, serve } from "h3"
import { defineMcpHandler, defineMcpTool } from "h3-mcp"
const app = new H3().all("/mcp", defineMcpHandler({
name: "my-server",
version: "1.0.0",
tools: [
defineMcpTool({
name: "hello",
handler: () => ({ content: [{ type: "text", text: "⚡️ Tadaa!" }] }),
}),
],
}))
serve(app)
Features
No SDK Dependency
MCP as a self-contained JSON-RPC 2.0 layer on top of H3. ~34kb min / ~11kb gzip, or ~19kb for a single era.
Dual-Era by Default
One endpoint serves both the stateless
2026-07-28revision and theinitialize-based revisions (≤2025-11-25). Narrow it per request or drop an era from your bundle.Secure by Default
Origin checks, body-size and content-type limits, boundary input validation, and private cache scopes are on before you configure anything.