@mastra/mcp-docs-server 0.13.2-alpha.3 → 0.13.3-alpha.0

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 (117) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +33 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fagui.md +48 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fastra.md +30 -30
  4. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +30 -30
  5. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +33 -33
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +98 -98
  7. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +41 -41
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +42 -42
  9. package/.docs/organized/changelogs/%40mastra%2Fcore.md +77 -77
  10. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +29 -29
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +106 -106
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +101 -101
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +99 -99
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +111 -111
  15. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +35 -35
  16. package/.docs/organized/changelogs/%40mastra%2Fevals.md +26 -26
  17. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +29 -29
  18. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +26 -26
  19. package/.docs/organized/changelogs/%40mastra%2Flance.md +32 -0
  20. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +35 -35
  21. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +59 -59
  22. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +29 -29
  23. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +31 -31
  24. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +26 -26
  25. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +56 -56
  26. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +44 -44
  27. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +30 -17
  28. package/.docs/organized/changelogs/%40mastra%2Fpg.md +57 -57
  29. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +29 -29
  30. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +126 -126
  31. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +29 -29
  32. package/.docs/organized/changelogs/%40mastra%2Frag.md +27 -27
  33. package/.docs/organized/changelogs/%40mastra%2Fragie.md +26 -26
  34. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +13 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fserver.md +88 -88
  36. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +29 -29
  37. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +33 -33
  38. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +38 -38
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +35 -35
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +26 -26
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +26 -26
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +25 -0
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +26 -26
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +26 -26
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +23 -23
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +26 -26
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +26 -26
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +26 -26
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +26 -26
  50. package/.docs/organized/changelogs/create-mastra.md +43 -43
  51. package/.docs/organized/changelogs/mastra.md +123 -123
  52. package/.docs/organized/code-examples/a2a.md +1 -30
  53. package/.docs/organized/code-examples/agent-network.md +26 -115
  54. package/.docs/organized/code-examples/agent.md +1 -29
  55. package/.docs/organized/code-examples/agui.md +0 -22
  56. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -16
  57. package/.docs/organized/code-examples/assistant-ui.md +1 -16
  58. package/.docs/organized/code-examples/bird-checker-with-express.md +1 -19
  59. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -20
  60. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -18
  61. package/.docs/organized/code-examples/client-side-tools.md +1 -18
  62. package/.docs/organized/code-examples/crypto-chatbot.md +4 -25
  63. package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -26
  64. package/.docs/organized/code-examples/fireworks-r1.md +1 -21
  65. package/.docs/organized/code-examples/mcp-configuration.md +1 -24
  66. package/.docs/organized/code-examples/mcp-registry-registry.md +1 -22
  67. package/.docs/organized/code-examples/memory-per-resource-example.md +0 -14
  68. package/.docs/organized/code-examples/memory-todo-agent.md +1 -20
  69. package/.docs/organized/code-examples/memory-with-context.md +1 -20
  70. package/.docs/organized/code-examples/memory-with-libsql.md +1 -21
  71. package/.docs/organized/code-examples/memory-with-mem0.md +1 -21
  72. package/.docs/organized/code-examples/memory-with-pg.md +1 -22
  73. package/.docs/organized/code-examples/memory-with-processors.md +1 -17
  74. package/.docs/organized/code-examples/memory-with-upstash.md +1 -24
  75. package/.docs/organized/code-examples/openapi-spec-writer.md +1 -21
  76. package/.docs/organized/code-examples/quick-start.md +1 -21
  77. package/.docs/organized/code-examples/stock-price-tool.md +1 -21
  78. package/.docs/organized/code-examples/weather-agent.md +1 -20
  79. package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -22
  80. package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -20
  81. package/.docs/organized/code-examples/workflow-with-memory.md +1 -21
  82. package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -22
  83. package/.docs/raw/course/01-first-agent/08-exporting-your-agent.md +3 -2
  84. package/.docs/raw/course/01-first-agent/11-creating-transactions-tool.md +1 -1
  85. package/.docs/raw/course/03-agent-memory/24-working-memory-in-practice.md +0 -3
  86. package/.docs/raw/course/03-agent-memory/29-memory-best-practices.md +0 -6
  87. package/.docs/raw/course/04-workflows/05-chaining-steps-together.md +6 -5
  88. package/.docs/raw/course/04-workflows/18-understanding-conditional-branching.md +6 -3
  89. package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +81 -0
  90. package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +136 -0
  91. package/.docs/raw/deployment/cloud-providers/index.mdx +2 -0
  92. package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +111 -0
  93. package/.docs/raw/deployment/{deployment.mdx → serverless-platforms/index.mdx} +5 -10
  94. package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +94 -0
  95. package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +91 -0
  96. package/.docs/raw/frameworks/ai-sdk-v5.mdx +91 -0
  97. package/.docs/raw/frameworks/web-frameworks/next-js.mdx +56 -18
  98. package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +456 -0
  99. package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +28 -9
  100. package/.docs/raw/getting-started/model-providers.mdx +118 -127
  101. package/.docs/raw/memory/overview.mdx +30 -0
  102. package/.docs/raw/reference/agents/generate.mdx +3 -3
  103. package/.docs/raw/reference/agents/getModel.mdx +1 -1
  104. package/.docs/raw/reference/agents/stream.mdx +3 -3
  105. package/.docs/raw/reference/deployer/cloudflare.mdx +4 -119
  106. package/.docs/raw/reference/deployer/netlify.mdx +4 -83
  107. package/.docs/raw/reference/deployer/vercel.mdx +4 -51
  108. package/.docs/raw/reference/memory/Memory.mdx +71 -2
  109. package/.docs/raw/reference/observability/logger.mdx +70 -0
  110. package/.docs/raw/reference/rag/pg.mdx +15 -0
  111. package/.docs/raw/reference/storage/postgresql.mdx +17 -0
  112. package/.docs/raw/reference/workflows/step.mdx +8 -1
  113. package/.docs/raw/workflows/overview.mdx +1 -1
  114. package/dist/{chunk-P5AHYMUI.js → chunk-7QXT2IEP.js} +48 -11
  115. package/dist/prepare-docs/prepare.js +1 -1
  116. package/dist/stdio.js +1 -1
  117. package/package.json +6 -6
