@mastra/mcp-docs-server 1.0.0-beta.0 → 1.0.0-beta.1

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 (123) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +10 -10
  2. package/.docs/organized/changelogs/%40mastra%2Fcore.md +9 -9
  3. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +11 -11
  4. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +11 -11
  5. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
  6. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +18 -18
  7. package/.docs/organized/changelogs/%40mastra%2Freact.md +8 -8
  8. package/.docs/organized/changelogs/%40mastra%2Fserver.md +8 -8
  9. package/.docs/organized/changelogs/create-mastra.md +7 -7
  10. package/.docs/organized/changelogs/mastra.md +13 -13
  11. package/.docs/raw/agents/agent-memory.mdx +1 -1
  12. package/.docs/raw/agents/overview.mdx +2 -2
  13. package/.docs/raw/auth/auth0.mdx +1 -1
  14. package/.docs/raw/auth/clerk.mdx +1 -1
  15. package/.docs/raw/auth/firebase.mdx +1 -1
  16. package/.docs/raw/auth/jwt.mdx +1 -1
  17. package/.docs/raw/auth/supabase.mdx +1 -1
  18. package/.docs/raw/auth/workos.mdx +1 -1
  19. package/.docs/raw/course/01-first-agent/03-verifying-installation.md +1 -1
  20. package/.docs/raw/course/02-agent-tools-mcp/02-installing-mcp.md +1 -1
  21. package/.docs/raw/course/03-agent-memory/03-installing-memory.md +1 -1
  22. package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +1 -1
  23. package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +1 -1
  24. package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +2 -2
  25. package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +1 -1
  26. package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +1 -1
  27. package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +1 -1
  28. package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +1 -1
  29. package/.docs/raw/evals/overview.mdx +1 -1
  30. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +4 -4
  31. package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +1 -1
  32. package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +9 -9
  33. package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +1 -1
  34. package/.docs/raw/frameworks/servers/express.mdx +1 -1
  35. package/.docs/raw/frameworks/web-frameworks/astro.mdx +12 -12
  36. package/.docs/raw/frameworks/web-frameworks/next-js.mdx +4 -4
  37. package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +12 -12
  38. package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +5 -5
  39. package/.docs/raw/getting-started/installation.mdx +13 -13
  40. package/.docs/raw/getting-started/templates.mdx +5 -5
  41. package/.docs/raw/guides/guide/notes-mcp-server.mdx +1 -1
  42. package/.docs/raw/guides/guide/research-assistant.mdx +1 -10
  43. package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +6 -6
  44. package/.docs/raw/guides/migrations/upgrade-to-v1/evals.mdx +1 -1
  45. package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +2 -2
  46. package/.docs/raw/guides/migrations/upgrade-to-v1/mcp.mdx +3 -3
  47. package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +34 -34
  48. package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +2 -2
  49. package/.docs/raw/guides/migrations/upgrade-to-v1/tracing.mdx +13 -13
  50. package/.docs/raw/guides/migrations/upgrade-to-v1/voice.mdx +1 -1
  51. package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +2 -2
  52. package/.docs/raw/guides/quickstarts/nextjs.mdx +275 -0
  53. package/.docs/raw/index.mdx +1 -1
  54. package/.docs/raw/logging.mdx +3 -3
  55. package/.docs/raw/mastra-cloud/observability.mdx +6 -6
  56. package/.docs/raw/memory/overview.mdx +1 -1
  57. package/.docs/raw/memory/semantic-recall.mdx +1 -1
  58. package/.docs/raw/memory/storage/memory-with-libsql.mdx +2 -2
  59. package/.docs/raw/memory/storage/memory-with-pg.mdx +2 -2
  60. package/.docs/raw/memory/storage/memory-with-upstash.mdx +2 -2
  61. package/.docs/raw/observability/overview.mdx +5 -5
  62. package/.docs/raw/observability/tracing/exporters/arize.mdx +2 -2
  63. package/.docs/raw/observability/tracing/exporters/braintrust.mdx +2 -2
  64. package/.docs/raw/observability/tracing/exporters/cloud.mdx +2 -2
  65. package/.docs/raw/observability/tracing/exporters/default.mdx +5 -5
  66. package/.docs/raw/observability/tracing/exporters/langfuse.mdx +2 -2
  67. package/.docs/raw/observability/tracing/exporters/langsmith.mdx +2 -2
  68. package/.docs/raw/observability/tracing/exporters/otel.mdx +5 -5
  69. package/.docs/raw/observability/tracing/overview.mdx +21 -21
  70. package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +2 -2
  71. package/.docs/raw/rag/overview.mdx +1 -1
  72. package/.docs/raw/reference/agents/agent.mdx +2 -2
  73. package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
  74. package/.docs/raw/reference/cli/mastra.mdx +7 -7
  75. package/.docs/raw/reference/core/getLogger.mdx +2 -2
  76. package/.docs/raw/reference/core/getMCPServer.mdx +2 -2
  77. package/.docs/raw/reference/core/getMCPServerById.mdx +4 -4
  78. package/.docs/raw/reference/core/getTelemetry.mdx +2 -2
  79. package/.docs/raw/reference/core/listLogs.mdx +2 -2
  80. package/.docs/raw/reference/core/listLogsByRunId.mdx +2 -2
  81. package/.docs/raw/reference/core/listMCPServers.mdx +4 -4
  82. package/.docs/raw/reference/core/setLogger.mdx +2 -2
  83. package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
  84. package/.docs/raw/reference/evals/create-scorer.mdx +58 -49
  85. package/.docs/raw/reference/evals/mastra-scorer.mdx +2 -0
  86. package/.docs/raw/reference/observability/tracing/configuration.mdx +12 -12
  87. package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +1 -1
  88. package/.docs/raw/reference/observability/tracing/exporters/cloud-exporter.mdx +8 -8
  89. package/.docs/raw/reference/observability/tracing/exporters/console-exporter.mdx +8 -8
  90. package/.docs/raw/reference/observability/tracing/exporters/default-exporter.mdx +8 -8
  91. package/.docs/raw/reference/observability/tracing/instances.mdx +8 -8
  92. package/.docs/raw/reference/observability/tracing/interfaces.mdx +7 -7
  93. package/.docs/raw/reference/observability/tracing/spans.mdx +7 -7
  94. package/.docs/raw/reference/processors/batch-parts-processor.mdx +8 -2
  95. package/.docs/raw/reference/processors/language-detector.mdx +8 -2
  96. package/.docs/raw/reference/processors/moderation-processor.mdx +8 -2
  97. package/.docs/raw/reference/processors/pii-detector.mdx +8 -2
  98. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +8 -2
  99. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +8 -2
  100. package/.docs/raw/reference/processors/token-limiter-processor.mdx +8 -2
  101. package/.docs/raw/reference/processors/unicode-normalizer.mdx +8 -2
  102. package/.docs/raw/reference/storage/cloudflare-d1.mdx +1 -1
  103. package/.docs/raw/reference/storage/cloudflare.mdx +1 -1
  104. package/.docs/raw/reference/storage/dynamodb.mdx +3 -3
  105. package/.docs/raw/reference/storage/lance.mdx +1 -1
  106. package/.docs/raw/reference/storage/libsql.mdx +1 -1
  107. package/.docs/raw/reference/storage/mongodb.mdx +1 -1
  108. package/.docs/raw/reference/storage/mssql.mdx +1 -1
  109. package/.docs/raw/reference/storage/postgresql.mdx +1 -1
  110. package/.docs/raw/reference/storage/upstash.mdx +1 -1
  111. package/.docs/raw/reference/templates/overview.mdx +1 -1
  112. package/.docs/raw/reference/vectors/couchbase.mdx +8 -2
  113. package/.docs/raw/reference/vectors/libsql.mdx +1 -1
  114. package/.docs/raw/reference/vectors/mongodb.mdx +7 -1
  115. package/.docs/raw/reference/vectors/s3vectors.mdx +1 -1
  116. package/.docs/raw/server-db/mastra-client.mdx +4 -4
  117. package/.docs/raw/tools-mcp/mcp-overview.mdx +1 -1
  118. package/.docs/raw/voice/speech-to-text.mdx +1 -1
  119. package/.docs/raw/voice/text-to-speech.mdx +1 -1
  120. package/.docs/raw/workflows/inngest-workflow.mdx +1 -1
  121. package/CHANGELOG.md +7 -0
  122. package/dist/stdio.js +1 -1
  123. package/package.json +3 -3
