# AI use cases for Mastra (mastra-ai/mastra)

Repo: [mastra-ai/mastra](https://github.com/mastra-ai/mastra) | Use cases: 3 | Page: https://dedupedai.com/use-cases/mastra-ai-mastra/

Mastra is a TypeScript framework for building AI applications and agents. It routes to 40+ model providers through one interface, runs autonomous agents with tools, orchestrates multi-step graph workflows with then, branch and parallel, and can suspend for human approval and resume from storage. It adds memory, RAG, MCP server authoring, evals and observability, and Mastra Studio for building and testing agents locally.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Start a TypeScript agent project with Mastra Studio: https://dedupedai.com/use-cases/mastra-ai-mastra/start-a-mastra-agent-project/
- Build a multi-step workflow that waits for approval: https://dedupedai.com/use-cases/mastra-ai-mastra/build-a-mastra-workflow-with-approval/
- Publish your agents and tools as an MCP server: https://dedupedai.com/use-cases/mastra-ai-mastra/publish-mastra-agents-as-an-mcp-server/

## How to start a TypeScript agent project with Mastra Studio with Mastra

Repo: [mastra-ai/mastra](https://github.com/mastra-ai/mastra) | Difficulty: Beginner | Time: 20 minutes | Basis: From the README

Scaffold a Mastra project with one command and build and test agents in Mastra Studio.

**Who it is for:** A JavaScript developer who wants to try agents without leaving the TypeScript stack.

**The problem:** Most agent frameworks are Python-first, which leaves TypeScript teams wiring things together themselves.

**The outcome:** A new Mastra project with a dev server and Mastra Studio at localhost:4111 for testing agents, workflows and tools.

### Steps

1. Run `npm create mastra@latest` and follow the prompts
2. Choose a project name and a provider such as openai, anthropic, google or xai
3. Enter the project directory and start the dev server
4. Open Mastra Studio at http://localhost:4111 to build, test and manage agents, workflows and tools
5. Use the templates and course from the docs if you are new to agents

### Prompt to paste into your agent

```text
Create a new Mastra project with npm create mastra@latest using <provider>, start the dev server, and build an agent in it that <describe job>. Test it in Mastra Studio and show me the result.
```

### Caveat

Code in any ee/ directory is under the Mastra Enterprise License and needs a license for production use.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/mastra-ai-mastra/start-a-mastra-agent-project/

## How to build a multi-step workflow that waits for approval with Mastra

Repo: [mastra-ai/mastra](https://github.com/mastra-ai/mastra) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Use Mastra's graph workflows and suspend and resume to pause for a person before continuing.

**Who it is for:** A product team automating a multi-step process where one step needs a human yes before it runs.

**The problem:** Agent-only automations either run risky steps unchecked or need custom state handling to pause.

**The outcome:** A workflow built with then, branch and parallel that suspends, stores its state and resumes after approval.

### Steps

1. Scaffold a project with `npm create mastra@latest`
2. Define the steps and chain them with .then(), .branch() and .parallel()
3. Add a suspend point before the sensitive step, following the suspend-and-resume docs
4. Configure storage so execution state is remembered while paused
5. Resume the workflow when the user approves

### Prompt to paste into your agent

```text
Using mastra-ai/mastra, build a workflow that <step 1>, then <step 2>, and suspends for my approval before <step 3>. Store its state so it can resume later, and test the full path in Mastra Studio.
```

### Caveat

The README links to the docs for workflow code, so plan to follow the Workflows and suspend-and-resume pages.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/mastra-ai-mastra/build-a-mastra-workflow-with-approval/

## How to publish your agents and tools as an MCP server with Mastra

Repo: [mastra-ai/mastra](https://github.com/mastra-ai/mastra) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Author an MCP server in Mastra so other systems and agents can use what you built.

**Who it is for:** A developer whose Mastra agent should be callable from Claude, Cursor or another team's agent.

**The problem:** Each new client needs its own integration, so useful agents stay locked inside one app.

**The outcome:** Agents, tools and resources exposed through the MCP interface for any client that supports it.

### Steps

1. Build your agent and tools in a Mastra project created with `npm create mastra@latest`
2. Follow the MCP servers docs to author a server exposing them
3. Connect an MCP client to the server and call the tools
4. Add evals and observability to watch how external callers use it

### Prompt to paste into your agent

```text
Using mastra-ai/mastra, expose my <agent> and <tools> as an MCP server, connect it to <MCP client>, and call each tool once to confirm it works.
```

### Caveat

Anything exposed over MCP can be called by the connected client, so expose only the tools you mean to share.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/mastra-ai-mastra/publish-mastra-agents-as-an-mcp-server/