@@ -0,0 +1,111 @@
1
+ ---
2
+ title: "Cloudflare Deployer"
3
+ description: "Learn how to deploy a Mastra application to Cloudflare using the Mastra CloudflareDeployer"
4
+ ---
5
+
6
+ import { FileTree } from "nextra/components";
7
+
8
+ # CloudflareDeployer
9
+
10
+ The `CloudflareDeployer` class handles deployment of standalone Mastra applications to Cloudflare Workers. It manages configuration, deployment, and extends the base [Deployer](/reference/deployer/deployer) class with Cloudflare specific functionality.
11
+
12
+ ## Installation
13
+
14
+ ```bash copy
15
+ npm install @mastra/deployer-cloudflare@latest
16
+ ```
17
+
18
+ ## Usage example
19
+
20
+ ```typescript filename="src/mastra/index.ts" showLineNumbers copy
21
+ import { Mastra } from "@mastra/core/mastra";
22
+ import { CloudflareDeployer } from "@mastra/deployer-cloudflare";
23
+
24
+ export const mastra = new Mastra({
25
+ // ...
26
+ deployer: new CloudflareDeployer({
27
+ projectName: "hello-mastra",
28
+ scope: "",
29
+ auth: {
30
+ apiToken: process.env.CLOUDFLARE_API_TOKEN!,
31
+ apiEmail: "name@email.com"
32
+ }
33
+ })
34
+ });
35
+ ```
36
+
37
+ > See the [CloudflareDeployer](/reference/deployer/cloudflare) API reference for all available configuration options.
38
+
39
+ ### Cloudflare API token
40
+
41
+ In your Cloudflare dashboard, navigate to **Profile** > **API Tokens**, then select **Edit Cloudflare Workers** and click **Use template** to create a token for the `CloudflareDeployer`.
42
+
43
+ > To learn how to create a Cloudflare API token, see [Create API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) in the Cloudflare docs.
44
+
45
+ ## Continuous integration
46
+ In the Cloudflare dashboard, navigate to **Workers** > **Import a repository**. After importing your Mastra project's Git repository, create an application and configure the build settings with:
47
+
48
+ - **Build command**: `npm run build`
49
+ - **Deploy command**: `cd .mastra/output && npx wrangler deploy`
50
+
51
+ - **Build command**: `npm run build` (optional)
52
+
53
+ ## Manual deployment
54
+
55
+ Manual deployments are also possible using the [Cloudflare Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/). With the Wrangler CLI installed run the following from your project root to deploy your application.
56
+
57
+ ```bash copy
58
+ npm run build && wrangler deploy --config .mastra/output/wrangler.json
59
+ ```
60
+
61
+ > You can also run `wrangler dev --config .mastra/output/wrangler.json` from your project root to test your Mastra application locally.
62
+
63
+ ## Cloudflare secrets
64
+
65
+ To add secrets to your Cloudflare Workers application, use the Wrangler CLI. Secrets are environment variables that are encrypted and stored securely.
66
+
67
+
68
+ For example, to add an API key:
69
+
70
+ ```bash copy
71
+ npx wrangler secret put OPENAI_API_KEY
72
+ ```
73
+
74
+ When prompted, enter the secret value. The secret will be encrypted and stored securely in your Cloudflare account.
75
+
76
+ > For more details on managing secrets, see [Environment Variables and Secrets](https://developers.cloudflare.com/workers/configuration/secrets/) in the Cloudflare documentation.
77
+
78
+ ## Build output
79
+
80
+ The build output for Mastra applications using the `CloudflareDeployer` includes all agents, tools, and workflows in your project, along with Mastra specific files required to run your application on Cloudflare.
81
+
82
+ <FileTree>
83
+ <FileTree.Folder name=".mastra" defaultOpen>
84
+ <FileTree.Folder name="output" defaultOpen>
85
+ <FileTree.File name="index.mjs" />
86
+ <FileTree.File name="wrangler.json" />
87
+ </FileTree.Folder>
88
+ </FileTree.Folder>
89
+ <FileTree.File name="package.json" />
90
+ </FileTree>
91
+
92
+ The `CloudflareDeployer` automatically generates a `wrangler.json` configuration file in `.mastra/output` with the following settings:
93
+
94
+ ```json
95
+ {
96
+ "name": "hello-mastra",
97
+ "main": "./index.mjs",
98
+ "compatibility_date": "2025-04-01",
99
+ "compatibility_flags": ["nodejs_compat", "nodejs_compat_populate_process_env"],
100
+ "observability": { "logs": { "enabled": true } },
101
+ "vars": {
102
+ "OPENAI_API_KEY": "..",
103
+ "CLOUDFLARE_API_TOKEN": "..."
104
+ }
105
+ }
106
+ ```
107
+
108
+
109
+ ## Next steps
110
+
111
+ - [Mastra Client SDK](/docs/client-js/overview)
@@ -5,7 +5,11 @@ description: "Build and deploy Mastra applications using platform-specific deplo
5
5
 
6
6
  # Serverless Deployment
7
7
 
8
- This guide covers deploying standalone Mastra applications to Cloudflare Workers, Vercel, and Netlify using platform-specific deployers.
8
+ Standalone Mastra applications can be deployed to popular serverless platforms using one of our deployer packages:
9
+
10
+ - [Cloudflare](/docs/deployment/serverless-platforms/cloudflare-deployer)
11
+ - [Netlify](/docs/deployment/serverless-platforms/netlify-deployer)
12
+ - [Vercel](/docs/deployment/serverless-platforms/vercel-deployer)
9
13
 
10
14
  Deployers **aren't** required when integrating Mastra with a framework. See [Web Framework Integration](/docs/deployment/web-framework) for more information.
11
15
 
@@ -47,12 +51,3 @@ export const weatherAgent = new Agent({
47
51
  - })
48
52
  });
