@mastra/mcp-docs-server 0.13.17-alpha.3 → 0.13.17-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +25 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +19 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
  4. package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
  6. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
  7. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +26 -26
  8. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
  9. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
  10. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +11 -11
  11. package/.docs/organized/changelogs/%40mastra%2Fcore.md +46 -46
  12. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +19 -0
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +25 -25
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +11 -11
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +12 -12
  17. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +33 -33
  18. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +11 -11
  19. package/.docs/organized/changelogs/%40mastra%2Fevals.md +19 -19
  20. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
  21. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +20 -20
  22. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +19 -19
  23. package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
  24. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
  25. package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
  26. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +27 -27
  27. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +20 -20
  28. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +19 -19
  29. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +10 -10
  30. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +24 -24
  31. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +11 -11
  32. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -5
  33. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
  34. package/.docs/organized/changelogs/%40mastra%2Fpg.md +19 -19
  35. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
  36. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +34 -34
  37. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +13 -13
  38. package/.docs/organized/changelogs/%40mastra%2Frag.md +10 -10
  39. package/.docs/organized/changelogs/%40mastra%2Fragie.md +19 -19
  40. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +13 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fserver.md +25 -25
  42. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +11 -11
  43. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +10 -10
  44. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +10 -10
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +10 -10
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +10 -10
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +19 -0
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +19 -19
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
  55. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
  56. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
  57. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
  58. package/.docs/organized/changelogs/create-mastra.md +13 -13
  59. package/.docs/organized/changelogs/mastra.md +31 -31
  60. package/.docs/organized/code-examples/a2a.md +1 -1
  61. package/.docs/organized/code-examples/agent-network.md +1 -1
  62. package/.docs/organized/code-examples/agent.md +22 -1
  63. package/.docs/organized/code-examples/agui.md +1 -1
  64. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
  65. package/.docs/organized/code-examples/ai-sdk-v5.md +2 -2
  66. package/.docs/organized/code-examples/assistant-ui.md +3 -3
  67. package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
  68. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -1
  69. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
  70. package/.docs/organized/code-examples/client-side-tools.md +1 -1
  71. package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
  72. package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -1
  73. package/.docs/organized/code-examples/fireworks-r1.md +1 -1
  74. package/.docs/organized/code-examples/heads-up-game.md +32 -56
  75. package/.docs/organized/code-examples/mcp-configuration.md +2 -2
  76. package/.docs/organized/code-examples/mcp-registry-registry.md +1 -1
  77. package/.docs/organized/code-examples/memory-with-mem0.md +1 -1
  78. package/.docs/organized/code-examples/memory-with-processors.md +1 -1
  79. package/.docs/organized/code-examples/openapi-spec-writer.md +2 -2
  80. package/.docs/organized/code-examples/quick-start.md +1 -1
  81. package/.docs/organized/code-examples/stock-price-tool.md +1 -1
  82. package/.docs/organized/code-examples/weather-agent.md +1 -1
  83. package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
  84. package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
  85. package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
  86. package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
  87. package/.docs/organized/code-examples/workflow-with-suspend-resume.md +1 -1
  88. package/.docs/raw/agents/overview.mdx +35 -4
  89. package/.docs/raw/deployment/monorepo.mdx +1 -1
  90. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +44 -14
  91. package/.docs/raw/getting-started/installation.mdx +52 -4
  92. package/.docs/raw/getting-started/templates.mdx +2 -22
  93. package/.docs/raw/reference/agents/generate.mdx +2 -2
  94. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +2 -1
  95. package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +1 -1
  96. package/.docs/raw/reference/agents/stream.mdx +2 -2
  97. package/.docs/raw/reference/cli/build.mdx +0 -6
  98. package/.docs/raw/reference/cli/start.mdx +8 -1
  99. package/.docs/raw/reference/scorers/noise-sensitivity.mdx +237 -0
  100. package/.docs/raw/reference/scorers/prompt-alignment.mdx +369 -0
  101. package/.docs/raw/scorers/off-the-shelf-scorers.mdx +2 -2
  102. package/.docs/raw/streaming/overview.mdx +2 -2
  103. package/.docs/raw/streaming/tool-streaming.mdx +8 -2
  104. package/.docs/raw/streaming/workflow-streaming.mdx +8 -2
  105. package/.docs/raw/tools-mcp/overview.mdx +44 -0
  106. package/.docs/raw/workflows/overview.mdx +19 -17
  107. package/.docs/raw/workflows/suspend-and-resume.mdx +64 -7
  108. package/CHANGELOG.md +1813 -0
  109. package/dist/stdio.js +18 -1
  110. package/dist/tools/blog.d.ts.map +1 -1
  111. package/dist/tools/docs.d.ts.map +1 -1
  112. package/package.json +17 -7
