@mastra/mcp-docs-server 1.2.7-alpha.1 → 1.2.7-alpha.10

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 (198) hide show
  1. package/.docs/docs/agent-builder/integrations.md +1 -1
  2. package/.docs/docs/agent-builder/overview.md +4 -3
  3. package/.docs/docs/agent-builder/skill-registries.md +1 -3
  4. package/.docs/docs/agent-controller/modes.md +1 -1
  5. package/.docs/docs/agent-controller/overview.md +4 -3
  6. package/.docs/docs/agent-controller/session.md +3 -5
  7. package/.docs/docs/agents/a2a.md +2 -1
  8. package/.docs/docs/agents/agent-approval.md +2 -2
  9. package/.docs/docs/agents/code-mode.md +1 -1
  10. package/.docs/docs/agents/guardrails.md +10 -9
  11. package/.docs/docs/agents/networks.md +1 -1
  12. package/.docs/docs/agents/overview.md +5 -5
  13. package/.docs/docs/agents/skills.md +3 -5
  14. package/.docs/docs/agents/structured-output.md +1 -1
  15. package/.docs/docs/agents/supervisor-agents.md +3 -4
  16. package/.docs/docs/agents/using-tools.md +2 -4
  17. package/.docs/docs/browser/agent-browser.md +1 -3
  18. package/.docs/docs/browser/browser-viewer.md +1 -3
  19. package/.docs/docs/browser/overview.md +2 -1
  20. package/.docs/docs/browser/recording.md +1 -1
  21. package/.docs/docs/browser/stagehand.md +1 -1
  22. package/.docs/docs/capabilities/channels/discord.md +98 -0
  23. package/.docs/docs/capabilities/channels/other-adapters.md +68 -0
  24. package/.docs/docs/capabilities/channels/overview.md +255 -0
  25. package/.docs/docs/capabilities/channels/slack.md +225 -0
  26. package/.docs/docs/capabilities/channels/teams.md +100 -0
  27. package/.docs/docs/capabilities/channels/telegram.md +98 -0
  28. package/.docs/docs/capabilities/channels/whatsapp.md +99 -0
  29. package/.docs/docs/deployment/mastra-server.md +2 -4
  30. package/.docs/docs/editor/overview.md +2 -6
  31. package/.docs/docs/editor/prompts.md +1 -1
  32. package/.docs/docs/editor/tools.md +1 -3
  33. package/.docs/docs/evals/built-in-scorers.md +2 -2
  34. package/.docs/docs/evals/custom-scorers.md +1 -3
  35. package/.docs/docs/evals/datasets/overview.md +4 -5
  36. package/.docs/docs/evals/datasets/running-experiments.md +10 -8
  37. package/.docs/docs/evals/evals-with-memory.md +1 -3
  38. package/.docs/docs/evals/gates-and-verdicts.md +2 -4
  39. package/.docs/docs/evals/overview.md +4 -1
  40. package/.docs/docs/evals/quick-checks.md +3 -5
  41. package/.docs/docs/getting-started/file-based-agents.md +114 -0
  42. package/.docs/docs/getting-started/manual-install.md +17 -4
  43. package/.docs/docs/index.md +1 -1
  44. package/.docs/docs/long-running-agents/background-tasks.md +3 -3
  45. package/.docs/docs/long-running-agents/durable-agents.md +5 -7
  46. package/.docs/docs/long-running-agents/goals.md +5 -7
  47. package/.docs/docs/long-running-agents/schedules.md +1 -1
  48. package/.docs/docs/long-running-agents/signal-providers.md +1 -3
  49. package/.docs/docs/long-running-agents/signals.md +12 -23
  50. package/.docs/docs/mastra-platform/database.md +2 -2
  51. package/.docs/docs/mastra-platform/github.md +1 -1
  52. package/.docs/docs/mastra-platform/observability.md +5 -1
  53. package/.docs/docs/mcp/mcp-apps.md +3 -3
  54. package/.docs/docs/mcp/overview.md +6 -10
  55. package/.docs/docs/memory/memory-processors.md +67 -0
  56. package/.docs/docs/memory/message-history.md +56 -2
  57. package/.docs/docs/memory/observational-memory.md +5 -4
  58. package/.docs/docs/memory/overview.md +8 -6
  59. package/.docs/docs/memory/semantic-recall.md +36 -2
  60. package/.docs/docs/memory/working-memory.md +3 -3
  61. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -3
  62. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
  63. package/.docs/docs/observability/logging.md +1 -1
  64. package/.docs/docs/observability/tracing/overview.md +1 -1
  65. package/.docs/docs/rag/vector-databases.md +7 -2
  66. package/.docs/docs/server/auth/auth0.md +1 -1
  67. package/.docs/docs/server/auth/better-auth.md +2 -2
  68. package/.docs/docs/server/auth/clerk.md +1 -1
  69. package/.docs/docs/server/auth/firebase.md +1 -1
  70. package/.docs/docs/server/auth/google.md +3 -3
  71. package/.docs/docs/server/auth/jwt.md +2 -2
  72. package/.docs/docs/server/auth/okta.md +2 -2
  73. package/.docs/docs/server/auth/workos.md +1 -1
  74. package/.docs/docs/server/mastra-client.md +1 -1
  75. package/.docs/docs/server/mastra-server.md +1 -1
  76. package/.docs/docs/server/pubsub.md +1 -1
  77. package/.docs/docs/server/request-context.md +4 -4
  78. package/.docs/docs/server/server-adapters.md +8 -8
  79. package/.docs/docs/storage/overview.md +214 -0
  80. package/.docs/docs/studio/auth.md +1 -3
  81. package/.docs/docs/studio/overview.md +1 -1
  82. package/.docs/docs/voice/livekit.md +101 -4
  83. package/.docs/docs/workflows/agents-and-tools.md +3 -5
  84. package/.docs/docs/workflows/control-flow.md +1 -3
  85. package/.docs/docs/workflows/overview.md +6 -7
  86. package/.docs/docs/workflows/snapshots.md +1 -1
  87. package/.docs/docs/workspace/overview.md +2 -1
  88. package/.docs/docs/workspace/sandbox.md +2 -0
  89. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  90. package/.docs/guides/build-your-ui/copilotkit/channels.md +1 -1
  91. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +2 -2
  92. package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
  93. package/.docs/guides/concepts/streaming.md +3 -3
  94. package/.docs/guides/getting-started/quickstart.md +4 -2
  95. package/.docs/guides/guide/chef-michel.md +0 -2
  96. package/.docs/guides/guide/slack-assistant.md +2 -2
  97. package/.docs/guides/guide/stock-agent.md +0 -2
  98. package/.docs/models/embeddings.md +119 -0
  99. package/.docs/models/environment-variables.md +3 -0
  100. package/.docs/models/gateways/netlify.md +4 -1
  101. package/.docs/models/gateways/openrouter.md +10 -6
  102. package/.docs/models/gateways/vercel.md +7 -1
  103. package/.docs/models/index.md +1 -1
  104. package/.docs/models/providers/crossmodel.md +109 -0
  105. package/.docs/models/providers/google.md +2 -1
  106. package/.docs/models/providers/llmgateway.md +184 -181
  107. package/.docs/models/providers/meta.md +101 -0
  108. package/.docs/models/providers/nano-gpt.md +2 -2
  109. package/.docs/models/providers/neon.md +40 -29
  110. package/.docs/models/providers/openai.md +5 -1
  111. package/.docs/models/providers/opencode.md +2 -1
  112. package/.docs/models/providers/poolside.md +6 -5
  113. package/.docs/models/providers/routing-run.md +20 -34
  114. package/.docs/models/providers/the-grid-ai.md +3 -3
  115. package/.docs/models/providers/wandb.md +21 -14
  116. package/.docs/models/providers/xai.md +2 -1
  117. package/.docs/models/providers/zenifra.md +73 -0
  118. package/.docs/models/providers.md +3 -0
  119. package/.docs/reference/agent-controller/agent-controller-class.md +3 -3
  120. package/.docs/reference/agent-controller/session.md +4 -4
  121. package/.docs/reference/agents/agent.md +1 -1
  122. package/.docs/reference/agents/channels.md +2 -2
  123. package/.docs/reference/agents/inngest-agent.md +1 -1
  124. package/.docs/reference/agents/listSkills.md +1 -1
  125. package/.docs/reference/agents/listSuspendedRuns.md +3 -3
  126. package/.docs/reference/auth/google.md +5 -5
  127. package/.docs/reference/channels/channel-provider.md +1 -1
  128. package/.docs/reference/channels/slack-provider.md +3 -3
  129. package/.docs/reference/cli/mastra.md +119 -12
  130. package/.docs/reference/code-sdk/mount-agent-controller.md +76 -0
  131. package/.docs/reference/coding-agent/create-coding-agent.md +1 -1
  132. package/.docs/reference/configuration.md +1 -1
  133. package/.docs/reference/evals/checks.md +4 -4
  134. package/.docs/reference/evals/create-scorer.md +8 -0
  135. package/.docs/reference/file-based-agents/config.md +97 -0
  136. package/.docs/reference/file-based-agents/instructions.md +54 -0
  137. package/.docs/reference/file-based-agents/memory.md +58 -0
  138. package/.docs/reference/file-based-agents/observability.md +32 -0
  139. package/.docs/reference/file-based-agents/processors.md +56 -0
  140. package/.docs/reference/file-based-agents/server.md +37 -0
  141. package/.docs/reference/file-based-agents/skills.md +56 -0
  142. package/.docs/reference/file-based-agents/storage.md +30 -0
  143. package/.docs/reference/file-based-agents/studio.md +56 -0
  144. package/.docs/reference/file-based-agents/subagents.md +123 -0
  145. package/.docs/reference/file-based-agents/tools.md +63 -0
  146. package/.docs/reference/file-based-agents/workflows.md +52 -0
  147. package/.docs/reference/file-based-agents/workspace.md +74 -0
  148. package/.docs/reference/index.md +16 -0
  149. package/.docs/reference/memory/memory-class.md +1 -1
  150. package/.docs/reference/memory/observational-memory.md +1 -1
  151. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  152. package/.docs/reference/memory/summarizeConversation.md +99 -0
  153. package/.docs/reference/memory/summarizeThread.md +93 -0
  154. package/.docs/{docs/getting-started → reference}/project-structure.md +3 -10
  155. package/.docs/reference/pubsub/lease-provider.md +5 -5
  156. package/.docs/reference/server/express-adapter.md +1 -3
  157. package/.docs/reference/server/fastify-adapter.md +1 -3
  158. package/.docs/reference/server/hono-adapter.md +1 -3
  159. package/.docs/reference/server/koa-adapter.md +1 -3
  160. package/.docs/reference/server/nestjs-adapter.md +1 -3
  161. package/.docs/reference/signals/task-signal-provider.md +1 -1
  162. package/.docs/reference/storage/clickhouse.md +34 -2
  163. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  164. package/.docs/reference/storage/composite.md +64 -6
  165. package/.docs/reference/storage/convex.md +1 -1
  166. package/.docs/reference/storage/dynamodb.md +1 -1
  167. package/.docs/reference/storage/mongodb.md +46 -46
  168. package/.docs/reference/storage/retention.md +74 -6
  169. package/.docs/reference/tools/create-tool.md +2 -2
  170. package/.docs/reference/tools/mcp-client.md +22 -0
  171. package/.docs/reference/tools/mcp-server.md +161 -4
  172. package/.docs/reference/vectors/mongodb.md +93 -4
  173. package/.docs/reference/voice/livekit.md +272 -8
  174. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +1 -3
  175. package/.docs/reference/workspace/agentfs-filesystem.md +1 -3
  176. package/.docs/reference/workspace/apple-container-sandbox.md +6 -8
  177. package/.docs/reference/workspace/archil-filesystem.md +1 -3
  178. package/.docs/reference/workspace/azure-blob-filesystem.md +1 -3
  179. package/.docs/reference/workspace/blaxel-sandbox.md +1 -3
  180. package/.docs/reference/workspace/daytona-sandbox.md +1 -3
  181. package/.docs/reference/workspace/docker-sandbox.md +1 -3
  182. package/.docs/reference/workspace/e2b-sandbox.md +1 -3
  183. package/.docs/reference/workspace/files-sdk-filesystem.md +1 -3
  184. package/.docs/reference/workspace/gcs-filesystem.md +1 -3
  185. package/.docs/reference/workspace/google-drive-filesystem.md +1 -3
  186. package/.docs/reference/workspace/local-filesystem.md +1 -3
  187. package/.docs/reference/workspace/local-sandbox.md +1 -3
  188. package/.docs/reference/workspace/mesa-filesystem.md +4 -4
  189. package/.docs/reference/workspace/modal-sandbox.md +1 -3
  190. package/.docs/reference/workspace/railway-sandbox.md +2 -4
  191. package/.docs/reference/workspace/s3-filesystem.md +1 -3
  192. package/.docs/reference/workspace/vercel-sandbox.md +5 -7
  193. package/.docs/reference/workspace/vercel-serverless.md +2 -4
  194. package/CHANGELOG.md +29 -0
  195. package/package.json +5 -5
  196. package/.docs/docs/agents/channels.md +0 -225
  197. package/.docs/docs/agents/file-based-agents.md +0 -297
  198. package/.docs/docs/memory/storage.md +0 -267