49
53
  ```
50
-
51
- ## Serverless Platform Deployers
52
-
53
- Platform-specific deployers handle configuration and deployment for:
54
-
55
- - **[Cloudflare Workers](/reference/deployer/cloudflare)**
56
- - **[Vercel](/reference/deployer/vercel)**
57
- - **[Netlify](/reference/deployer/netlify)**
58
- - **[Mastra Cloud](/docs/mastra-cloud/overview)** _(beta)_. You can join the [cloud waitlist](https://mastra.ai/cloud-beta) for early access.
@@ -0,0 +1,94 @@
1
+ ---
2
+ title: "Netlify Deployer"
3
+ description: "Learn how to deploy a Mastra application to Netlify using the Mastra NetlifyDeployer"
4
+ ---
5
+
6
+ import { FileTree } from "nextra/components";
7
+
8
+ # NetlifyDeployer
9
+
10
+ The `NetlifyDeployer` class handles deployment of standalone Mastra applications to Netlify. It manages configuration, deployment, and extends the base [Deployer](/reference/deployer/deployer) class with Netlify specific functionality.
11
+
12
+ ## Installation
13
+
14
+ ```bash copy
15
+ npm install @mastra/deployer-netlify@latest
16
+ ```
17
+
18
+ ## Usage example
19
+
20
+ ```typescript filename="src/mastra/index.ts" showLineNumbers copy
21
+ import { Mastra } from "@mastra/core/mastra";
22
+ import { NetlifyDeployer } from "@mastra/deployer-netlify";
23
+
24
+ export const mastra = new Mastra({
25
+ // ...
26
+ deployer: new NetlifyDeployer()
27
+ });
28
+ ```
29
+
30
+ > See the [NetlifyDeployer](/reference/deployer/netlify) API reference for all available configuration options.
31
+
32
+ ## Continuous integration
33
+
34
+ After connecting your Mastra project’s Git repository to Netlify, update the project settings. In the Netlify dashboard, go to **Project configuration** > **Build & deploy** > **Continuous deployment**, and under **Build settings**, set the following:
35
+
36
+ - **Build command**: `npm run build` (optional)
37
+
38
+ ### Environment variables
39
+
40
+ Before your first deployment, make sure to add any environment variables used by your application. For example, if you're using OpenAI as the LLM, you'll need to set `OPENAI_API_KEY` in your Netlify project settings.
41
+
42
+ > See [Environment variables overview](https://docs.netlify.com/environment-variables/overview/) for more details.
43
+
44
+
45
+ Your project is now configured with automatic deployments which occur whenever you push to the configured branch of your GitHub repository.
46
+
47
+
48
+ ## Manual deployment
49
+
50
+ Manual deployments are also possible using the [Netlify CLI](https://docs.netlify.com/cli/get-started/). With the Netlify CLI installed run the following from your project root to deploy your application.
51
+
52
+ ```bash copy
53
+ netlify deploy --prod
54
+ ```
55
+
56
+ > You can also run `netlify dev` from your project root to test your Mastra application locally.
57
+
58
+ ## Build output
59
+
60
+ The build output for Mastra applications using the `NetlifyDeployer` includes all agents, tools, and workflows in your project, along with Mastra specific files required to run your application on Netlify.
61
+
62
+ <FileTree>
63
+ <FileTree.Folder name=".netlify" defaultOpen>
64
+ <FileTree.Folder name="v1" defaultOpen>
65
+ <FileTree.Folder name="functions" defaultOpen>
66
+ <FileTree.Folder name="api" defaultOpen>
67
+ <FileTree.File name="index.mjs" />
68
+ </FileTree.Folder>
69
+ </FileTree.Folder>
70
+ <FileTree.File name="config.json" />
71
+ </FileTree.Folder>
72
+ </FileTree.Folder>
73
+ <FileTree.File name="package.json" />
74
+ </FileTree>
75
+
76
+
77
+ The `NetlifyDeployer` automatically generates a `config.json` configuration file in `.netlify/v1` with the following settings:
78
+
79
+ ```json
80
+ {
81
+ "redirects": [
82
+ {
83
+ "force": true,
84
+ "from": "/*",
85
+ "to": "/.netlify/functions/api/:splat",
86
+ "status": 200
87
+ }
88
+ ]
89
+ }
90
+ ```
91
+
92
+ ## Next steps
93
+
94
+ - [Mastra Client SDK](/docs/client-js/overview)
@@ -0,0 +1,91 @@
1
+ ---
2
+ title: "Vercel Deployer"
3
+ description: "Learn how to deploy a Mastra application to Vercel using the Mastra VercelDeployer"
4
+ ---
5
+
6
+ import { FileTree } from "nextra/components";
7
+
8
+ # VercelDeployer
9
+
10
+ The `VercelDeployer` class handles deployment of standalone Mastra applications to Vercel. It manages configuration, deployment, and extends the base [Deployer](/reference/deployer/deployer) class with Vercel specific functionality.
11
+
12
+ ## Installation
13
+
14
+ ```bash copy
15
+ npm install @mastra/deployer-vercel@latest
16
+ ```
17
+
18
+ ## Usage example
19
+
20
+ ```typescript filename="src/mastra/index.ts" showLineNumbers copy
21
+ import { Mastra } from "@mastra/core/mastra";
22
+ import { VercelDeployer } from "@mastra/deployer-vercel";
23
+
24
+ export const mastra = new Mastra({
25
+ // ...
26
+ deployer: new VercelDeployer()
27
+ });
28
+ ```
29
+
30
+ > See the [VercelDeployer](/reference/deployer/vercel) API reference for all available configuration options.
31
+
32
+ ## Continuous integration
33
+
34
+ After connecting your Mastra project’s Git repository to Vercel, update the project settings. In the Vercel dashboard, go to **Settings** > **Build and Deployment**, and under **Framework settings**, set the following:
35
+
36
+ - **Build command**: `npm run build` (optional)
37
+
38
+ ### Environment variables
39
+
40
+ Before your first deployment, make sure to add any environment variables used by your application. For example, if you're using OpenAI as the LLM, you'll need to set `OPENAI_API_KEY` in your Vercel project settings.
41
+
42
+ > See [Environment variables](https://vercel.com/docs/environment-variables) for more details.
43
+
44
+ Your project is now configured with automatic deployments which occur whenever you push to the configured branch of your GitHub repository.
45
+
46
+ ## Manual deployment
47
+
48
+ Manual deployments are also possible using the [Vercel CLI](https://vercel.com/docs/cli). With the Vercel CLI installed run the following from your project root to deploy your application.
49
+
50
+ ```bash copy
51
+ npm run build && vercel --prod --prebuilt --archive=tgz
52
+ ```
53
+
54
+ > You can also run `vercel dev` from your project root to test your Mastra application locally.
55
+
56
+ ## Build output
57
+
58
+ The build output for Mastra applications using the `VercelDeployer` includes all agents, tools, and workflows in your project, along with Mastra specific files required to run your application on Vercel.
59
+
60
+ <FileTree>
61
+ <FileTree.Folder name=".vercel" defaultOpen>
62
+ <FileTree.Folder name="output" defaultOpen>
63
+ <FileTree.Folder name="functions" defaultOpen>
64
+ <FileTree.Folder name="index.func" defaultOpen>
65
+ <FileTree.File name="index.mjs" />
66
+ </FileTree.Folder>
67
+ </FileTree.Folder>
68
+ <FileTree.File name="config.json" />
69
+ </FileTree.Folder>
70
+ </FileTree.Folder>
71
+ <FileTree.File name="package.json" />
72
+ </FileTree>
73
+
74
+
75
+ The `VercelDeployer` automatically generates a `config.json` configuration file in `.vercel/output` with the following settings:
76
+
77
+ ```json
78
+ {
79
+ "version": 3,
80
+ "routes": [
81
+ {
82
+ "src": "/(.*)",
83
+ "dest": "/"
84
+ }
85
+ ]
86
+ }
87
+ ```
88
+
89
+ ## Next steps
90
+
91
+ - [Mastra Client SDK](/docs/client-js/overview)
@@ -0,0 +1,91 @@
1
+ # AI SDK v5 (beta) Migration Guide
2
+
3
+ This guide covers Mastra-specific considerations when migrating from AI SDK v4 to v5 beta.
4
+
5
+ Please add any feedback or bug reports to the [AI SDK v5 mega issue in Github.](https://github.com/mastra-ai/mastra/issues/5470)
6
+
7
+ ## Official Migration Guide
8
+
9
+ **Follow the official [AI SDK v5 Migration Guide](https://v5.ai-sdk.dev/docs/migration-guides/migration-guide-5-0)** for all AI SDK core breaking changes, package updates, and API changes.
10
+
11
+ This guide covers only the Mastra-specific aspects of the migration.
12
+
13
+ ## Warnings
14
+
15
+ - **Data compatibility**: New data stored in v5 format will no longer work if you downgrade from the beta
16
+ - **Backup recommendation**: Keep DB backups from before you upgrade to v5 beta
17
+ - **Production use**: Wait for the AI SDK v5 stable release before using in production applications
18
+ - **Prerelease status**: The Mastra `ai-v5` tag is a prerelease version and may have bugs
19
+
20
+ ## Memory Storage
21
+
22
+ Your existing AI SDK v4 data will run through our internal `MessageList` class which handles converting to/from various message formats.
23
+ This includes converting from AI SDK v4->v5. This means you don't need to run any DB migrations and your data will be translated on the fly and will just work when you upgrade.
24
+
25
+
26
+ ## Migration Strategy
27
+
28
+ Migrating to AI SDK v5 with Mastra involves updating both your **backend** (Mastra server) and **frontend**.
29
+ We provide a compatibility mode to handle stream format conversion during the transition.
30
+
31
+ ### Backend Upgrade
32
+
33
+ Bump Mastra to the new `ai-v5` prerelease version for all Mastra packages:
34
+
35
+ ```bash npm2yarn copy
36
+ npm i mastra@ai-v5 @mastra/core@ai-v5 @mastra/memory@ai-v5 [etc]
37
+ ```
38
+
39
+ Then configure your Mastra instance with v4 compatibility so your existing frontend will continue to work:
40
+
41
+ ```typescript
42
+ import { Mastra } from '@mastra/core';
43
+
44
+ export const mastra = new Mastra({
45
+ agents: { myAgent },
46
+ aiSdkCompat: 'v4', // <- add this for compatibility
47
+ });
48
+ ```
49
+
50
+ #### Dependencies
51
+
52
+ You will need to upgrade all AI SDK dependencies to use the new v5 beta versions in your backend when you bump to the Mastra `ai-v5` prerelease tag.
53
+
54
+ In most cases this will only involve bumping your model provider packages. For example: `npm i @ai-sdk/openai@2.0.0-beta.1` - refer to the [AI SDK v5 documentation](https://v5.ai-sdk.dev/docs/migration-guides/migration-guide-5-0) for more info. Some model providers do not yet have V5 versions (Openrouter for example).
55
+
56
+ Also note that you need to bump all your Mastra dependencies to the new `ai-v5` tag, and you must upgrade `zod` to the latest version if you have it installed.
57
+
58
+ #### Using Stream Compatibility Manually
59
+
60
+ If you have a frontend that calls Mastra agents in an endpoint, you can wrap the new `response.toUIMessageStreamResponse()` manually.
61
+
62
+ ```ts
63
+ import { mastra } from "@/src/mastra";
64
+ import { createV4CompatibleResponse } from "@mastra/core/agent";
65
+
66
+ const myAgent = mastra.getAgent("weatherAgent");
67
+ export async function POST(req: Request) {
68
+ const { messages } = await req.json();
69
+ const stream = await myAgent.stream(messages);
70
+
71
+ return createV4CompatibleResponse(stream.toUIMessageStreamResponse().body!);
72
+ }
73
+ ```
74
+
75
+ ### Using Mastra Playground
76
+
77
+ Currently playground is still an AI SDK v4 frontend. For now you need to set `aiSdkCompat: 'v4'` for it to work.
78
+ We'll handle this automatically for you soon.
79
+
80
+ ### Frontend Upgrade
81
+
82
+ When you're ready, remove the compatibility flag and upgrade your frontend:
83
+
84
+ 1. Remove `aiSdkCompat: 'v4'` from your Mastra configuration
85
+ 2. Follow the AI SDK guide on upgrading your frontend dependencies
86
+ 3. Update your frontend code for v5 breaking changes
87
+
88
+ ## Discussion and Bug Reports
89
+
90
+ Please add any feedback or bug reports to the [AI SDK v5 mega issue in Github.](https://github.com/mastra-ai/mastra/issues/5470)
91
+
@@ -79,17 +79,36 @@ If you prefer to customize the setup, run the `init` command and choose from the
79
79
  npx mastra@latest init
80
80
  ```