@@ -126,16 +126,10 @@ export const mastra = new Mastra({
126
126
  ```typescript
127
127
  import { createWorkflow, createStep } from '@mastra/core/workflows';
128
128
  import { z } from 'zod';
129
- import { Pool } from 'pg';
130
-
131
- // PostgreSQL client
132
- const pool = new Pool({
133
- connectionString: process.env.DATABASE_URL!,
134
- });
135
129
 
136
130
  const startStep = createStep({
137
131
  id: 'start-step',
138
- description: "Generate a famous person's name",
132
+ description: 'Get the name of a famous person',
139
133
  inputSchema: z.object({
140
134
  start: z.boolean(),
141
135
  }),
@@ -169,7 +163,7 @@ const gameStep = createStep({
169
163
  userMessage: z.string(),
170
164
  }),
171
165
  suspendSchema: z.object({
172
- agentResponse: z.string(),
166
+ suspendResponse: z.string(),
173
167
  }),
174
168
  outputSchema: z.object({
175
169
  famousPerson: z.string(),
@@ -181,52 +175,36 @@ const gameStep = createStep({
181
175
  let { famousPerson, guessCount } = inputData;
182
176
  const { userMessage } = resumeData ?? {};
183
177
 
178
+ // Return suspend with message to inform the user
184
179
  if (!userMessage) {
185
- // First time - ask for a question
186
- const message = "I'm thinking of a famous person. Ask me yes/no questions to figure out who it is!";
187
-
188
- await suspend({
189
- agentResponse: message,
180
+ return await suspend({
181
+ suspendResponse: "I'm thinking of a famous person. Ask me yes/no questions to figure out who it is!",
190
182
  });
191
-
192
- return { famousPerson, gameWon: false, agentResponse: message, guessCount };
193
- } else {
194
- // Check if the user's message is a guess by using the guess verifier agent
195
- const guessVerifier = mastra.getAgent('guessVerifierAgent');
196
- const verificationResponse = await guessVerifier.generate(
197
- [
198
- {
199
- role: 'user',
200
- content: `Actual famous person: ${famousPerson}
201
- User's guess: "${userMessage}"
202
- Is this correct?`,
203
- },
204
- ],
205
- {
206
- output: z.object({
207
- isCorrect: z.boolean(),
208
- }),
209
- },
210
- );
211
-
212
- const gameWon = verificationResponse.object.isCorrect;
213
-
214
- // Let the agent handle the user's message (question or guess)
215
- const agent = mastra.getAgent('gameAgent');
216
- const response = await agent.generate(`
217
- The famous person is: ${famousPerson}
218
- The user asked: "${userMessage}"
219
- Is this a correct guess: ${gameWon}
220
- Please respond appropriately.
221
- `);
222
-
223
- const agentResponse = response.text;
224
-
225
- // Increment the guess count
226
- guessCount++;
227
-
228
- return { famousPerson, gameWon, agentResponse, guessCount };
229
183
  }
184
+
185
+ // Let the agent handle the user's message (question or guess)
186
+ const agent = mastra.getAgent('gameAgent');
187
+ const response = await agent.generate(
188
+ `
189
+ The famous person is: ${famousPerson}
190
+ The user said: "${userMessage}"
191
+ Please respond appropriately. If this is a guess, tell me if it's correct.
192
+ `,
193
+ {
194
+ output: z.object({
195
+ response: z.string(),
196
+ gameWon: z.boolean(),
197
+ }),
198
+ },
199
+ );
200
+
201
+ // Values from structured output object
202
+ const { response: agentResponse, gameWon } = response.object;
203
+
204
+ // Increment the guess count
205
+ guessCount++;
206
+
207
+ return { famousPerson, gameWon, agentResponse, guessCount };
230
208
  },
231
209
  });
232
210
 
@@ -247,11 +225,9 @@ const winStep = createStep({
247
225
  execute: async ({ inputData }) => {
248
226
  const { famousPerson, gameWon, guessCount } = inputData;
249
227
 
250
- await pool.query('INSERT INTO heads_up_games (famous_person, game_won, guess_count) VALUES ($1, $2, $3)', [
251
- famousPerson,
252
- gameWon,
253
- guessCount,
254
- ]);
228
+ console.log('famousPerson: ', famousPerson);
229
+ console.log('gameWon: ', gameWon);
230
+ console.log('guessCount: ', guessCount);
255
231
 
256
232
  return { famousPerson, gameWon, guessCount };
257
233
  },
@@ -9,8 +9,8 @@
9
9
  "@mastra/memory": "latest",
10
10
  "@modelcontextprotocol/sdk": "^1.13.0",
11
11
  "chalk": "^5.4.1",
12
- "zod": "^3.25.67",
13
- "zod-to-json-schema": "^3.24.5"
12
+ "zod": "^3.25.76",
13
+ "zod-to-json-schema": "^3.24.6"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@jest/globals": "^29.7.0",
@@ -7,7 +7,7 @@
7
7
  "@mastra/core": "latest",
8
8
  "@mastra/mcp": "latest",
9
9
  "@mastra/mcp-registry-registry": "latest",
10
- "zod": "^3.25.67"
10
+ "zod": "^3.25.76"
11
11
  }
12
12
  }
13
13
  ```
@@ -6,7 +6,7 @@
6
6
  "@ai-sdk/openai": "latest",
7
7
  "@mastra/core": "latest",
8
8
  "@mastra/mem0": "latest",
9
- "zod": "^3.25.67"
9
+ "zod": "^3.25.76"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^22.15.29",
@@ -12,7 +12,7 @@
12
12
  "js-tiktoken": "^1.0.13",
13
13
  "tiktoken": "^1.0.13",
14
14
  "tsx": "^4.6.2",
15
- "zod": "^3.25.67"
15
+ "zod": "^3.25.76"
16
16
  }
17
17
  }