@@ -38,7 +38,7 @@ new MastraEditor({
38
38
 
39
39
  **options.readOnly** (`boolean`): Treat memory as read-only — no new messages are stored.
40
40
 
41
- **options.lastMessages** (`number | false`): Number of recent messages to include in context, or false to disable.
41
+ **options.lastMessages** (`number | false`): Number of recent messages to include in context, or false to disable message history entirely (messages are not loaded or saved).
42
42
 
43
43
  **options.semanticRecall** (`boolean | SemanticRecall`): Semantic recall configuration. See the Memory class reference for the full shape.
44
44
 
@@ -0,0 +1,99 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # summarizeConversation()
4
+
5
+ The standalone `summarizeConversation()` function summarizes a conversation in one shot. It distills the messages you pass in with the same Observer plumbing that powers [Observational Memory](https://mastra.ai/reference/memory/observational-memory) — without Observational Memory attached to an agent, and without reading from or writing to storage.
6
+
7
+ Nothing is written back to memory. The summary and extracted values are returned to you (and to each extractor's `onExtracted` hook), so you decide where they go — for example your own database.
8
+
9
+ Use this when you already have the messages in hand and want explicit control over what gets summarized. To summarize a stored thread by ID instead, use [`Memory.summarizeThread()`](https://mastra.ai/reference/memory/summarizeThread), which loads the messages for you.
10
+
11
+ ## Usage example
12
+
13
+ ```typescript
14
+ import { summarizeConversation } from '@mastra/memory'
15
+
16
+ const result = await summarizeConversation({
17
+ model: 'openai/gpt-5-mini',
18
+ messages,
19
+ instructions: 'Summarize this voicemail call for the business owner.',
20
+ })
21
+ ```
22
+
23
+ ## Parameters
24
+
25
+ **model** (`string | LanguageModel | DynamicModel`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_MINI\_\_'.
26
+
27
+ **messages** (`MastraDBMessage[]`): The conversation to summarize. When empty, the function returns an empty result without calling the model.
28
+
29
+ **instructions** (`string`): Extra guidance appended to the summarizer's system prompt, such as what to focus on or who the summary is for.
30
+
31
+ **extract** (`Extractor[]`): Extractors to run over the conversation. Extractors with a Zod schema run as a follow-up structured output call; schema-less extractors are extracted inline. Each extractor's onExtracted hook fires with the extracted value.
32
+
33
+ **threadId** (`string`): Thread the conversation belongs to. Defaults to the first threadId found on messages. Passed to extractor contexts.
34
+
35
+ **resourceId** (`string`): Resource (user) the conversation belongs to. Defaults to the first resourceId found on messages. Passed to extractor contexts.
36
+
37
+ **memory** (`Memory`): Memory instance forwarded to extractor contexts. Set automatically when called through Memory.summarizeThread().
38
+
39
+ **mastra** (`Mastra`): Mastra instance used to resolve custom gateway models. Set automatically when called through Memory.summarizeThread().
40
+
41
+ **requestContext** (`RequestContext`): Request context forwarded to the summarizer model and extractor hooks.
42
+
43
+ **abortSignal** (`AbortSignal`): Signal to cancel the summarization call.
44
+
45
+ ## Returns
46
+
47
+ **summary** (`string`): The distilled observations produced from the conversation, in dense bullet form.
48
+
49
+ **extracted** (`Record<string, unknown>`): Values produced by extract extractors, keyed by extractor slug.
50
+
51
+ **extractionFailures** (`{ slug: string; error: string }[]`): Extractors that failed to produce a valid value, with the reason. Only present when at least one extractor failed.
52
+
53
+ **usage** (`{ inputTokens?: number; outputTokens?: number; totalTokens?: number }`): Token usage of the summarization call.
54
+
55
+ ## Extended usage example
56
+
57
+ The following example summarizes an in-flight voice session from messages the application already holds, and extracts a structured record:
58
+
59
+ ```typescript
60
+ import { summarizeConversation, Extractor } from '@mastra/memory'
61
+ import type { MastraDBMessage } from '@mastra/core/agent'
62
+ import { z } from 'zod'
63
+ import { sessionRecords } from './db'
64
+
65
+ const sessionSummary = new Extractor({
66
+ name: 'session-summary',
67
+ instructions: 'Return a concise summary of the session.',
68
+ schema: z.object({
69
+ summary: z.string(),
70
+ sentiment: z.enum(['positive', 'neutral', 'negative']),
71
+ followUps: z.array(z.string()),
72
+ }),
73
+ metadataKeyPath: false, // don't persist into memory metadata — the hook owns storage
74
+ onExtracted: async ({ current, threadId }) => {
75
+ await sessionRecords.upsert({ sessionId: threadId, record: current })
76
+ },
77
+ })
78
+
79
+ export async function onSessionEnd(messages: MastraDBMessage[]) {
80
+ const { summary, extracted, extractionFailures } = await summarizeConversation({
81
+ model: 'openai/gpt-5-mini',
82
+ messages,
83
+ instructions: 'Summarize this support session for the account manager.',
84
+ extract: [sessionSummary],
85
+ })
86
+
87
+ if (extractionFailures?.length) {
88
+ console.warn('Some extractors failed', extractionFailures)
89
+ }
90
+
91
+ return { summary, extracted }
92
+ }
93
+ ```
94
+
95
+ ### Related
96
+
97
+ - [.summarizeThread()](https://mastra.ai/reference/memory/summarizeThread)
98
+ - [Memory Class Reference](https://mastra.ai/reference/memory/memory-class)
99
+ - [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
@@ -0,0 +1,93 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Memory.summarizeThread()
4
+
5
+ The `.summarizeThread()` method summarizes a thread's conversation in one shot. It loads the thread's messages from storage and distills them with the same Observer plumbing that powers [Observational Memory](https://mastra.ai/reference/memory/observational-memory) — as a standalone call, without Observational Memory attached to an agent.
6
+
7
+ Messages load page-by-page starting from the newest, bounded by `lastMessages` and `maxInputTokens`, so summarizing a long thread doesn't read its entire history from storage.
8
+
9
+ Nothing is written back to memory. The summary and extracted values are returned to you (and to each extractor's `onExtracted` hook), so you decide where they go — for example your own database.
10
+
11
+ Use this when a session ends and you want a summary or structured extraction of the whole conversation, such as a voice call at hang-up. To summarize messages you already have in hand (without loading them from a thread), use the standalone [`summarizeConversation()`](https://mastra.ai/reference/memory/summarizeConversation) function instead — it takes the same options with `messages` in place of `threadId`.
12
+
13
+ ## Usage example
14
+
15
+ ```typescript
16
+ const result = await memory.summarizeThread({
17
+ model: 'openai/gpt-5-mini',
18
+ threadId: 'thread-123',
19
+ instructions: 'Summarize this voicemail call for the business owner.',
20
+ })
21
+ ```
22
+
23
+ ## Parameters
24
+
25
+ **threadId** (`string`): The unique identifier of the thread to summarize.
26
+
27
+ **model** (`string | LanguageModel | DynamicModel`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_MINI\_\_'.
28
+
29
+ **resourceId** (`string`): ID of the resource that owns the thread. If provided, validates thread ownership. Also passed to extractor contexts.
30
+
31
+ **lastMessages** (`number`): Only summarize the last N messages of the thread. By default the whole thread is loaded, bounded by maxInputTokens.
32
+
33
+ **maxInputTokens** (`number`): Stop loading older messages once the collected messages exceed this estimated token count. The newest message is always included. (Default: `1000000`)
34
+
35
+ **instructions** (`string`): Extra guidance appended to the summarizer's system prompt, such as what to focus on or who the summary is for.
36
+
37
+ **extract** (`Extractor[]`): Extractors to run over the conversation. Extractors with a Zod schema run as a follow-up structured output call; schema-less extractors are extracted inline. Each extractor's onExtracted hook fires with the extracted value.
38
+
39
+ **requestContext** (`RequestContext`): Request context forwarded to the summarizer model and extractor hooks.
40
+
41
+ **abortSignal** (`AbortSignal`): Signal to cancel the summarization call.
42
+
43
+ ## Returns
44
+
45
+ **summary** (`string`): The distilled observations produced from the conversation, in dense bullet form.
46
+
47
+ **extracted** (`Record<string, unknown>`): Values produced by extract extractors, keyed by extractor slug.
48
+
49
+ **extractionFailures** (`{ slug: string; error: string }[]`): Extractors that failed to produce a valid value, with the reason. Only present when at least one extractor failed.
50
+
51
+ **usage** (`{ inputTokens?: number; outputTokens?: number; totalTokens?: number }`): Token usage of the summarization call.
52
+
53
+ ## Extended usage example
54
+
55
+ The following example summarizes a finished voice call and stores a structured record in the application's own database:
56
+
57
+ ```typescript
58
+ import { Extractor } from '@mastra/memory'
59
+ import { z } from 'zod'
60
+ import { memory } from './mastra/memory'
61
+ import { callRecords } from './db'
62
+
63
+ const callSummary = new Extractor({
64
+ name: 'call-summary',
65
+ instructions: 'Return a concise summary of the call.',
66
+ schema: z.object({
67
+ summary: z.string(),
68
+ sentiment: z.enum(['positive', 'neutral', 'negative']),
69
+ requestedServices: z.array(z.string()),
70
+ }),
71
+ metadataKeyPath: false, // don't persist into memory metadata — the hook owns storage
72
+ onExtracted: async ({ current, threadId, resourceId }) => {
73
+ await callRecords.upsert({ callId: threadId, callerId: resourceId, record: current })
74
+ },
75
+ })
76
+
77
+ export async function onCallEnd(threadId: string, resourceId: string) {
78
+ await memory.summarizeThread({
79
+ model: 'openai/gpt-5-mini',
80
+ threadId,
81
+ resourceId,
82
+ instructions: 'Summarize this voicemail call for the business owner.',
83
+ extract: [callSummary],
84
+ })
85
+ }
86
+ ```
87
+
88
+ ### Related
89
+
90
+ - [summarizeConversation()](https://mastra.ai/reference/memory/summarizeConversation)
91
+ - [Memory Class Reference](https://mastra.ai/reference/memory/memory-class)
92
+ - [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
93
+ - [.recall()](https://mastra.ai/reference/memory/recall)
@@ -42,9 +42,9 @@ Mastra recommends organizing your code into the following folders:
42
42
  | `src/mastra/mcp` | Implement custom MCP servers to share your tools with external agents |
43
43
  | `src/mastra/scorers` | Define scorers for evaluating agent performance over time |
44
44
 
45
- There are two special folder conventions in Mastra:
45
+ Mastra has two special folder conventions:
46
46
 
47
- - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [file-based agents](https://mastra.ai/docs/agents/file-based-agents) guide.
47
+ - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/getting-started/file-based-agents) docs.
48
48
  - `src/mastra/public`: Contents are copied into the `.build/output` directory during the build process, making them available for serving at runtime.
49
49
 
50
50
  ### Top-level files
@@ -56,11 +56,4 @@ Top-level files define how your Mastra project is configured, built, and connect
56
56
  | `src/mastra/index.ts` | Central entry point where you configure and initialize Mastra. |
57
57
  | `.env.example` | Template for environment variables - copy and rename to `.env` to add your secret [model provider](https://mastra.ai/models) keys. |
58
58
  | `package.json` | Defines project metadata, dependencies, and available npm scripts. |
59
- | `tsconfig.json` | Configures TypeScript options such as path aliases, compiler settings, and build output. |
60
-
61
- ## Next steps
62
-
63
- - Read more about [Mastra's features](https://mastra.ai/docs).
64
- - Integrate Mastra with your frontend framework: [Next.js](https://mastra.ai/guides/getting-started/next-js), [React](https://mastra.ai/guides/getting-started/vite-react), or [Astro](https://mastra.ai/guides/getting-started/astro).
65
- - Build an agent from scratch following one of our [guides](https://mastra.ai/guides).
66
- - Watch conceptual guides on our [YouTube channel](https://www.youtube.com/@mastra-ai) and [subscribe](https://www.youtube.com/@mastra-ai?sub_confirmation=1)!
59
+ | `tsconfig.json` | Configures TypeScript options such as path aliases, compiler settings, and build output. |
@@ -4,7 +4,7 @@
4
4
 
5
5
  `LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/long-running-agents/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a given resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
6
6
 
7
- Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can genuinely coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that cannot lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
7
+ Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can genuinely coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that can't lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
8
8
 
9
9
  The built-in [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) implements `LeaseProvider`, which is what enables signals to coordinate across instances in distributed and serverless deployments.
10
10
 
@@ -78,7 +78,7 @@ Returns: `Promise<string | undefined>`
78
78
 
79
79
  #### `releaseLease(key, owner)`
80
80
 
81
- Releases a lease. This is a no-op if the caller is not the current owner: implementations check ownership atomically before releasing, so a concurrent renewal by another owner is never clobbered.
81
+ Releases a lease. This is a no-op if the caller isn't the current owner: implementations check ownership atomically before releasing, so a concurrent renewal by another owner is never clobbered.
82
82
 
83
83
  ```typescript
84
84
  await pubsub.releaseLease('thread:abc', runId)
@@ -117,17 +117,17 @@ if (!transferred) {
117
117
 
118
118
  Returns: `Promise<boolean>`
119
119
 
120
- > **Warning:** Backends that cannot perform the transfer atomically must still implement it as a best-effort `releaseLease(fromOwner)` followed by `acquireLease(toOwner)`, and document that the swap is non-atomic, since a racing process can win the key in the gap. Keeping the method required means callers have a single code path and atomicity is an explicit per-backend decision.
120
+ > **Warning:** Backends that can't perform the transfer atomically must still implement it as a best-effort `releaseLease(fromOwner)` followed by `acquireLease(toOwner)`, and document that the swap is non-atomic, since a racing process can win the key in the gap. Keeping the method required means callers have a single code path and atomicity is an explicit per-backend decision.
121
121
 
122
122
  ## Capability detection
123
123
 
124
124
  The signals runtime detects `LeaseProvider` structurally rather than with `instanceof`, so detection works even when a separately published backend resolves a different copy of `@mastra/core`. A value is treated as a `LeaseProvider` when it exposes all five methods (`acquireLease`, `getLeaseOwner`, `releaseLease`, `renewLease`, `transferLease`).
125
125
 
126
- When the configured pub/sub backend does not implement `LeaseProvider`, the runtime falls back to an always-win no-op provider. Every caller wins its own lease race, and release, renew, and transfer are inert, which preserves the expected single-process behavior.
126
+ When the configured pub/sub backend doesn't implement `LeaseProvider`, the runtime falls back to an always-win no-op provider. Every caller wins its own lease race, and release, renew, and transfer are inert, which preserves the expected single-process behavior.
127
127
 
128
128
  ## Related
129
129
 
130
130
  - [PubSub](https://mastra.ai/reference/pubsub/base): The event delivery contract, separate from leasing
131
131
  - [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams): The built-in backend that implements `LeaseProvider`
132
132
  - [Signals](https://mastra.ai/docs/long-running-agents/signals): The runtime that uses leasing to coordinate thread runs across processes
133
- - [Channels](https://mastra.ai/docs/agents/channels): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
133
+ - [Channels](https://mastra.ai/docs/capabilities/channels/overview): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
@@ -2,9 +2,7 @@
2
2
 
3
3
  # Express adapter
4
4
 
5
- The `@mastra/express` package provides a server adapter for running Mastra with [Express](https://expressjs.com).
6
-
7
- > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/express` package provides a server adapter for running Mastra with [Express](https://expressjs.com). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
8
6
 
9
7
  ## Installation
10
8
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  # Fastify adapter
4
4
 
5
- The `@mastra/fastify` package provides a server adapter for running Mastra with [Fastify](https://fastify.dev).
6
-
7
- > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/fastify` package provides a server adapter for running Mastra with [Fastify](https://fastify.dev). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
8
6
 
9
7
  ## Installation
10
8
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  # Hono adapter
4
4
 
5
- The `@mastra/hono` package provides a server adapter for running Mastra with [Hono](https://hono.dev).
6
-
7
- > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/hono` package provides a server adapter for running Mastra with [Hono](https://hono.dev). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
8
6
 
9
7
  ## Installation
10
8
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  # Koa adapter
4
4
 
5
- The `@mastra/koa` package provides a server adapter for running Mastra with [Koa](https://koajs.com).
6
-
7
- > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/koa` package provides a server adapter for running Mastra with [Koa](https://koajs.com). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
8
6
 
9
7
  ## Installation
10
8
 
@@ -4,9 +4,7 @@
4
4
 
5
5
  The `@mastra/nestjs` package provides a NestJS module for running Mastra with the Express-based NestJS platform.
6
6
 
7
- It's intentionally Express-only for v1. If Nest is bootstrapped with a different HTTP adapter, `MastraModule` throws during startup instead of attempting a partial integration.
8
-
9
- > **Info:** For general adapter concepts, see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
7
+ It's intentionally Express-only for v1. If Nest is bootstrapped with a different HTTP adapter, `MastraModule` throws during startup instead of attempting a partial integration. For general adapter concepts, see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
10
8
 
11
9
  ## Installation
12
10
 
@@ -40,7 +40,7 @@ Task tracking requires a memory-backed thread (`threadId` + `resourceId`). Witho
40
40
 
41
41
  ### Agent integration
42
42
 
43
- These methods are called automatically by the Agent when the provider is passed to `signals`. You normally do not call them directly.
43
+ These methods are called automatically by the Agent when the provider is passed to `signals`. You normally don't call them directly.
44
44
 
45
45
  #### `getTools()`
46
46
 
@@ -101,6 +101,38 @@ const observabilityStore = new ObservabilityStorageClickhouse({
101
101
 
102
102
  New projects should use `ObservabilityStorageClickhouseVNext` instead.
103
103
 
104
+ ### Migrating from legacy to vNext
105
+
106
+ To migrate historical spans from the legacy `mastra_ai_spans` table to the vNext schema, run:
107
+
108
+ **npm**:
109
+
110
+ ```bash
111
+ npx mastra migrate
112
+ ```
113
+
114
+ **pnpm**:
115
+
116
+ ```bash
117
+ pnpm dlx mastra migrate
118
+ ```
119
+
120
+ **Yarn**:
121
+
122
+ ```bash
123
+ yarn dlx mastra migrate
124
+ ```
125
+
126
+ **Bun**:
127
+
128
+ ```bash
129
+ bun x mastra migrate
130
+ ```
131
+
132
+ The migration copies span data from `mastra_ai_spans` into `mastra_span_events` in day-sized batches. It handles column mapping, deduplicates legacy rows, and preserves the original table as a backup. After migration, traces appear in Studio through the vNext adapter.
133
+
134
+ > **Note:** The legacy table is not deleted. Drop it manually after verifying the migration.
135
+
104
136
  ### ClickHouse for every domain
105
137
 
106
138
  `ClickhouseStoreVNext` backs the `memory`, `workflows`, and `observability` domains with ClickHouse and uses the vNext observability adapter automatically. Use it when you want ClickHouse to back the entire application without wiring a composite store manually.
@@ -211,7 +243,7 @@ When `replication` is set, Mastra rewrites its `MergeTree` and `ReplacingMergeTr
211
243
  - `zookeeperPath`: `'/clickhouse/tables/{shard}/{database}/{table}'`
212
244
  - `replicaName`: `'{replica}'`
213
245
 
214
- The defaults match the most common self-managed convention. If your cluster's existing tables use a different layout (for example `/clickhouse/tables/{shard}/{table}` without the `{database}` segment), set `zookeeperPath` explicitly to match. Mastra does not read your cluster's convention from Keeper, so a mismatched default writes Mastra's metadata to a separate branch from the rest of the cluster.
246
+ The defaults match the most common self-managed convention. If your cluster's existing tables use a different layout (for example `/clickhouse/tables/{shard}/{table}` without the `{database}` segment), set `zookeeperPath` explicitly to match. Mastra doesn't read your cluster's convention from Keeper, so a mismatched default writes Mastra's metadata to a separate branch from the rest of the cluster.
215
247
 
216
248
  ```typescript
217
249
  new ClickhouseStoreVNext({
@@ -231,7 +263,7 @@ Manual maintenance such as `optimizeTable()` and `materializeTtl()` runs on ever
231
263
 
232
264
  If existing Mastra tables use local `MergeTree` or `ReplacingMergeTree` engines, initialization fails while `replication` is enabled. Mastra refuses to silently convert local tables because copy-and-swap is unsafe across replicas. To migrate, recreate the affected tables as `Replicated*` before enabling replication. The typical sequence is: rename the local table, run `CREATE TABLE ... ENGINE = ReplicatedMergeTree(...) ON CLUSTER ...`, run `INSERT INTO ... SELECT * FROM <renamed_local>`, then drop the renamed local table.
233
265
 
234
- Do not set `replication` on ClickHouse Cloud. Cloud rewrites `MergeTree` to `SharedMergeTree` server-side, and explicit `ReplicatedMergeTree` engines produce incorrect DDL. `replication` is only for self-managed multi-replica clusters.
266
+ Don't set `replication` on ClickHouse Cloud. Cloud rewrites `MergeTree` to `SharedMergeTree` server-side, and explicit `ReplicatedMergeTree` engines produce incorrect DDL. `replication` is only for self-managed multi-replica clusters.
235
267
 
236
268
  ### Observability domain options
237
269
 
@@ -6,7 +6,7 @@ The Cloudflare D1 storage implementation provides a serverless SQL database solu
6
6
 
7
7
  > **Observability Not Supported:** Cloudflare D1 storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to D1, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with D1 as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
8
8
 
9
- > **Row Size Limit:** Cloudflare D1 enforces a **1 MiB maximum row size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
9
+ > **Row Size Limit:** Cloudflare D1 enforces a **1 MiB maximum row size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/memory-processors) for workarounds including uploading attachments to external storage.
10
10
 
11
11
  ## Installation
12
12
 
@@ -37,25 +37,25 @@ You'll also need to install the storage providers you want to compose:
37
37
  **npm**:
38
38
 
39
39
  ```bash
40
- npm install @mastra/pg@latest @mastra/libsql@latest
40
+ npm install @mastra/pg@latest @mastra/libsql@latest @mastra/mongodb@latest
41
41
  ```
42
42
 
43
43
  **pnpm**:
44
44
 
45
45
  ```bash
46
- pnpm add @mastra/pg@latest @mastra/libsql@latest
46
+ pnpm add @mastra/pg@latest @mastra/libsql@latest @mastra/mongodb@latest
47
47
  ```
48
48
 
49
49
  **Yarn**:
50
50
 
51
51
  ```bash
52
- yarn add @mastra/pg@latest @mastra/libsql@latest
52
+ yarn add @mastra/pg@latest @mastra/libsql@latest @mastra/mongodb@latest
53
53
  ```
54
54
 
55
55
  **Bun**:
56
56
 
57
57
  ```bash
58
- bun add @mastra/pg@latest @mastra/libsql@latest
58
+ bun add @mastra/pg@latest @mastra/libsql@latest @mastra/mongodb@latest
59
59
  ```
60
60
 
61
61
  ## Storage domains
@@ -124,6 +124,64 @@ export const mastra = new Mastra({
124
124
  })
125
125
  ```
126
126
 
127
+ ### Mixed backends
128
+
129
+ Use domain classes from each storage package to route different domains to different backends. The following example stores memory and workflow state in MongoDB, then routes observability to ClickHouse:
130
+
131
+ ```typescript
132
+ import { Mastra } from '@mastra/core'
133
+ import { MastraCompositeStore } from '@mastra/core/storage'
134
+ import { ObservabilityStorageClickhouse } from '@mastra/clickhouse'
135
+ import { MemoryStorageMongoDB, WorkflowsStorageMongoDB } from '@mastra/mongodb'
136
+
137
+ export const mastra = new Mastra({
138
+ storage: new MastraCompositeStore({
139
+ id: 'composite',
140
+ domains: {
141
+ memory: new MemoryStorageMongoDB({
142
+ uri: process.env.MONGODB_URI,
143
+ dbName: 'mastra_memory',
144
+ }),
145
+ workflows: new WorkflowsStorageMongoDB({
146
+ uri: process.env.MONGODB_URI,
147
+ dbName: 'mastra_workflows',
148
+ }),
149
+ observability: new ObservabilityStorageClickhouse({
150
+ url: process.env.CLICKHOUSE_URL,
151
+ username: process.env.CLICKHOUSE_USERNAME,
152
+ password: process.env.CLICKHOUSE_PASSWORD,
153
+ }),
154
+ },
155
+ }),
156
+ })
157
+ ```
158
+
159
+ ### Disabling a domain
160
+
161
+ Set a domain to `false` to disable it. A disabled domain doesn't fall back to `default`, so data for that domain isn't persisted:
162
+
163
+ ```typescript
164
+ import { MastraCompositeStore } from '@mastra/core/storage'
165
+ import { PostgresStore } from '@mastra/pg'
166
+ import { Mastra } from '@mastra/core'
167
+
168
+ const pgStore = new PostgresStore({
169
+ id: 'pg',
170
+ connectionString: process.env.DATABASE_URL,
171
+ })
172
+
173
+ export const mastra = new Mastra({
174
+ storage: new MastraCompositeStore({
175
+ id: 'composite',
176
+ default: pgStore,
177
+ domains: {
178
+ // don't persist traces and spans
179
+ observability: false,
180
+ },
181
+ }),
182
+ })
183
+ ```
184
+
127
185
  ## Options
128
186
 
129
187
  **id** (`string`): Unique identifier for this storage instance.
@@ -132,7 +190,7 @@ export const mastra = new Mastra({
132
190
 
133
191
  **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
134
192
 
135
- **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage.
193
+ **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage. Set a domain to false to disable it entirely; a disabled domain does not fall back to editor or default.
136
194
 
137
195
  **domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
138
196
 
@@ -274,6 +332,6 @@ const storage = new MastraCompositeStore({
274
332
  })
275
333
  ```
276
334
 
277
- Do not set `replication` on ClickHouse Cloud. Cloud rewrites `MergeTree` to `SharedMergeTree` server-side. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for the full config shape and operator notes.
335
+ Don't set `replication` on ClickHouse Cloud. Cloud rewrites `MergeTree` to `SharedMergeTree` server-side. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for the full config shape and operator notes.
278
336
 
279
337
  > **Info:** This approach is also required when using storage providers that don't support observability (like Convex, DynamoDB, or Cloudflare). See the [MastraStorageExporter documentation](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage) for the full list of supported providers.
@@ -6,7 +6,7 @@ The Convex storage implementation provides a serverless storage solution using [
6
6
 
7
7
  > **Observability Not Supported:** Convex storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to Convex, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
8
8
 
9
- > **Record Size Limit:** Convex enforces a **1 MiB maximum record size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage like S3, Cloudflare R2, or [Convex file storage](https://docs.convex.dev/file-storage).
9
+ > **Record Size Limit:** Convex enforces a **1 MiB maximum record size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/memory-processors) for workarounds including uploading attachments to external storage like S3, Cloudflare R2, or [Convex file storage](https://docs.convex.dev/file-storage).
10
10
 
11
11
  ## Installation
12
12
 
@@ -6,7 +6,7 @@ The DynamoDB storage implementation provides a scalable and performant NoSQL dat
6
6
 
7
7
  > **Observability Not Supported:** DynamoDB storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to DynamoDB, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with DynamoDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
8
8
 
9
- > **Item Size Limit:** DynamoDB enforces a **400 KB maximum item size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
9
+ > **Item Size Limit:** DynamoDB enforces a **400 KB maximum item size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/memory-processors) for workarounds including uploading attachments to external storage.
10
10
 
11
11
  ## Features
12
12