81
81
 
82
+ <Callout type="warning">
83
+ By default, `mastra init` suggests `src` as the install location. If you're using the App Router at the root of your project (e.g., `app`, not `src/app`), enter `.` when prompted:
84
+ </Callout>
85
+
82
86
  Add the `dev` and `build` scripts to `package.json`:
83
87
 
84
- ```json filename="package.json"
85
- {
86
- "scripts": {
87
- ...
88
- "dev:mastra": "mastra dev --dir mastra",
89
- "build:mastra": "mastra build --dir mastra"
90
- }
91
- }
92
- ```
88
+ <Tabs items={["app", "src/app"]}>
89
+ <Tabs.Tab>
90
+ ```json filename="package.json"
91
+ {
92
+ "scripts": {
93
+ ...
94
+ "dev:mastra": "mastra dev --dir mastra",
95
+ "build:mastra": "mastra build --dir mastra"
96
+ }
97
+ }
98
+ ```
99
+ </Tabs.Tab>
100
+ <Tabs.Tab>
101
+ ```json filename="package.json"
102
+ {
103
+ "scripts": {
104
+ ...
105
+ "dev:mastra": "mastra dev --dir src/mastra",
106
+ "build:mastra": "mastra build --dir src/mastra"
107
+ }
108
+ }
109
+ ```
110
+ </Tabs.Tab>
111
+ </Tabs>
93
112
 
