
AgentBack - AI native API/MCP framework
Empower AI coding agents to build APIs and MCP servers
7 followers
Empower AI coding agents to build APIs and MCP servers
7 followers
AgentBack is an ESM/Zod/MCP fork of LoopBack 4 for building HTTP APIs and MCP servers from one codebase. Define a Zod schema once on a decorator and it becomes your request validation, OpenAPI 3.1 spec, MCP tool, and a codegen-free typed client ā all from the same DI container. AI coding agents get a real contract to build against, so they can't drift into a second source of truth or a mismatched endpoint. Best practice becomes the path of least resistance. On npm today.

Hey Product Hunt š
AgentBack is a TypeScript framework for backends whose first reader is an agent, not a human.
Modern services aren't consumed only by web and mobile apps anymore ā they're consumed by AI agents that discover tools, inspect schemas, call APIs, retry failures, and chain them into longer workflows. That raises the stakes on drift: a stale OpenAPI doc or tool manifest used to be a documentation bug; for an agent it's a runtime bug ā it picks the wrong tool, sends the wrong body, misses an auth requirement, or trusts a response shape that's gone.
So AgentBack bets everything on one Zod schema per operation. To an agent that schema is three things at once: knowledge (the contract is the only documentation a model reliably reads), a constraint (a validated boundary stops a hallucinated argument before it reaches your handler), and a contract (stable, diffable, testable). Define it once and it becomes your REST validation, OpenAPI 3.1, the MCP tool definition, a codegen-free typed client, your tests, and agent-readable surfaces like /llms.txt ā served by default, never out of sync.
Two things I cared about getting right:
⢠Tools are not endpoints. A route never becomes an MCP tool by accident ā exposing one is opt-in, so you ship the 3 outcome-level operations an agent actually needs instead of auto-generating 80 CRUD tools that blow the model's context budget.
⢠Errors agents can fix. Failures come back as a structured envelope a model can read and correct against, not an opaque 500.
Schema-first lost to code-first once, because rigorous schemas were tedious and we're all a little lazy. The economics flipped: agents are tireless, so when the agent writes and maintains the schema the cost of rigor drops to near zero while its value goes up.
It's a refresh of LoopBack (which I co-created 13 years ago) for the agent era, on the DI core I know best. Alpha, on npm today: npm create agentback my-service. Would love feedback from anyone building agent-facing APIs or MCP servers.
Quick update since launch day ā a lot has shipped:
⢠MCP Apps (SEP-1865): a tool can declare a ui: option that links a ui:// widget conformant hosts (Claude Desktop, Goose, VS Code) render inline for the tool's result ā interactive UI straight from a tool call.
⢠First-class file uploads/downloads: declare a fileField() in a route's body schema and one line drives the whole chain ā multipart parsing (streamed to a FileStore under a server-generated key, so no client-controlled paths), OpenAPI format: binary emission, and streaming downloads. In-memory, filesystem, and S3 adapters included.
⢠Session/user-scoped MCP over Streamable HTTP ā each session can get its own DI-scoped server, so per-user tool surfaces.
⢠Front-mounted middleware chain + configurable body parsing (CORS, rate-limiting, JSON/urlencoded/text/raw on one group model).
⢠Now on Express 5.
Still alpha, still one schema -> every boundary. Repo + docs: github.com/ninemindai/agentback ā feedback very welcome.
If you'd rather poke at it than install anything:
⢠Live demo: agentback-demo.vercel.app ā a real AgentBack app (REST + MCP + the dev console, all generated from one set of Zod schemas).
⢠Source: github.com/ninemindai/agentback (the framework + runnable examples) and github.com/ninemindai/agentback-demo (the demo's code).
Or run: npm create agentback my-service ā to scaffold your own in seconds.