@@ -46,14 +46,14 @@ export const mastra = new Mastra({
46
46
  });
47
47
  ```
48
48
 
49
- This minimal configuration automatically includes the `DefaultExporter`, `CloudExporter`, and `SensitiveDataFilter` processor. See the [observability tracing documentation]/docs/v1/observability/tracing/overview) for full configuration options.
49
+ This minimal configuration automatically includes the `DefaultExporter`, `CloudExporter`, and `SensitiveDataFilter` processor. See the [observability tracing documentation](/docs/v1/observability/tracing/overview) for full configuration options.
50
50
 
51
51
  **After (v1 with custom configuration):**
52
52
 
53
53
  If you need to configure specific exporters (like OTLP), install the exporter package and configure it:
54
54
 
55
55
  ```bash
56
- npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-proto
56
+ npm install @mastra/otel-exporter@beta @opentelemetry/exporter-trace-otlp-proto
57
57
  ```
58
58
 
59
59
  ```typescript
@@ -89,7 +89,7 @@ Key changes:
89
89
  3. Use `default: { enabled: true }` for quick setup, or `configs:` for custom configuration
90
90
  4. Export types change from string literals (`'otlp'`) to exporter class instances (`new OtelExporter()`)
91
91
 
92
- See the [exporters documentation]/docs/v1/observability/tracing/overview#exporters) for all available exporters.
92
+ See the [exporters documentation](/docs/v1/observability/tracing/overview#exporters) for all available exporters.
93
93
 
94
94
  ### From AI Tracing
95
95
 
@@ -134,7 +134,7 @@ The observability functionality has moved to a dedicated `@mastra/observability`
134
134
  To migrate, install the package and update your import statements:
135
135
 
136
136
  ```bash
137
- npm install @mastra/observability
137
+ npm install @mastra/observability@beta
138
138
  ```
139
139
 
140
140
  ```diff
@@ -204,13 +204,13 @@ To migrate, update method implementations in custom exporters.
204
204
 
205
205
  The OTEL-based `telemetry` configuration from 0.x has been removed. The old system with `serviceName`, `sampling.type`, and `export.type` properties is no longer supported.
206
206
 
207
- To migrate, follow the "From OTEL-based Telemetry" section above. For detailed configuration options, see the [observability tracing documentation]/docs/v1/observability/tracing/overview).
207
+ To migrate, follow the "From OTEL-based Telemetry" section above. For detailed configuration options, see the [observability tracing documentation](/docs/v1/observability/tracing/overview).
208
208
 
209
209
  ### Custom instrumentation files
210
210
 
211
211
  The automatic detection of instrumentation files in `/mastra` (with `.ts`, `.js`, or `.mjs` extensions) has been removed. Custom instrumentation is no longer supported through separate files.
212
212
 
213
- To migrate, use the built-in exporter system or implement custom exporters using the `ObservabilityExporter` interface. See the [exporters documentation]/docs/v1/observability/tracing/overview#exporters) for details.
213
+ To migrate, use the built-in exporter system or implement custom exporters using the `ObservabilityExporter` interface. See the [exporters documentation](/docs/v1/observability/tracing/overview#exporters) for details.
214
214
 
215
215
  ### `instrumentation.mjs` files
216
216
 
@@ -258,11 +258,11 @@ If you were using OTEL-based telemetry with specific providers in 0.x, here's ho
258
258
 
259
259
  | Provider | Exporter | Guide | Reference |
260
260
  |----------|----------|-------|-----------|
261
- | Arize AX, Arize Phoenix | **Arize** | [Guide]/docs/v1/observability/tracing/exporters/arize) | [Reference]/reference/v1/observability/tracing/exporters/arize) |
262
- | Braintrust | **Braintrust** | [Guide]/docs/v1/observability/tracing/exporters/braintrust) | [Reference]/reference/v1/observability/tracing/exporters/braintrust) |
263
- | Langfuse | **Langfuse** | [Guide]/docs/v1/observability/tracing/exporters/langfuse) | [Reference]/reference/v1/observability/tracing/exporters/langfuse) |
264
- | LangSmith | **LangSmith** | [Guide]/docs/v1/observability/tracing/exporters/langsmith) | [Reference]/reference/v1/observability/tracing/exporters/langsmith) |
265
- | Dash0, Laminar, New Relic, SigNoz, Traceloop, Custom OTEL | **OpenTelemetry** | [Guide]/docs/v1/observability/tracing/exporters/otel) | [Reference]/reference/v1/observability/tracing/exporters/otel) |
261
+ | Arize AX, Arize Phoenix | **Arize** | [Guide](/docs/v1/observability/tracing/exporters/arize) | [Reference](/reference/v1/observability/tracing/exporters/arize) |
262
+ | Braintrust | **Braintrust** | [Guide](/docs/v1/observability/tracing/exporters/braintrust) | [Reference](/reference/v1/observability/tracing/exporters/braintrust) |
263
+ | Langfuse | **Langfuse** | [Guide](/docs/v1/observability/tracing/exporters/langfuse) | [Reference](/reference/v1/observability/tracing/exporters/langfuse) |
264
+ | LangSmith | **LangSmith** | [Guide](/docs/v1/observability/tracing/exporters/langsmith) | [Reference](/reference/v1/observability/tracing/exporters/langsmith) |
265
+ | Dash0, Laminar, New Relic, SigNoz, Traceloop, Custom OTEL | **OpenTelemetry** | [Guide](/docs/v1/observability/tracing/exporters/otel) | [Reference](/reference/v1/observability/tracing/exporters/otel) |
266
266
  | LangWatch | \<coming soon\> | - | - |
267
267
 
268
268
  ### Installation
@@ -274,7 +274,7 @@ npm install @mastra/[exporter-name]-exporter
274
274
 
275
275
  **OpenTelemetry exporter** (Dash0, Laminar, New Relic, SigNoz, Traceloop):
276
276
  ```bash
277
- npm install @mastra/otel-exporter
277
+ npm install @mastra/otel-exporter@beta
278
278
  ```
279
279
 
280
- Plus the required protocol package for your provider (see [OTEL guide]/docs/v1/observability/tracing/exporters/otel#installation)).
280
+ Plus the required protocol package for your provider (see [OTEL guide](/docs/v1/observability/tracing/exporters/otel#installation)).
@@ -33,7 +33,7 @@ To migrate, update configuration property names when configuring agents with voi
33
33
  You can use Mastra's codemod CLI to update your code automatically:
34
34
 
35
35
  ```shell
36
- npx @mastra/codemod v1/voice-property-names .
36
+ npx @mastra/codemod@beta v1/voice-property-names .
37
37
  ```
38
38
 
39
39
  :::
@@ -25,7 +25,7 @@ To migrate, replace all calls to `mastra.getWorkflows()` with `mastra.listWorkfl
25
25
  You can use Mastra's codemod CLI to update your imports automatically:
26
26
 
27
27
  ```shell
28
- npx @mastra/codemod v1/workflows-get-workflows .
28
+ npx @mastra/codemod@beta v1/workflows-get-workflows .
29
29
  ```
30
30
 
31
31
  :::
@@ -52,7 +52,7 @@ To migrate, update references from `runtimeContext` to `requestContext` in step
52
52
  You can use Mastra's codemod CLI to update your imports automatically:
53
53
 
54
54
  ```shell
55
- npx @mastra/codemod v1/runtime-context .
55
+ npx @mastra/codemod@beta v1/runtime-context .
56
56
  ```
57
57
 
58
58
  :::
@@ -0,0 +1,275 @@
1
+ ---
2
+ title: "Next.js Quickstart"
3
+ description: "Get started with Mastra, Next.js, and AS SDK UI. Quickly."
4
+ ---
5
+
6
+ # Next.js Quickstart
7
+
8
+ In this quickstart, you'll build an AI agent with tool-calling capabilities using [Mastra](/docs/v1), then connect it to Next.js by importing and calling the agent directly within your routes.
9
+
10
+ You'll use [AI SDK UI](https://ai-sdk.dev/docs/ai-sdk-ui/overview) and [AI Elements](https://ai-sdk.dev/elements) to create a beautiful, interactive chat experience.
11
+
12
+ In ~5 minutes, you'll have a functional AI-powered app ready to extend with your own tools and logic.
13
+
14
+ <figure>
15
+ ![Screenshot of a chat-style web app displaying a completed "weatherTool" tool call, answering "What is the weather in London?" with a JSON result. A message suggests offering activity ideas, and a text input field is at the bottom.](/img/nextjs-quickstart.png)
16
+ <figcaption class="text-sm text-center">What you'll build: an agent that can call a weather tool, display the JSON result, stream a weather summary in the chat UI, and persist conversation history across reloads.</figcaption>
17
+ </figure>
18
+
19
+ ## Before you begin
20
+
21
+ * You'll need an API key from a supported [model provider](/models/v1). If you don't have a preference, use [OpenAI](https://platform.openai.com/api-keys).
22
+
23
+ ## Create a new Next.js app
24
+
25
+ Run the following command to [create a new Next.js app](https://nextjs.org/docs/app/getting-started/installation):
26
+
27
+ ```bash
28
+ npx create-next-app \
29
+ my-nextjs-agent \
30
+ --yes \
31
+ --ts \
32
+ --eslint \
33
+ --tailwind \
34
+ --src-dir \
35
+ --app \
36
+ --turbopack \
37
+ --no-react-compiler \
38
+ --no-import-alias
39
+ ```
40
+
41
+ This creates a project called `my-nextjs-agent`, but you can replace it with any name you want.
42
+
43
+ ## Initialize Mastra
44
+ `cd` and run [`mastra init`](/reference/v1/cli/create-mastra).
45
+
46
+ When prompted, choose a provider (e.g. OpenAI) and enter your key:
47
+
48
+ ```bash
49
+ cd my-nextjs-agent
50
+ npx --force mastra@beta init
51
+ ```
52
+ This creates a `src/mastra` folder with an example weather agent and the following files:
53
+
54
+ - `index.ts` - Mastra config, including memory
55
+ - `tools/weather-tool.ts` - a tool to fetch weather for a given location
56
+ - `agents/weather-agent.ts`- a weather agent with a prompt that uses the tool
57
+
58
+ You'll call `weather-agent.ts` from your Next.js routes in the next steps.
59
+
60
+
61
+ ## Install AI SDK UI and AI Elements
62
+
63
+ Install AI SDK UI along with the Mastra adapter:
64
+
65
+ ```bash
66
+ npm install \
67
+ @mastra/ai-sdk \
68
+ @ai-sdk/react
69
+ ```
70
+
71
+ Next, initialize AI Elements. When prompted, choose the default options:
72
+
73
+ ```bash
74
+ npx ai-elements@latest
75
+ ```
76
+
77
+ This downloads the entire AI Elements UI component library into a `@/components/ai-elements` folder.
78
+
79
+
80
+ ## Create a chat route
81
+
82
+ Create `src/app/api/chat/route.ts`:
83
+
84
+ ```ts title="src/app/api/chat/route.ts"
85
+ import { mastra } from "@/mastra";
86
+ import { NextResponse } from "next/server";
87
+ import { toAISdkFormat } from "@mastra/ai-sdk";
88
+ import { convertMessages } from "@mastra/core/agent";
89
+ import { createUIMessageStreamResponse } from "ai";
90
+
91
+ const weatherAgent = mastra.getAgent("weatherAgent");
92
+
93
+ export async function POST(req: Request) {
94
+ const { messages } = await req.json();
95
+
96
+ const stream = await weatherAgent.stream(messages, {
97
+ memory: {
98
+ thread: "example-user-id",
99
+ resource: "weather-chat",
100
+ },
101
+ });
102
+
103
+ return createUIMessageStreamResponse({
104
+ stream: toAISdkFormat(stream, { from: "agent" }),
105
+ })
106
+ }
107
+
108
+ export async function GET() {
109
+ const memory = await weatherAgent.getMemory();
110
+ const response = await memory?.query({
111
+ threadId: "example-user-id",
112
+ resourceId: "weather-chat",
113
+ });
114
+
115
+ const uiMessages =
116
+ convertMessages(response?.uiMessages ?? []).to("AIV5.UI");
117
+ return NextResponse.json(uiMessages);
118
+ }
119
+ ```
120
+
121
+ The POST route accepts a prompt and streams the agent's response back in AI SDK format, while the GET route fetches message history from memory so the UI can be hydrated when the client reloads.
122
+
123
+ ## Create a chat page
124
+
125
+ Create `src/app/chat/page.tsx`:
126
+
127
+ ```tsx title="src/app/chat/page.tsx"
128
+ 'use client';
129
+
130
+ import '@/app/globals.css';
131
+ import { useEffect, useState } from 'react';
132
+ import { DefaultChatTransport } from 'ai';
133
+ import { useChat } from '@ai-sdk/react';
134
+
135
+ import {
136
+ PromptInput,
137
+ PromptInputBody,
138
+ PromptInputTextarea,
139
+ } from '@/components/ai-elements/prompt-input';
140
+
141
+ import {
142
+ Conversation,
143
+ ConversationContent,
144
+ ConversationScrollButton,
145
+ } from '@/components/ai-elements/conversation';
146
+
147
+ import { Message, MessageContent, MessageResponse } from '@/components/ai-elements/message';
148
+
149
+ import {
150
+ Tool,
151
+ ToolHeader,
152
+ ToolContent,
153
+ ToolInput,
154
+ ToolOutput,
155
+ } from '@/components/ai-elements/tool';
156
+
157
+
158
+ function Chat() {
159
+ const [input, setInput] = useState<string>('');
160
+
161
+ const { messages, setMessages, sendMessage, status } = useChat({
162
+ transport: new DefaultChatTransport({
163
+ api: '/api/chat',
164
+ }),
165
+ });
166
+
167
+ useEffect(() => {
168
+ const fetchMessages = async () => {
169
+ const res = await fetch('/api/chat');
170
+ const data = await res.json();
171
+ setMessages([...data]);
172
+ };
173
+ fetchMessages();
174
+ }, [setMessages]);
175
+
176
+ const handleSubmit = async () => {
177
+ if (!input.trim()) return;
178
+
179
+ sendMessage({ text: input });
180
+ setInput('');
181
+ };
182
+
183
+ return (
184
+ <div className="w-full p-6 relative size-full h-screen">
185
+ <div className="flex flex-col h-full">
186
+ <Conversation className="h-full">
187
+ <ConversationContent>
188
+ {messages.map((message: any) => (
189
+ <div key={message.id}>
190
+ {message.parts?.map((part: any, i: number) => {
191
+ if (part.type === 'text') {
192
+ return (
193
+ <Message
194
+ key={`${message.id}-${i}`}
195
+ from={message.role}>
196
+ <MessageContent>
197
+ <MessageResponse>{part.text}</MessageResponse>
198
+ </MessageContent>
199
+ </Message>
200
+ );
201
+ }
202
+
203
+ if (part.type?.startsWith('tool-')) {
204
+ return (
205
+ <Tool key={`${message.id}-${i}`}>
206
+ <ToolHeader
207
+ type={part.type}
208
+ state={part.state || 'output-available'}
209
+ className="cursor-pointer"
210
+ />
211
+ <ToolContent>
212
+ <ToolInput input={part.input || part.args || {}} />
213
+ <ToolOutput
214
+ output={part.output || part.result}
215
+ errorText={part.errorText || part.error}
216
+ />
217
+ </ToolContent>
218
+ </Tool>
219
+ );
220
+ }
221
+
222
+ return null;
223
+ })}
224
+ </div>
225
+ ))}
226
+ <ConversationScrollButton />
227
+ </ConversationContent>
228
+ </Conversation>
229
+
230
+ <PromptInput onSubmit={handleSubmit} className="mt-20">
231
+ <PromptInputBody>
232
+ <PromptInputTextarea
233
+ onChange={(e: any) => setInput(e.target.value)}
234
+ className="md:leading-10"
235
+ value={input}
236
+ placeholder="Type your message..."
237
+ disabled={status !== 'ready'}
238
+ />
239
+ </PromptInputBody>
240
+ </PromptInput>
241
+ </div>
242
+ </div>
243
+ );
244
+ }
245
+
246
+ export default Chat;
247
+ ```
248
+
249
+ This component connects [`useChat()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat) to the `api/chat` endpoint, sending prompts there and streaming the response back in chunks.
250
+
251
+ It renders the response text using the [`<MessageResponse>`](https://ai-sdk.dev/elements/components/message#messageresponse-) component, and shows any tool invocations with the [`<Tool>`](https://ai-sdk.dev/elements/components/tool) component.
252
+
253
+
254
+ ## Test your agent
255
+ 1. Run your Next.js app with `npm run dev`
256
+
257
+ 2. Open the chat at http://localhost:3000/chat
258
+
259
+ 3. Try asking about the weather. If your API key is set up correctly, you'll get a response.
260
+
261
+ ## Next steps
262
+
263
+ Congratulations on building your Mastra agent with Next.js! 🎉
264
+
265
+ From here, you can extend the project with your own tools and logic:
266
+
267
+ - Learn more about [agents](/docs/v1/agents/overview)
268
+ - Give your agent its own [tools](/docs/v1/agents/using-tools)
269
+ - Add human-like [memory](/docs/v1/agents/agent-memory) to your agent
270
+
271
+ When you're ready, read more about how Mastra integrates with AI SDK and Next.js, and how to deploy to Vercel:
272
+
273
+ - Integrate Mastra with [AI SDK](/docs/v1/frameworks/agentic-uis/ai-sdk)
274
+ - Use Mastra in your [Next.js app](/docs/v1/frameworks/web-frameworks/next-js)
275
+ - Deploy your agent to [Vercel](/docs/v1/deployment/serverless-platforms/vercel-deployer)
@@ -27,7 +27,7 @@ Some highlights include:
27
27
 
28
28
  - [**Workflows**](/docs/v1/workflows/overview) - When you need explicit control over execution, use Mastra's graph-based workflow engine to orchestrate complex multi-step processes. Mastra workflows use an intuitive syntax for control flow (`.then()`, `.branch()`, `.parallel()`).
29
29
 
30
- - [**Human-in-the-loop**]/docs/v1/workflows/suspend-and-resume) - Suspend an agent or workflow and await user input or approval before resuming. Mastra uses [storage](/docs/v1/server-db/storage) to remember execution state, so you can pause indefinitely and resume where you left off.
30
+ - [**Human-in-the-loop**](/docs/v1/workflows/suspend-and-resume) - Suspend an agent or workflow and await user input or approval before resuming. Mastra uses [storage](/docs/v1/server-db/storage) to remember execution state, so you can pause indefinitely and resume where you left off.
31
31
 
32
32
  - **Context management** - Give your agents the right context at the right time. Provide [conversation history](/docs/v1/memory/conversation-history), [retrieve](/docs/v1/rag/overview) data from your sources (APIs, databases, files), and add human-like [working](/docs/v1/memory/working-memory) and [semantic](/docs/v1/memory/semantic-recall) memory so your agents behave coherently.
33
33
 
@@ -7,11 +7,11 @@ description: Learn how to use logging in Mastra to monitor execution, capture ap
7
7
 
8
8
  Mastra's logging system captures function execution, input data, and output responses in a structured format.
9
9
 
10
- When deploying to Mastra Cloud, logs are shown on the [Logs]/docs/v1/mastra-cloud/observability) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
10
+ When deploying to Mastra Cloud, logs are shown on the [Logs](/docs/v1/mastra-cloud/observability) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
11
11
 
12
12
  ## PinoLogger
13
13
 
14
- When [initializing a new Mastra project]/docs/v1/getting-started/installation) using the CLI, `PinoLogger` is included by default.
14
+ When [initializing a new Mastra project](/docs/v1/getting-started/installation) using the CLI, `PinoLogger` is included by default.
15
15
 
16
16
  ```typescript title="src/mastra/index.ts" showLineNumbers copy
17
17
  import { Mastra } from "@mastra/core";
@@ -26,7 +26,7 @@ export const mastra = new Mastra({
26
26
  });
27
27
  ```
28
28
 
29
- > See the [PinoLogger]/reference/v1/logging/pino-logger) API reference for all available configuration options.
29
+ > See the [PinoLogger](/reference/v1/logging/pino-logger) API reference for all available configuration options.
30
30
 
31
31
  ## Logging from workflows and tools
32
32
 
@@ -13,7 +13,7 @@ Mastra Cloud captures execution data to help you monitor your application's beha
13
13
 
14
14
  ## Logs
15
15
 
16
- You can view detailed logs for debugging and monitoring your application's behavior on the [Logs]/docs/v1/mastra-cloud/dashboard#logs) page of the Dashboard.
16
+ You can view detailed logs for debugging and monitoring your application's behavior on the [Logs](/docs/v1/mastra-cloud/dashboard#logs) page of the Dashboard.
17
17
 
18
18
  ![Dashboard logs](/img/mastra-cloud/mastra-cloud-dashboard-logs.jpg)
19
19
 
@@ -23,11 +23,11 @@ Each log entry includes its severity level and a detailed message showing agent,
23
23
 
24
24
  ## Traces
25
25
 
26
- More detailed traces are available for both agents and workflows by using a [logger]/docs/v1/logging) or enabling [observability]/docs/v1/observability/tracing/overview) using one of our [supported providers]/docs/v1/observability/tracing/overview#exporters).
26
+ More detailed traces are available for both agents and workflows by using a [logger](/docs/v1/logging) or enabling [observability](/docs/v1/observability/tracing/overview) using one of our [supported providers](/docs/v1/observability/tracing/overview#exporters).
27
27
 
28
28
  ### Agents
29
29
 
30
- With a [logger]/docs/v1/logging) enabled, you can view detailed outputs from your agents in the **Traces** section in Studio.
30
+ With a [logger](/docs/v1/logging) enabled, you can view detailed outputs from your agents in the **Traces** section in Studio.
31
31
 
32
32
  ![observability agents](/img/mastra-cloud/mastra-cloud-observability-agents.jpg)
33
33
 
@@ -37,7 +37,7 @@ Tools passed to the agent during generation are standardized using `convertTools
37
37
 
38
38
  ### Workflows
39
39
 
40
- With a [logger]/docs/v1/logging) enabled, you can view detailed outputs from your workflows in the **Traces** section in Studio.
40
+ With a [logger](/docs/v1/logging) enabled, you can view detailed outputs from your workflows in the **Traces** section in Studio.
41
41
 
42
42
  ![observability workflows](/img/mastra-cloud/mastra-cloud-observability-workflows.jpg)
43
43
 
@@ -47,5 +47,5 @@ Workflows are created using `createWorkflow`, which sets up steps, metadata, and
47
47
 
48
48
  ## Next steps
49
49
 
50
- - [Logging]/docs/v1/logging)
51
- - [Tracing]/docs/v1/observability/tracing/overview)
50
+ - [Logging](/docs/v1/logging)
51
+ - [Tracing](/docs/v1/observability/tracing/overview)
@@ -16,7 +16,7 @@ Mastra's memory system uses [storage providers](#memory-storage-adapters) to per
16
16
  First install the required dependencies:
17
17
 
18
18
  ```bash copy
19
- npm install @mastra/core @mastra/memory @mastra/libsql
19
+ npm install @mastra/core@beta @mastra/memory@beta @mastra/libsql@beta
20
20
  ```
21
21
 
22
22
  Then add a storage adapter to the main Mastra instance. Any agent with memory enabled will use this shared storage to store and recall interactions.
@@ -147,7 +147,7 @@ const agent = new Agent({
147
147
  To use FastEmbed (a local embedding model), install `@mastra/fastembed`:
148
148
 
149
149
  ```bash npm2yarn copy
150
- npm install @mastra/fastembed
150
+ npm install @mastra/fastembed@beta
151
151
  ```
152
152
 
153
153
  Then configure it in your memory:
@@ -18,7 +18,7 @@ OPENAI_API_KEY=<your-api-key>
18
18
  And install the following package:
19
19
 
20
20
  ```bash copy
21
- npm install @mastra/libsql
21
+ npm install @mastra/libsql@beta
22
22
  ```
23
23
 
24
24
  ## Adding memory to an agent
@@ -56,7 +56,7 @@ Embeddings are numeric vectors used by memory’s `semanticRecall` to retrieve r
56
56
  Install `fastembed` to get started:
57
57
 
58
58
  ```bash copy
59
- npm install @mastra/fastembed
59
+ npm install @mastra/fastembed@beta
60
60
  ```
61
61
 
62
62
  Add the following to your agent:
@@ -19,7 +19,7 @@ DATABASE_URL=<your-connection-string>
19
19
  And install the following package:
20
20
 
21
21
  ```bash copy
22
- npm install @mastra/pg
22
+ npm install @mastra/pg@beta
23
23
  ```
24
24
 
25
25
  ## Adding memory to an agent
@@ -57,7 +57,7 @@ Embeddings are numeric vectors used by memory’s `semanticRecall` to retrieve r
57
57
  Install `fastembed` to get started:
58
58
 
59
59
  ```bash copy
60
- npm install @mastra/fastembed
60
+ npm install @mastra/fastembed@beta
61
61
  ```
62
62
 
63
63
  Add the following to your agent:
@@ -24,7 +24,7 @@ You can get your Upstash credentials by signing up at [upstash.com](https://upst
24
24
  And install the following package:
25
25
 
26
26
  ```bash copy
27
- npm install @mastra/upstash
27
+ npm install @mastra/upstash@beta
28
28
  ```
29
29
 
30
30
  ## Adding memory to an agent
@@ -63,7 +63,7 @@ Embeddings are numeric vectors used by memory’s `semanticRecall` to retrieve r
63
63
  Install `fastembed` to get started:
64
64
 
65
65
  ```bash copy
66
- npm install @mastra/fastembed
66
+ npm install @mastra/fastembed@beta
67
67
  ```
68
68
 
69
69
  Add the following to your agent:
@@ -43,11 +43,11 @@ export const mastra = new Mastra({
43
43
 
44
44
  With this basic setup, you will see Traces and Logs in both Studio and in Mastra Cloud.
45
45
 
46
- We also support various external tracing providers like Langfuse, Braintrust, and any OpenTelemetry-compatible platform (Datadog, New Relic, SigNoz, etc.). See more about this in the [Tracing]/docs/v1/observability/tracing/overview) documentation.
46
+ We also support various external tracing providers like Langfuse, Braintrust, and any OpenTelemetry-compatible platform (Datadog, New Relic, SigNoz, etc.). See more about this in the [Tracing](/docs/v1/observability/tracing/overview) documentation.
47
47
 
48
48
  ## What's Next?
49
49
 
50
- - **[Set up Tracing]/docs/v1/observability/tracing/overview)**: Configure tracing for your application
51
- - **[Configure Logging]/docs/v1/logging)**: Add structured logging
52
- - **[View Examples]/examples/v1/observability/basic-tracing)**: See observability in action
53
- - **[API Reference]/reference/v1/observability/tracing/instances)**: Detailed configuration options
50
+ - **[Set up Tracing](/docs/v1/observability/tracing/overview)**: Configure tracing for your application
51
+ - **[Configure Logging](/docs/v1/logging)**: Add structured logging
52
+ - **[View Examples](/examples/v1/observability/basic-tracing)**: See observability in action
53
+ - **[API Reference](/reference/v1/observability/tracing/instances)**: Detailed configuration options
@@ -10,7 +10,7 @@ description: "Send traces to Arize Phoenix or Arize AX using OpenTelemetry and O
10
10
  ## Installation
11
11
 
12
12
  ```bash npm2yarn
13
- npm install @mastra/arize
13
+ npm install @mastra/arize@beta
14
14
  ```
15
15
 
16
16
  ## Configuration
@@ -188,7 +188,7 @@ This exporter implements the [OpenInference Semantic Conventions](https://github
188
188
 
189
189
  ## Related
190
190
 
191
- - [Tracing Overview]/docs/v1/observability/tracing/overview)
191
+ - [Tracing Overview](/docs/v1/observability/tracing/overview)
192
192
  - [Phoenix Documentation](https://docs.arize.com/phoenix)
193
193
  - [Arize AX Documentation](https://docs.arize.com/)
194
194
  - [OpenInference Specification](https://github.com/Arize-ai/openinference/tree/main/spec)
@@ -10,7 +10,7 @@ description: "Send traces to Braintrust for evaluation and monitoring"
10
10
  ## Installation
11
11
 
12
12
  ```bash npm2yarn
13
- npm install @mastra/braintrust
13
+ npm install @mastra/braintrust@beta
14
14
  ```
15
15
 
16
16
  ## Configuration
@@ -67,5 +67,5 @@ new BraintrustExporter({
67
67
 
68
68
  ## Related
69
69
 
70
- - [Tracing Overview]/docs/v1/observability/tracing/overview)
70
+ - [Tracing Overview](/docs/v1/observability/tracing/overview)
71
71
  - [Braintrust Documentation](https://www.braintrust.dev/docs)
@@ -110,6 +110,6 @@ CloudExporter uses intelligent batching to optimize network usage. Traces are bu
110
110
 
111
111
  ## Related
112
112
 
113
- - [Tracing Overview]/docs/v1/observability/tracing/overview)
114
- - [DefaultExporter]/docs/v1/observability/tracing/exporters/default)
113
+ - [Tracing Overview](/docs/v1/observability/tracing/overview)
114
+ - [DefaultExporter](/docs/v1/observability/tracing/exporters/default)
115
115
  - [Mastra Cloud Documentation](https://cloud.mastra.ai/docs)
@@ -102,8 +102,8 @@ If you set the strategy to `'auto'`, the `DefaultExporter` automatically selects
102
102
 
103
103
  | Storage Provider | Preferred Strategy | Supported Strategies | Notes |
104
104
  | ----------------------------------------------- | ------------------ | ----------------------------------------- | ------------------------------------- |
105
- | **[LibSQL]/reference/v1/storage/libsql)** | batch-with-updates | realtime, batch-with-updates, insert-only | Default storage, good for development |
106
- | **[PostgreSQL]/reference/v1/storage/postgresql)** | batch-with-updates | batch-with-updates, insert-only | Recommended for production |
105
+ | **[LibSQL](/reference/v1/storage/libsql)** | batch-with-updates | realtime, batch-with-updates, insert-only | Default storage, good for development |
106
+ | **[PostgreSQL](/reference/v1/storage/postgresql)** | batch-with-updates | batch-with-updates, insert-only | Recommended for production |
107
107
 
108
108
  ### Strategy Benefits
109
109
 
@@ -158,6 +158,6 @@ new DefaultExporter({
158
158
 
159
159
  ## Related
160
160
 
161
- - [Tracing Overview]/docs/v1/observability/tracing/overview)
162
- - [CloudExporter]/docs/v1/observability/tracing/exporters/cloud)
163
- - [Storage Configuration]/docs/v1/server-db/storage)
161
+ - [Tracing Overview](/docs/v1/observability/tracing/overview)
162
+ - [CloudExporter](/docs/v1/observability/tracing/exporters/cloud)
163
+ - [Storage Configuration](/docs/v1/server-db/storage)
@@ -10,7 +10,7 @@ description: "Send traces to Langfuse for LLM observability and analytics"
10
10
  ## Installation
11
11
 
12
12
  ```bash npm2yarn
13
- npm install @mastra/langfuse
13
+ npm install @mastra/langfuse@beta
14
14
  ```
15
15
 
16
16
  ## Configuration
@@ -109,5 +109,5 @@ new LangfuseExporter({
109
109
 
110
110
  ## Related
111
111
 
112
- - [Tracing Overview]/docs/v1/observability/tracing/overview)
112
+ - [Tracing Overview](/docs/v1/observability/tracing/overview)
113
113
  - [Langfuse Documentation](https://langfuse.com/docs)
@@ -10,7 +10,7 @@ description: "Send traces to LangSmith for LLM observability and evaluation"
10
10
  ## Installation
11
11
 
12
12
  ```bash npm2yarn
13
- npm install @mastra/langsmith
13
+ npm install @mastra/langsmith@beta
14
14
  ```
15
15
 
16
16
  ## Configuration
@@ -75,5 +75,5 @@ new LangSmithExporter({
75
75
 
76
76
  ## Related
77
77
 
78
- - [Tracing Overview]/docs/v1/observability/tracing/overview)
78
+ - [Tracing Overview](/docs/v1/observability/tracing/overview)
79
79
  - [LangSmith Documentation](https://docs.smith.langchain.com/)