Building an AI backend on Node.js in 2026 means writing your API three times. Once for HTTP, so your frontend can call it. Once as an MCP server, so AI tools can call it. Once as an A2A endpoint, so other agents can call it. It is the same logic, expressed three different ways, maintained in three different places. A new pre-alpha framework called Anvil JS is trying to fix that at the router level — and the architecture is worth paying attention to.
The Fragmented Node.js AI Stack #
The typical Node.js AI product stack in 2026 looks like this: Express handles HTTP, a separately deployed MCP server exposes tools to Claude and Cursor, SDK calls to OpenAI or Anthropic are scattered across route handlers, and any agent lifecycle management — checkpointing, guardrails, human-in-the-loop — is custom code written from scratch per project. There is no standard way to trace a multi-step agent run. There is no compile-time check that your MCP tool schema is actually valid. The seams between these layers are where bugs live.
This is the problem Anvil JS is attacking. The framework’s pitch is direct: building an AI product on Node requires stitching together Express for HTTP, a hand-written MCP server, SDK calls scattered across routes, and no standard way to trace a multi-step agent run. Anvil solves this once at the framework layer. The MCP ecosystem reached 97 million monthly SDK downloads in 2026, and the tooling for building MCP-native Node.js backends has not kept pace.
One Route, Three Protocols #
The core idea is that a route should be a route. Define it once, and the framework handles REST, MCP, and A2A from the same handler. In Anvil, exposing an endpoint as an MCP tool requires one annotation:
export const meta = {
mcp: { expose: true }
}
export const paramsSchema = {
type: 'object',
properties: {
query: { type: 'string', description: 'Search query' }
},
required: ['query']
}
export default async function handler(ctx: Context) {
// REST, MCP, and A2A all hit this handler
const { query } = ctx.params
return { results: await search(query) }
}
The framework reads the paramsSchema
, generates the MCP tool definition, registers it in the tool registry, and handles protocol translation. The A2A endpoint is derived automatically. No second MCP server. No duplicated JSON Schema. No separate stdio-to-HTTP transport layer to maintain when you move from local development to production — a friction point that developers building MCP-compatible backends know well.
Agent Primitives Built In #
Beyond the protocol layer, Anvil includes what it calls a native agentic layer — primitives that most teams end up writing from scratch for every project:
defineAgent— define streaming agent endpoints with built-in tool calling and abort propagation** LlmClient**— a built-in LLM client; no SDK wiring required** Durable checkpointing**— agent state persists across crashes and server restarts** Human-in-the-loop**— an agent run for human approval, then resume** Guardrails**— input and output validation for agent runs at the framework level
These are framework features, not boilerplate you write per project. When agent lifecycle primitives live in application code, they drift — different projects checkpoint differently, guardrails get skipped under deadline pressure. At the framework layer, they are consistent by default.
Compile-Time Checks and a Tracing Dashboard #
Two features address the debugging problem every AI backend team runs into. First, anvil build
validates schemas before deployment — MCP serializability, param name collisions, schema compatibility. Errors that would surface as runtime failures in an Express stack get caught at build time.
Second, every agent run traces automatically to a local SQLite store, viewable at /_anvil
. The dashboard shows token usage, cost per run, and the full execution trace. Critically, you can replay past runs without making live model calls — useful when you need to debug agent behavior that happened once and cannot be reproduced on demand. OpenTelemetry export is built in, so existing observability stacks require no custom instrumentation.
The Honest Assessment #
Anvil JS is pre-alpha. Documentation and example projects are listed as the final milestone before a public release, which means the code exists but the on-ramp is steep. There are no published performance benchmarks. The project is a solo developer effort. Teams running production traffic should not be betting on it today.
That said, the architectural direction is correct. The A2A protocol under the Linux Foundation hit 150 supporting organizations by April 2026 — multi-agent coordination is production reality in enterprise environments. The problem Anvil solves — fragmented, hand-rolled agent infrastructure on every Node.js backend — is real and getting worse as agent workloads become routine. A framework that collapses HTTP, MCP, and A2A into a single routing layer is the right answer. Anvil is not the last framework to attempt this, but it is one of the first, and the implementation is thoughtful.
Install it with npm install anvil
(Node 20 required), run anvil dev
, and see whether the routing model works for your project. The pre-alpha label means you accept the rough edges. Full details and source at anvil.thatdevguy.in.