18
18
  ```
@@ -16,7 +16,7 @@
16
16
  "class-variance-authority": "^0.7.1",
17
17
  "clsx": "^2.1.1",
18
18
  "lucide-react": "^0.454.0",
19
- "next": "15.2.4",
19
+ "next": "15.4.7",
20
20
  "react": "^19.1.1",
21
21
  "react-dom": "^19.1.1",
22
22
  "react-syntax-highlighter": "^15.6.1",
@@ -24,7 +24,7 @@
24
24
  "tailwind-merge": "^2.6.0",
25
25
  "tailwindcss-animate": "^1.0.7",
26
26
  "vaul": "^1.1.2",
27
- "zod": "^3.25.67"
27
+ "zod": "^3.25.76"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@libsql/client": "^0.15.4",
@@ -6,7 +6,7 @@
6
6
  "@types/node": "^20.17.57",
7
7
  "tsx": "^4.19.3",
8
8
  "typescript": "^5.8.3",
9
- "zod": "^3.25.67"
9
+ "zod": "^3.25.76"
10
10
  },
11
11
  "dependencies": {
12
12
  "@ai-sdk/anthropic": "^1.2.12",
@@ -5,7 +5,7 @@
5
5
  "dependencies": {
6
6
  "@ai-sdk/openai": "latest",
7
7
  "@mastra/core": "latest",
8
- "zod": "^3.25.67"
8
+ "zod": "^3.25.76"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@jest/globals": "^29.7.0",
@@ -6,7 +6,7 @@
6
6
  "@ai-sdk/openai": "^1.3.24",
7
7
  "@mastra/core": "latest",
8
8
  "@mastra/libsql": "latest",
9
- "zod": "^3.25.67"
9
+ "zod": "^3.25.76"
10
10
  }
11
11
  }
12
12
  ```
