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, defineTool } from "h3-mcp"
const app = new H3().all("/mcp", defineMcpHandler({
name: "my-server",
version: "1.0.0",
tools: [
defineTool({
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. Around 16kb gzip, or 10kb for a single era.
Dual-Era by Default
One endpoint serves both the stateless 2026-07-28 revision and the initialize-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.