← Back to archive

Repo of the Day

mastra-ai/mastra: From the team behind Gatsby, Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

Published: Jun 21, 2026

Open repository ↗

From the team behind Gatsby, Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack. - mastra-ai/mastra

Summary

Mastra is a TypeScript framework for building AI-powered applications and agents. It combines model routing, agent and workflow primitives, retrieval, memory, MCP server authoring, and production tooling behind one interface aimed at Node and frontend stacks.

What it is useful for

Mastra targets engineers who want to ship AI features without wiring up separate libraries for each provider and orchestration pattern. Concrete uses described in the README include:

  • Building autonomous agents that decide which tools to call and iterate internally until it emits a final answer or an optional stopping condition is met.
  • Orchestrating multi-step processes via a graph-based workflow engine with explicit control-flow methods like .then(), .branch(), and .parallel().
  • Implementing human-in-the-loop flows by suspending a workflow or agent and resuming later, with execution state persisted to storage so pauses can be indefinite.
  • Adding context through retrieval, plus conversation history and Observational Memory for coherent multi-turn behavior.
  • Authoring Model Context Protocol (MCP) servers that expose agents, tools, and structured resources to other MCP-compatible clients.
  • Connecting to model providers through one standard interface (OpenAI, Anthropic, and Gemini are named in the README; the router lists 40+ providers).
  • Integrating with React, Next.js, or Node.js apps, or running as standalone servers, with hooks for Vercel's AI SDK UI and CopilotKit on the UI side.

Built-in evals and observability are included for measuring and refining agents over time.

How engineers can use it

The README's recommended starting point is npm create mastra@latest, which scaffolds a new project. An alternative command shown in the README accepts a project name plus a --llm flag, where supported providers are openai, anthropic, google, and xai. The scaffold also installs Mastra skills for detected coding assistants and initializes Git when appropriate.

To run the project, the README documents starting the dev server with npx bgproc start -n <project-name> -w -- npm run dev and opening Mastra Studio at http://localhost:4111 for building, testing, and managing agents, workflows, and tools. The README does not include a full manual install procedure; engineers who want one should follow the Installation guide in the official docs at mastra.ai/docs.

A documented limitation to plan around: the repository uses a dual-license model. Most code is Apache License 2.0, but anything under an ee/ directory is source-available under the Mastra Enterprise License and requires a valid enterprise license for production use, while remaining usable for development and testing. Teams using those enterprise modules should confirm licensing before shipping.