@@ -7,7 +7,7 @@
7
7
  "mastra": "latest",
8
8
  "tsx": "^4.19.3",
9
9
  "typescript": "^5.8.3",
10
- "zod": "^3.25.67"
10
+ "zod": "^3.25.76"
11
11
  },
12
12
  "dependencies": {
13
13
  "@ai-sdk/openai": "latest",
@@ -7,7 +7,7 @@
7
7
  "mastra": "latest",
8
8
  "tsx": "^4.19.3",
9
9
  "typescript": "^5.8.3",
10
- "zod": "^3.25.67"
10
+ "zod": "^3.25.76"
11
11
  },
12
12
  "dependencies": {
13
13
  "@mastra/core": "latest"
@@ -6,7 +6,7 @@
6
6
  "@types/node": "^20.17.57",
7
7
  "tsx": "^4.19.3",
8
8
  "typescript": "^5.8.3",
9
- "zod": "^3.25.67"
9
+ "zod": "^3.25.76"
10
10
  },
11
11
  "dependencies": {
12
12
  "@ai-sdk/openai": "latest",
@@ -7,7 +7,7 @@
7
7
  "mastra": "latest",
8
8
  "tsx": "^4.19.3",
9
9
  "typescript": "^5.8.3",
10
- "zod": "^3.25.67"
10
+ "zod": "^3.25.76"
11
11
  },
12
12
  "dependencies": {
13
13
  "@mastra/core": "latest"
@@ -7,7 +7,7 @@
7
7
  "mastra": "latest",
8
8
  "tsx": "^4.19.3",
9
9
  "typescript": "^5.8.3",
10
- "zod": "^3.25.67"
10
+ "zod": "^3.25.76"
11
11
  },
