{"slug": "agentback-ai-native-api-mcp-framework-for-agents", "title": "AgentBack: AI-native API/MCP framework for agents", "summary": "AgentBack, an AI-native API and MCP framework for building agent services, has been released as an alpha, ESM-only package requiring Node 22.13+ and TypeScript 6. Built on LoopBack 4's dependency-injection core, it allows developers to define a single Zod schema that automatically generates REST endpoints, MCP tools, OpenAPI docs, typed clients, and validation, eliminating contract drift. The framework includes machine-actionable errors, agent-readable documentation, and built-in support for auth, metering, and observability.", "body_md": "### Proven DI core\n\nA hierarchical `Context`\n\nof `Binding`\n\ns with\n`@inject`\n\n, providers, interceptors, extension points,\nand tag-based discovery — ported from LoopBack 4.\n\n[Dependency injection →](docs/concepts/dependency-injection.html)\n\nAgent-native, end to end\n\nAgentBack gives your REST endpoints, MCP tools, OpenAPI docs, typed\nclients, and validation **one Zod contract** — one\nschema, every boundary. Agents consume that surface with\nmachine-actionable errors, `/llms.txt`\n\n, and MCP tools;\nand because there's a single source of truth, a coding agent can\nauthor the whole surface from it without drift. Built on\nLoopBack 4's proven dependency-injection core, rebuilt for ESM\nand Node 22.\n\nalpha · ESM-only · Node 22.13+ · TypeScript 6\n\nOne artifact, many views\n\nDeclare a schema once, on the decorator. The framework derives every other representation from it — so a coding agent adds a surface in one edit and nothing drifts.\n\n`z.infer`\n\ntype`/openapi.json`\n\n, rendered in Swagger\nUI\n`/llms.txt`\n\nPositioning\n\nMost stacks keep the runtime contract, the service contract, and the agent contract in three hand-synchronized places.\n\n| Stack | Runtime contract | Service contract | Agent/tool contract |\n|---|---|---|---|\n| Express + raw Zod | Hand-wired Zod | Hand-written OpenAPI | Hand-written manifest |\n| tRPC | Zod | TypeScript-only | Custom adapter |\n| NestJS | class-validator | Swagger decorators | Custom adapter |\n| FastAPI | Pydantic | OpenAPI from same models | Custom adapter |\n| AgentBack | Zod | OpenAPI from same Zod | MCP from same Zod |\n\nWhat's in the box\n\nA hierarchical `Context`\n\nof `Binding`\n\ns with\n`@inject`\n\n, providers, interceptors, extension points,\nand tag-based discovery — ported from LoopBack 4.\n\nREST and MCP servers are components over the same container. Run either, or both from one process — controllers and tool classes are just bindings.\n\nStable codes, per-field issues, the violated schema, retryability, and remediation hints — the same machine-actionable envelope on REST and MCP.\n\n`confirm:`\n\npayload-bound confirmation tokens and\n`idempotency:`\n\nkey replay, declared on the route or\ntool that must not run twice.\n\n`@price('$0.001')`\n\nmeters a route or tool; the price\ngate refuses unpaid calls with an x402/MPP challenge. Stripe\nmetered billing from the same usage log.\n\nTypeScript consumers import the same schemas and get typed calls plus runtime validation — the client never imports a running server.\n\nEvery tool definition costs context-window tokens on every\nconnection. `toolCostReport`\n\ntoken-prices the MCP\nsurface before agents pay for it.\n\nAuth (JWT, OAuth 2.1), authorization voters, health probes, Prometheus metrics, OpenTelemetry, rate limiting, validated config — all as DI components.\n\nDocumentation\n\nThree ideas carry the whole framework: everything is a binding in a context, schemas live once on the decorator, and servers are components.\n\nFor coding agents\n\nAgentBack ships an\n[agent skill](skills/agentback/SKILL.md) that teaches\nClaude Code, Codex, Cursor, and 20+ other agents the conventions\nthat aren't guessable from type signatures — schema-on-decorator,\nthe slot-0 input bundle, the DI container. One Zod schema is the only\nsource of truth, so an agent adds a route, its MCP tool, and its docs\nin a single edit without drift. The docs are agent-readable too —\n[/llms.txt](llms.txt),\n[/llms-full.txt](llms-full.txt), and a markdown mirror of\nevery page — so the agent reads the framework the way it reads your\nAPI.\n\nBuilt with AgentBack\n\nNot a snippet — a real service. `agentback-demo`\n\nis a\nWeather server where one Zod schema set is served over stdio,\nauthenticated HTTP, and a dev console. It's the shape a coding agent\nand the skill produce: one contract fanning out to REST, MCP, a\ntyped client, and docs, with nothing kept in sync by hand.\n\nOne Zod schema set, served three ways — stdio, authenticated HTTP, and a dev console. Backed by the free Open-Meteo API.\n\n`AgentError`\n\n, `/llms.txt`\n\n, tool-cost reportQuick start\n\nAgentBack is in alpha — the end-to-end examples work and the API surface is still moving. Clone the repo and run a working REST, MCP, or hybrid app, each with its explorer UI.", "url": "https://wpnews.pro/news/agentback-ai-native-api-mcp-framework-for-agents", "canonical_source": "https://agentback.dev", "published_at": "2026-06-15 19:47:13+00:00", "updated_at": "2026-06-15 20:05:00.339299+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "large-language-models"], "entities": ["AgentBack", "LoopBack 4", "Zod", "MCP", "OpenAPI", "Stripe", "Claude Code", "Codex"], "alternates": {"html": "https://wpnews.pro/news/agentback-ai-native-api-mcp-framework-for-agents", "markdown": "https://wpnews.pro/news/agentback-ai-native-api-mcp-framework-for-agents.md", "text": "https://wpnews.pro/news/agentback-ai-native-api-mcp-framework-for-agents.txt", "jsonld": "https://wpnews.pro/news/agentback-ai-native-api-mcp-framework-for-agents.jsonld"}}