94
113
  ## Configure TypeScript
95
114
 
@@ -324,17 +343,36 @@ If you prefer to customize the setup, run the `init` command and choose from the
324
343
  npx mastra@latest init
325
344
  ```
326
345
 
346
+ <Callout type="warning">
347
+ By default, `mastra init` suggests `src` as the install location. If you're using the Pages Router at the root of your project (e.g., `pages`, not `src/pages`), enter `.` when prompted:
348
+ </Callout>
349
+
327
350
  Add the `dev` and `build` scripts to `package.json`:
328
351
 
329
- ```json filename="package.json"
330
- {
331
- "scripts": {
332
- ...
333
- "dev:mastra": "mastra dev --dir mastra",
334
- "build:mastra": "mastra build --dir mastra"
335
- }
336
- }
337
- ```
352
+ <Tabs items={["pages", "src/pages"]}>
353
+ <Tabs.Tab>
354
+ ```json filename="package.json"
355
+ {
356
+ "scripts": {
357
+ ...
358
+ "dev:mastra": "mastra dev --dir mastra",
359
+ "build:mastra": "mastra build --dir mastra"
360
+ }
361
+ }
362
+ ```
363
+ </Tabs.Tab>
364
+ <Tabs.Tab>
365
+ ```json filename="package.json"
366
+ {
367
+ "scripts": {
368
+ ...
369
+ "dev:mastra": "mastra dev --dir src/mastra",
370
+ "build:mastra": "mastra build --dir src/mastra"
371
+ }
372
+ }
373
+ ```
374
+ </Tabs.Tab>
375
+ </Tabs>
338
376
 
339
377
  ## Configure TypeScript
340
378