Summary: On October 20, 2026, Mastra announced on X that it released a test suite letting custom server adapters run the same conformance tests as the framework’s official adapters. If you’ve ever wired Mastra into a framework outside its prebuilt list, this is the difference between “works on my machine” and verifiable parity. Here’s what the docs say about how adapters work and why a shared test suite matters for how you ship one.
The problem adapters create
Mastra’s server layer ships with prebuilt adapters for Hono, Express, Fastify, and Koa. According to the custom adapters documentation, you write a custom adapter when none of those fit your framework, or when you have specific request/response handling requirements — say, an internal framework or unusual middleware conventions.
The catch: an adapter isn’t glue code you can eyeball. It translates Mastra’s route definitions into your framework’s routing system, and it touches the entire request lifecycle. Miss one step and agents fail in ways that only show up under real traffic.
What you actually implement
The docs describe a MastraServer abstract class from @mastra/server/server-adapter that takes three type parameters — your framework’s app, request, and response types — and requires six abstract methods:
registerContextMiddleware()attaches the Mastra instance, request context, tools, and an abort signal to every incoming request.registerAuthMiddleware()wires authentication and authorization, and should skip registration entirely when auth isn’t configured.registerRoute()connects each Mastra route — path, method, handler, Zod validation schemas — to your framework.getParams()normalizes how URL params, query params, and the body are extracted.sendResponse()routes by response type: JSON, streams for agent generation, AI SDK responses, and MCP HTTP or SSE transports.stream()handles agent generation output, optionally applying redaction before writing SSE or newline-delimited JSON chunks.
That’s a lot of surface area. Repeated query keys become arrays, streams need the right headers, MCP transports need their own handling. Each is a place where two adapters can silently diverge.
Why the shared test suite changes the calculus
Before this release, if you wrote a custom adapter, you were on your own to verify it behaved like @mastra/hono or @mastra/express. The conformance suite turns that from a manual checklist into a runnable gate: the same tests that validate official adapters now validate yours.
This matters most when you’re deciding whether a custom adapter is worth building at all. With prebuilt options covering four frameworks and a conformance suite de-risking the rest, the tradeoff shifts from “hope it works” to “run the suite.” It also makes upgrades safer — if Mastra tightens behavior in a route handler, conformance failures point at exactly which contract your adapter broke.
There’s a broader pattern here worth noticing. Agent frameworks are converging on the idea that standard interfaces need standard verification, not just standard shapes. Vercel’s eve framework, for example, standardizes the shape of agents themselves, while Mastra is standardizing how you prove an integration matches the spec. Shape plus conformance is what turns an ecosystem from a set of libraries into something you can build against with confidence.
A practical next step
If you’re already running a custom Mastra adapter, wire the conformance suite into CI before your next framework or Mastra version bump. If you’re on a prebuilt adapter, this mostly means you have a cleaner escape hatch — the docs make the six-method contract explicit, and the shared tests make leaving the happy path far less risky than it used to be.
Sources
- Mastra on X: We released a test suite so your custom adapter can run the same conformance tes
- Custom adapters | Server | Mastra Docs
View the original post on X