12
12
  "dependencies": {
13
13
  "@mastra/core": "latest",
@@ -3,6 +3,8 @@ title: "Agent Overview | Agent Documentation | Mastra"
3
3
  description: Overview of agents in Mastra, detailing their capabilities and how they interact with tools, workflows, and external systems.
4
4
  ---
5
5
 
6
+ import { Steps } from "nextra/components";
7
+
6
8
  # Using Agents
7
9
 
8
10
  Agents let you build intelligent assistants powered by language models that can make decisions and perform actions. Each agent has required instructions and an LLM, with optional tools and memory.
@@ -261,14 +263,43 @@ const response = await testAgent.generate("Help me organize my day", {
261
263
  ```
262
264
 
263
265
  ## Testing agents locally
266
+ There are two ways to run and test agents.
267
+
268
+ <Steps>
269
+
270
+ ### Mastra Playground
264
271
 
265
- Use the `mastra dev` CLI command to run your agents behind a local API.
266
- By default, it loads exported agents from the `src/mastra/agents` directory and creates endpoints for testing (for example, `http://localhost:4111/api/agents/myAgent/generate`).
267
- It also launches a visual playground where you can chat with your agent and view execution traces.
272
+ With the Mastra Dev Server running you can test an agent from the Mastra Playground by visiting [http://localhost:4111/agents](http://localhost:4111/agents) in your browser.
268
273
 
269
274
  > For more information, see the [Local Dev Playground](/docs/server-db/local-dev-playground) documentation.
270
275
 
271
- ## Next Steps
276
+ ### Command line
277
+
278
+ Create an agent response using `.generate()` or `.stream()`.
279
+
280
+ ```typescript {7} filename="src/test-agent.ts" showLineNumbers copy
281
+ import "dotenv/config";
282
+
283
+ import { mastra } from "./mastra";
284
+
285
+ const agent = mastra.getAgent("testAgent");
286
+
287
+ const response = await agent.generate("Help me organize my day");
288
+
289
+ console.log(response.text);
290
+ ```
291
+
292
+ > See [.generate()](../../reference/agents/generate.mdx) or [.stream()](../../reference/agents/stream.mdx) for more information.
293
+
294
+ To test this agent, run the following:
295
+
296
+ ```bash copy
297
+ npx tsx src/test-agent.ts
298
+ ```
299
+
300
+ </Steps>
301
+
302
+ ## Related
272
303
 
273
304
  - [Agent Memory](./agent-memory.mdx)
274
305
  - [Dynamic Agents](./dynamic-agents.mdx)
@@ -102,6 +102,6 @@ Mastra works with:
102
102
  Known limitations:
103
103
 
104
104
  - Bun workspaces — partial support; known issues
105
- - Nx — known issues
105
+ - Nx — You can use Nx's [supported dependency strategies](https://nx.dev/concepts/decisions/dependency-management) but you need to have `package.json` files inside your workspace packages
106
106
 
107
107
  > If you are experiencing issues with monorepos see our: [Monorepos Support mega issue](https://github.com/mastra-ai/mastra/issues/6852).
@@ -76,7 +76,7 @@ import { useChat } from "@ai-sdk/react";
76
76
 
77
77
  export function Chat() {
78
78
  const { messages, input, handleInputChange, handleSubmit } = useChat({
79
- api: "api/chat"
79
+ api: "/api/chat"
80
80
  });
81
81
  return (
82
82
  <div>
@@ -432,22 +432,52 @@ This utility is helpful when you want to fetch messages directly from your stora
432
432
 
433
433
  ### Enabling stream compatibility
434
434
 
435
- To enable AI SDK v5 compatibility, use the experimental `streamVNext` method with the `format` parameter:
435
+ To enable AI SDK v5 compatibility, use the `@mastra/ai-sdk` package:
436
436
 
437
- ```typescript filename="app/api/chat/route.ts" showLineNumbers copy
438
- import { mastra } from "../../../mastra";
437
+ <Tabs items={["npm", "yarn", "pnpm", "bun"]}>
438
+ <Tabs.Tab>
439
+ ```bash copy
440
+ npm install @mastra/ai-sdk
441
+ ```
442
+ </Tabs.Tab>
443
+ <Tabs.Tab>
444
+ ```bash copy
445
+ yarn add @mastra/ai-sdk
446
+ ```
447
+ </Tabs.Tab>
448
+ <Tabs.Tab>
449
+ ```bash copy
450
+ pnpm add @mastra/ai-sdk
451
+ ```
452
+ </Tabs.Tab>
453
+ <Tabs.Tab>
454
+ ```bash copy
455
+ bun add @mastra/ai-sdk
456
+ ```
457
+ </Tabs.Tab>
458
+ </Tabs>
439
459
 
440
- export async function POST(req: Request) {
441
- const { messages } = await req.json();
442
- const myAgent = mastra.getAgent("weatherAgent");
443
-
444
- // Use streamVNext with AI SDK v5 format (experimental)
445
- const stream = await myAgent.streamVNext(messages, {
446
- format: 'aisdk'
447
- });
460
+ ```typescript filename="src/mastra/index.ts" showLineNumbers copy
461
+ export const mastra = new Mastra({
462
+ server: {
463
+ apiRoutes: [
464
+ chatRoute({
465
+ path: '/chat',
466
+ agent: 'weatherAgent',
467
+ }),
468
+ ],
469
+ },
470
+ });
471
+ ```
448
472
 
449
- return stream.toUIMessageStreamResponse();
450
- }
473
+ In your application call the `useChat()` hook.
474
+ ```typescript
475
+ const { error, status, sendMessage, messages, regenerate, stop } =
476
+ useChat({
477
+ transport: new DefaultChatTransport({
478
+ api: 'http://localhost:4111/api/chat',
479
+ }),
480
+ });
451
481
  ```
452
482
 
453
483
  <Callout type="info">
@@ -22,6 +22,10 @@ Mastra also supports other LLM providers. For a full list of supported models an
22
22
 
23
23
  Our CLI is the fastest way to get started with Mastra. You can run `create mastra` anywhere on your machine.
24
24
 
25
+ <Callout type="warning">
26
+ The CLI currently generates projects that are only compatible with `ai-sdk v4`. Please refer to [ai-sdk v5 compatibility](#ai-sdk-v5-compatibility) if you wish to use `ai-sdk v5`.
27
+ </Callout>
28
+
25
29
  <Steps>
26
30
 
27
31
  ## Start the CLI wizard
@@ -171,7 +175,7 @@ This helps users manually set up a Mastra project with their preferred package m
171
175
 
172
176
  npm install typescript tsx @types/node mastra@latest --save-dev
173
177
 
174
- npm install @mastra/core@latest zod@^3 @ai-sdk/openai
178
+ npm install @mastra/core@latest zod@^3 @ai-sdk/openai@^1
175
179
  ```
176
180
 
177
181
  </Tab>
@@ -181,7 +185,7 @@ This helps users manually set up a Mastra project with their preferred package m
181
185
 
182
186
  pnpm add typescript tsx @types/node mastra@latest --save-dev
183
187
 
184
- pnpm add @mastra/core@latest zod@^3 @ai-sdk/openai
188
+ pnpm add @mastra/core@latest zod@^3 @ai-sdk/openai@^1
185
189
  ```
186
190
 
187
191
  </Tab>
@@ -191,7 +195,7 @@ This helps users manually set up a Mastra project with their preferred package m
191
195
 
192
196
  yarn add typescript tsx @types/node mastra@latest --dev
193
197
 
194
- yarn add @mastra/core@latest zod@^3 @ai-sdk/openai
198
+ yarn add @mastra/core@latest zod@^3 @ai-sdk/openai@^1
195
199
  ```
196
200
 
197
201
  </Tab>
@@ -201,7 +205,7 @@ This helps users manually set up a Mastra project with their preferred package m
201
205
 
202
206
  bun add typescript tsx @types/node mastra@latest --dev
203
207
 
204
- bun add @mastra/core@latest zod@^3 @ai-sdk/openai
208
+ bun add @mastra/core@latest zod@^3 @ai-sdk/openai@^1
205
209
  ```
206
210
 
207
211
  </Tab>
@@ -372,6 +376,50 @@ To install Mastra in an existing project, use the `mastra init` command.
372
376
 
373
377
  > See [mastra init](/reference/cli/init) for more information.
374
378
 
379
+ ## ai-sdk v5 compatibility
380
+
381
+ By default, Mastra projects are only compatible with `ai-sdk v4`, if you wish to use `ai-sdk v5`, please make the following changes to the generated project.
382
+
383
+ Install the latest version to the `@ai-sdk/openai` package:
384
+ <Tabs items={["npm", "pnpm", "yarn", "bun"]}>
385
+
386
+ <Tab>
387
+ ```bash copy
388
+ npm install @ai-sdk/openai@latest
389
+ ```
390
+
391
+ </Tab>
392
+ <Tab>
393
+ ```bash copy
394
+ pnpm add @ai-sdk/openai@latest
395
+ ```
396
+
397
+ </Tab>
398
+ <Tab>
399
+ ```bash copy
400
+ yarn add @ai-sdk/openai@latest
401
+ ```
402
+
403
+ </Tab>
404
+ <Tab>
405
+ ```bash copy
406
+ bun add @ai-sdk/openai@latest
407
+ ```
408
+
409
+ </Tab>
410
+ </Tabs>
411
+
412
+ Update the `planActivities` step in `src/mastra/workflows/weather-workflow.ts` as follow:
413
+ ```ts filename="src/mastra/workflows/weather-workflow.ts" showLineNumbers{150} copy
414
+ const response = await agent.stream([ // [!code --]
415
+ const response = await agent.streamVNext([ // [!code ++]
416
+ {
417
+ role: 'user',
418
+ content: prompt,
419
+ },
420
+ ]);
421
+ ```
422
+
375
423
  ## Next steps
376
424
 
377
425
  - [Local Development](/docs/server-db/local-dev-playground)
@@ -8,16 +8,7 @@ import { Tabs, Tab } from "@/components/tabs";
8
8
 
9
9
  # Templates
10
10
 
11
- Templates are pre-built Mastra projects that demonstrate specific use cases and patterns. They provide working examples you can run immediately and customize for your needs.
12
-
13
- ## What Templates Offer
14
-
15
- Templates include:
16
-
17
- - **Complete working examples** - Functional code demonstrating specific patterns
18
- - **Best practices** - Proper project structure and Mastra conventions
19
- - **Educational value** - Learn different Mastra features through examples
20
- - **Quick start** - Bootstrap projects faster than starting from scratch
11
+ Templates are pre-built Mastra projects that demonstrate specific use cases and patterns. Browse available templates in the [templates directory](https://mastra.ai/templates).
21
12
 
22
13
  ## Using Templates
23
14
 
@@ -81,15 +72,4 @@ After installation:
81
72
  Each template includes a comprehensive README with specific setup instructions and usage examples.
82
73
  </Callout>
83
74
 
84
- ## Available Templates
85
-
86
- Browse available templates in the [templates directory](https://mastra.ai/templates).
87
-
88
- ## Next Steps
89
-
90
- - **Explore code** - Understand how templates implement functionality
91
- - **Customize** - Modify agents, tools, and workflows for your use case
92
- - **Learn patterns** - Study templates to understand Mastra best practices
93
- - **Contribute** - Create your own templates for the community
94
-
95
- For detailed information on creating templates, see the [Templates Reference](/reference/templates).
75
+ For detailed information on creating templates, see the [Templates Reference](/reference/templates).
@@ -490,5 +490,5 @@ await agent.generate(
490
490
 
491
491
  ## Related
492
492
 
493
- - [Agent generation](../../docs/agents/overview.mdx#generate)
494
- - [Streaming responses](../../docs/agents/streaming.mdx)
493
+ - [Generating responses](../../docs/agents/overview.mdx#generating-responses)
494
+ - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
@@ -63,5 +63,6 @@ await agent.getDefaultStreamOptions({
63
63
 
64
64
  ## Related
65
65
 
66
- - [Agent streaming](../../docs/agents/streaming.mdx)
66
+ - [Generating responses](../../docs/agents/overview.mdx#generating-responses)
67
+ - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
67
68
  - [Runtime variables](../../docs/agents/runtime-variables.mdx)
@@ -63,5 +63,5 @@ await agent.getDefaultVNextStreamOptions({
63
63
 
64
64
  ## Related
65
65
 
66
- - [Agent streaming](../../docs/agents/streaming.mdx)
66
+ - [Streaming with agents](../../docs/streaming/overview.mdx#streaming-with-agents)
67
67
  - [Runtime variables](../../docs/agents/runtime-variables.mdx)
@@ -475,5 +475,5 @@ await agent.stream("message for agent", {
475
475
 
476
476
  ## Related
477
477
 
478
- - [Agent streaming](../../docs/agents/streaming.mdx)
479
- - [Agent generation](../../docs/agents/overview.mdx#generate)
478
+ - [Generating responses](../../docs/agents/overview.mdx#generating-responses)
479
+ - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
@@ -35,12 +35,6 @@ mastra build [options]
35
35
  description: "Comma-separated list of paths to tool files to include",
36
36
  isOptional: true,
37
37
  },
38
- {
39
- name: "--env",
40
- type: "string",
41
- description: "Path to custom environment file",
42
- isOptional: true,
43
- },
44
38
  {
45
39
  name: "--help",
46
40
  type: "boolean",
@@ -20,7 +20,8 @@ mastra start [options]
20
20
  | Option | Description |
21
21
  |--------|-------------|
22
22
  | `-d, --dir <path>` | Path to your built Mastra output directory (default: .mastra/output) |
23
- | `-nt, --no-telemetry` | Enable OpenTelemetry instrumentation for observability |
23
+ | `-e, --env <env>` | Custom env file to include in the start (default: .env.production, .env) |
24
+ | `-nt, --no-telemetry` | Disable telemetry on start |
24
25
 
25
26
  ## Examples
26
27
 
@@ -36,6 +37,12 @@ Start from a custom output directory:
36
37
  mastra start --dir ./my-output
37
38
  ```
38
39
 
40
+ Start with a custom environment file:
41
+
42
+ ```bash
43
+ mastra start --env .env.staging
44
+ ```
45
+
39
46
  Start with telemetry disabled:
40
47
 
41
48
  ```bash