@mastra/mcp-docs-server 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012

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 (285) hide show
  1. package/.docs/docs/agents/adding-voice.md +18 -17
  2. package/.docs/docs/agents/background-tasks.md +242 -0
  3. package/.docs/docs/agents/channels.md +2 -1
  4. package/.docs/docs/agents/overview.md +4 -0
  5. package/.docs/docs/agents/processors.md +177 -5
  6. package/.docs/docs/agents/structured-output.md +66 -1
  7. package/.docs/docs/agents/supervisor-agents.md +65 -0
  8. package/.docs/docs/agents/using-tools.md +73 -0
  9. package/.docs/docs/browser/agent-browser.md +78 -0
  10. package/.docs/docs/browser/browser-viewer.md +144 -0
  11. package/.docs/docs/browser/overview.md +168 -0
  12. package/.docs/docs/browser/stagehand.md +129 -0
  13. package/.docs/docs/deployment/cloud-providers.md +5 -1
  14. package/.docs/docs/deployment/mastra-server.md +4 -4
  15. package/.docs/docs/deployment/monorepo.md +3 -3
  16. package/.docs/docs/deployment/overview.md +11 -8
  17. package/.docs/docs/editor/overview.md +290 -0
  18. package/.docs/docs/editor/prompts.md +134 -0
  19. package/.docs/docs/editor/tools.md +152 -0
  20. package/.docs/docs/evals/custom-scorers.md +63 -3
  21. package/.docs/docs/evals/datasets/overview.md +1 -1
  22. package/.docs/docs/index.md +2 -2
  23. package/.docs/docs/mastra-platform/configuration.md +36 -0
  24. package/.docs/docs/mastra-platform/overview.md +78 -0
  25. package/.docs/docs/mcp/overview.md +17 -0
  26. package/.docs/docs/memory/memory-processors.md +3 -3
  27. package/.docs/docs/memory/message-history.md +8 -2
  28. package/.docs/docs/memory/observational-memory.md +65 -8
  29. package/.docs/docs/memory/storage.md +1 -2
  30. package/.docs/docs/memory/working-memory.md +2 -2
  31. package/.docs/docs/observability/logging.md +1 -1
  32. package/.docs/docs/observability/metrics/overview.md +2 -2
  33. package/.docs/docs/observability/overview.md +1 -1
  34. package/.docs/docs/observability/tracing/bridges/datadog.md +217 -0
  35. package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
  36. package/.docs/docs/observability/tracing/exporters/arthur.md +163 -0
  37. package/.docs/docs/observability/tracing/exporters/cloud.md +135 -63
  38. package/.docs/docs/observability/tracing/exporters/datadog.md +3 -1
  39. package/.docs/docs/observability/tracing/exporters/default.md +5 -5
  40. package/.docs/docs/observability/tracing/exporters/laminar.md +22 -14
  41. package/.docs/docs/observability/tracing/exporters/langfuse.md +50 -33
  42. package/.docs/docs/observability/tracing/overview.md +87 -20
  43. package/.docs/docs/server/custom-adapters.md +5 -5
  44. package/.docs/docs/server/custom-api-routes.md +3 -3
  45. package/.docs/docs/server/mastra-client.md +2 -2
  46. package/.docs/docs/server/mastra-server.md +1 -1
  47. package/.docs/docs/server/middleware.md +46 -42
  48. package/.docs/docs/server/request-context.md +13 -2
  49. package/.docs/docs/server/server-adapters.md +91 -8
  50. package/.docs/docs/streaming/background-task-streaming.md +80 -0
  51. package/.docs/docs/streaming/overview.md +3 -0
  52. package/.docs/docs/studio/deployment.md +24 -6
  53. package/.docs/docs/studio/observability.md +1 -1
  54. package/.docs/docs/studio/overview.md +4 -4
  55. package/.docs/docs/voice/overview.md +74 -5
  56. package/.docs/docs/voice/speech-to-speech.md +45 -1
  57. package/.docs/docs/voice/speech-to-text.md +7 -7
  58. package/.docs/docs/voice/text-to-speech.md +10 -10
  59. package/.docs/docs/workflows/agents-and-tools.md +1 -1
  60. package/.docs/docs/workflows/overview.md +105 -4
  61. package/.docs/docs/workflows/scheduled-workflows.md +181 -0
  62. package/.docs/docs/workspace/filesystem.md +64 -6
  63. package/.docs/docs/workspace/lsp.md +76 -4
  64. package/.docs/docs/workspace/overview.md +62 -15
  65. package/.docs/docs/workspace/sandbox.md +3 -1
  66. package/.docs/docs/workspace/search.md +41 -2
  67. package/.docs/docs/workspace/skills.md +19 -19
  68. package/.docs/guides/agent-frameworks/ai-sdk.md +4 -4
  69. package/.docs/guides/build-your-ui/ai-sdk-ui.md +56 -9
  70. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  71. package/.docs/guides/deployment/mastra-platform.md +191 -0
  72. package/.docs/guides/deployment/netlify.md +16 -1
  73. package/.docs/guides/getting-started/nestjs.md +238 -0
  74. package/.docs/guides/getting-started/next-js.md +0 -4
  75. package/.docs/guides/guide/code-review-bot.md +2 -2
  76. package/.docs/guides/guide/dev-assistant.md +4 -4
  77. package/.docs/{docs/mcp → guides/guide}/publishing-mcp-server.md +21 -1
  78. package/.docs/guides/guide/slack-assistant.md +191 -0
  79. package/.docs/guides/migrations/mastra-cloud.md +368 -0
  80. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
  81. package/.docs/models/embeddings.md +3 -3
  82. package/.docs/models/gateways/azure-openai.md +74 -35
  83. package/.docs/models/gateways/mastra.md +64 -0
  84. package/.docs/models/gateways/netlify.md +7 -3
  85. package/.docs/models/gateways/openrouter.md +28 -12
  86. package/.docs/models/gateways/vercel.md +22 -2
  87. package/.docs/models/gateways.md +1 -0
  88. package/.docs/models/index.md +43 -8
  89. package/.docs/models/providers/302ai.md +37 -4
  90. package/.docs/models/providers/abliteration-ai.md +71 -0
  91. package/.docs/models/providers/alibaba-cn.md +8 -2
  92. package/.docs/models/providers/alibaba-coding-plan-cn.md +3 -2
  93. package/.docs/models/providers/alibaba-coding-plan.md +3 -2
  94. package/.docs/models/providers/alibaba.md +8 -1
  95. package/.docs/models/providers/anthropic.md +18 -5
  96. package/.docs/models/providers/baseten.md +3 -1
  97. package/.docs/models/providers/berget.md +10 -12
  98. package/.docs/models/providers/chutes.md +4 -2
  99. package/.docs/models/providers/cloudflare-workers-ai.md +14 -48
  100. package/.docs/models/providers/cortecs.md +22 -2
  101. package/.docs/models/providers/deepinfra.md +8 -2
  102. package/.docs/models/providers/deepseek.md +6 -4
  103. package/.docs/models/providers/digitalocean.md +133 -0
  104. package/.docs/models/providers/fireworks-ai.md +6 -1
  105. package/.docs/models/providers/firmware.md +12 -10
  106. package/.docs/models/providers/friendli.md +6 -7
  107. package/.docs/models/providers/google.md +9 -3
  108. package/.docs/models/providers/helicone.md +1 -2
  109. package/.docs/models/providers/hpc-ai.md +73 -0
  110. package/.docs/models/providers/huggingface.md +6 -2
  111. package/.docs/models/providers/inception.md +9 -11
  112. package/.docs/models/providers/kilo.md +359 -339
  113. package/.docs/models/providers/kimi-for-coding.md +2 -1
  114. package/.docs/models/providers/llmgateway.md +67 -77
  115. package/.docs/models/providers/mistral.md +3 -2
  116. package/.docs/models/providers/mixlayer.md +75 -0
  117. package/.docs/models/providers/moonshotai-cn.md +3 -2
  118. package/.docs/models/providers/moonshotai.md +3 -2
  119. package/.docs/models/providers/nano-gpt.md +8 -2
  120. package/.docs/models/providers/neuralwatt.md +84 -0
  121. package/.docs/models/providers/novita-ai.md +19 -4
  122. package/.docs/models/providers/nvidia.md +8 -1
  123. package/.docs/models/providers/ollama-cloud.md +7 -2
  124. package/.docs/models/providers/openai.md +7 -2
  125. package/.docs/models/providers/opencode-go.md +21 -13
  126. package/.docs/models/providers/opencode.md +11 -4
  127. package/.docs/models/providers/ovhcloud.md +6 -8
  128. package/.docs/models/providers/poe.md +10 -15
  129. package/.docs/models/providers/regolo-ai.md +83 -0
  130. package/.docs/models/providers/siliconflow-cn.md +5 -2
  131. package/.docs/models/providers/siliconflow.md +6 -3
  132. package/.docs/models/providers/stepfun.md +8 -7
  133. package/.docs/models/providers/synthetic.md +5 -2
  134. package/.docs/models/providers/tencent-token-plan.md +71 -0
  135. package/.docs/models/providers/tencent-tokenhub.md +71 -0
  136. package/.docs/models/providers/togetherai.md +8 -7
  137. package/.docs/models/providers/vivgrid.md +7 -3
  138. package/.docs/models/providers/vultr.md +7 -6
  139. package/.docs/models/providers/wafer.ai.md +73 -0
  140. package/.docs/models/providers/wandb.md +3 -2
  141. package/.docs/models/providers/xai.md +6 -1
  142. package/.docs/models/providers/xiaomi-token-plan-ams.md +75 -0
  143. package/.docs/models/providers/xiaomi-token-plan-cn.md +75 -0
  144. package/.docs/models/providers/xiaomi-token-plan-sgp.md +75 -0
  145. package/.docs/models/providers/xiaomi.md +4 -2
  146. package/.docs/models/providers/zai-coding-plan.md +11 -19
  147. package/.docs/models/providers/zai.md +2 -1
  148. package/.docs/models/providers/zenmux.md +17 -6
  149. package/.docs/models/providers/zhipuai-coding-plan.md +11 -21
  150. package/.docs/models/providers/zhipuai.md +2 -1
  151. package/.docs/models/providers.md +11 -0
  152. package/.docs/reference/agents/agent.md +1 -1
  153. package/.docs/reference/agents/channels.md +3 -3
  154. package/.docs/reference/agents/generate.md +88 -6
  155. package/.docs/reference/agents/generateLegacy.md +1 -1
  156. package/.docs/reference/ai-sdk/chat-route.md +2 -0
  157. package/.docs/reference/ai-sdk/handle-chat-stream.md +19 -0
  158. package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
  159. package/.docs/reference/ai-sdk/network-route.md +2 -0
  160. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +95 -0
  161. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +15 -0
  162. package/.docs/reference/browser/agent-browser.md +375 -0
  163. package/.docs/reference/browser/browser-viewer.md +228 -0
  164. package/.docs/reference/browser/mastra-browser.md +286 -0
  165. package/.docs/reference/browser/stagehand-browser.md +286 -0
  166. package/.docs/reference/cli/mastra.md +703 -0
  167. package/.docs/reference/client-js/agents.md +166 -0
  168. package/.docs/reference/client-js/conversations.md +1 -1
  169. package/.docs/reference/client-js/mastra-client.md +23 -0
  170. package/.docs/reference/client-js/observability.md +2 -2
  171. package/.docs/reference/client-js/responses.md +1 -1
  172. package/.docs/reference/client-js/workflows.md +62 -1
  173. package/.docs/reference/configuration.md +67 -1
  174. package/.docs/reference/core/addGateway.md +5 -5
  175. package/.docs/reference/core/getEditor.md +35 -0
  176. package/.docs/reference/core/getGateway.md +5 -5
  177. package/.docs/reference/core/getGatewayById.md +5 -5
  178. package/.docs/reference/core/getMCPServer.md +2 -2
  179. package/.docs/reference/core/getMCPServerById.md +2 -2
  180. package/.docs/reference/core/getScorer.md +3 -3
  181. package/.docs/reference/core/getScorerById.md +3 -3
  182. package/.docs/reference/core/listGateways.md +5 -5
  183. package/.docs/reference/core/listMCPServers.md +2 -2
  184. package/.docs/reference/core/listScorers.md +3 -3
  185. package/.docs/reference/core/mastra-class.md +11 -1
  186. package/.docs/reference/core/mastra-model-gateway.md +5 -5
  187. package/.docs/reference/datasets/create.md +4 -4
  188. package/.docs/reference/datasets/startExperiment.md +28 -2
  189. package/.docs/reference/datasets/update.md +4 -4
  190. package/.docs/reference/deployer/cloudflare.md +14 -1
  191. package/.docs/reference/deployer/netlify.md +50 -2
  192. package/.docs/reference/editor/mastra-editor.md +168 -0
  193. package/.docs/reference/editor/tool-provider.md +85 -0
  194. package/.docs/reference/evals/context-precision.md +3 -3
  195. package/.docs/reference/evals/context-relevance.md +3 -3
  196. package/.docs/reference/evals/create-scorer.md +5 -3
  197. package/.docs/reference/evals/filter-run.md +117 -0
  198. package/.docs/reference/evals/mastra-scorer.md +4 -4
  199. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  200. package/.docs/reference/evals/prompt-alignment.md +12 -12
  201. package/.docs/reference/evals/run-evals.md +6 -6
  202. package/.docs/reference/evals/scorer-utils.md +3 -3
  203. package/.docs/reference/evals/trajectory-accuracy.md +3 -3
  204. package/.docs/reference/harness/harness-class.md +152 -53
  205. package/.docs/reference/index.md +25 -0
  206. package/.docs/reference/logging/pino-logger.md +0 -2
  207. package/.docs/reference/mastra-platform/api.md +108 -0
  208. package/.docs/reference/memory/clone-utilities.md +4 -2
  209. package/.docs/reference/memory/cloneThread.md +4 -2
  210. package/.docs/reference/memory/observational-memory.md +4 -0
  211. package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
  212. package/.docs/reference/observability/tracing/bridges/datadog.md +211 -0
  213. package/.docs/reference/observability/tracing/bridges/otel.md +3 -3
  214. package/.docs/reference/observability/tracing/configuration.md +18 -11
  215. package/.docs/reference/observability/tracing/exporters/arthur.md +122 -0
  216. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +102 -21
  217. package/.docs/reference/observability/tracing/exporters/console-exporter.md +8 -8
  218. package/.docs/reference/observability/tracing/exporters/datadog.md +3 -1
  219. package/.docs/reference/observability/tracing/exporters/default-exporter.md +8 -8
  220. package/.docs/reference/observability/tracing/exporters/langfuse.md +25 -32
  221. package/.docs/reference/observability/tracing/exporters/otel.md +3 -3
  222. package/.docs/reference/observability/tracing/instances.md +7 -7
  223. package/.docs/reference/observability/tracing/interfaces.md +23 -6
  224. package/.docs/reference/observability/tracing/span-filtering.md +95 -0
  225. package/.docs/reference/observability/tracing/spans.md +6 -6
  226. package/.docs/reference/processors/prefill-error-handler.md +70 -0
  227. package/.docs/reference/processors/processor-interface.md +400 -40
  228. package/.docs/reference/processors/skill-search-processor.md +20 -1
  229. package/.docs/reference/processors/stream-error-retry-processor.md +54 -0
  230. package/.docs/reference/processors/tool-call-filter.md +23 -0
  231. package/.docs/reference/server/create-route.md +3 -3
  232. package/.docs/reference/server/express-adapter.md +4 -4
  233. package/.docs/reference/server/fastify-adapter.md +4 -4
  234. package/.docs/reference/server/hono-adapter.md +4 -4
  235. package/.docs/reference/server/koa-adapter.md +4 -4
  236. package/.docs/reference/server/mastra-server.md +3 -3
  237. package/.docs/reference/server/nestjs-adapter.md +169 -0
  238. package/.docs/reference/server/register-api-route.md +4 -4
  239. package/.docs/reference/server/routes.md +11 -10
  240. package/.docs/reference/storage/clickhouse.md +300 -0
  241. package/.docs/reference/storage/cloudflare-d1.md +42 -42
  242. package/.docs/reference/storage/composite.md +5 -3
  243. package/.docs/reference/storage/duckdb.md +150 -0
  244. package/.docs/reference/storage/overview.md +1 -1
  245. package/.docs/reference/storage/redis.md +266 -0
  246. package/.docs/reference/streaming/ChunkType.md +143 -3
  247. package/.docs/reference/streaming/agents/MastraModelOutput.md +2 -2
  248. package/.docs/reference/streaming/agents/stream.md +10 -2
  249. package/.docs/reference/streaming/agents/streamUntilIdle.md +94 -0
  250. package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
  251. package/.docs/reference/templates/overview.md +88 -14
  252. package/.docs/reference/tools/create-tool.md +107 -5
  253. package/.docs/reference/tools/mcp-client.md +45 -0
  254. package/.docs/reference/tools/mcp-server.md +1 -3
  255. package/.docs/reference/tools/perplexity.md +155 -0
  256. package/.docs/reference/tools/tavily.md +307 -0
  257. package/.docs/reference/vectors/mongodb.md +0 -2
  258. package/.docs/reference/voice/aws-nova-sonic.md +247 -0
  259. package/.docs/reference/voice/cloudflare.md +3 -3
  260. package/.docs/reference/voice/sarvam.md +29 -23
  261. package/.docs/reference/voice/voice.connect.md +4 -4
  262. package/.docs/reference/voice/voice.listen.md +3 -3
  263. package/.docs/reference/workflows/run-methods/resume.md +24 -0
  264. package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
  265. package/.docs/reference/workflows/step.md +88 -7
  266. package/.docs/reference/workflows/workflow-methods/foreach.md +14 -1
  267. package/.docs/reference/workflows/workflow.md +88 -4
  268. package/.docs/reference/workspace/azure-blob-filesystem.md +219 -0
  269. package/.docs/reference/workspace/docker-sandbox.md +196 -0
  270. package/.docs/reference/workspace/gcs-filesystem.md +1 -0
  271. package/.docs/reference/workspace/google-drive-filesystem.md +185 -0
  272. package/.docs/reference/workspace/modal-sandbox.md +168 -0
  273. package/.docs/reference/workspace/process-manager.md +1 -1
  274. package/.docs/reference/workspace/s3-filesystem.md +80 -5
  275. package/.docs/reference/workspace/vercel.md +1 -1
  276. package/.docs/reference/workspace/workspace-class.md +37 -6
  277. package/CHANGELOG.md +500 -4
  278. package/dist/stdio.js.map +1 -1
  279. package/dist/utils.d.ts +1 -4
  280. package/dist/utils.d.ts.map +1 -1
  281. package/package.json +11 -11
  282. package/.docs/docs/mastra-cloud/deployment.md +0 -77
  283. package/.docs/docs/mastra-cloud/observability.md +0 -38
  284. package/.docs/docs/mastra-cloud/overview.md +0 -23
  285. package/.docs/docs/mastra-cloud/setup.md +0 -42
@@ -83,6 +83,45 @@ const workspace = new Workspace({
83
83
  })
84
84
  ```
85
85
 
86
+ ### Batch embedding
87
+
88
+ The embedder above takes one text at a time. Indexing a workspace with hundreds of files calls the provider hundreds of times, which is slow and expensive.
89
+
90
+ When the provider supports batching (for example, OpenAI's `embedMany`), pass an embedder that takes an array of texts and accepts many embeddings back in one call. To opt in, set a `batch: true` property on the function. Mastra checks for that property at runtime and switches to the batched path.
91
+
92
+ The following example replaces the single-text embedder with a batched one. The embedder function takes an array, returns an array of embeddings in the same order, and carries two extra properties:
93
+
94
+ - `batch: true`: marks the function as batch-capable. Without this property, Mastra calls it one text at a time.
95
+ - `maxBatchSize`: the largest array the provider accepts in one call. Mastra splits larger requests into chunks of this size and sends them in parallel. Set this to your provider's documented limit (for example, 2048 for OpenAI, 96 for Cohere, 128 for Voyage). Omit it to send every pending text in one request.
96
+
97
+ ```typescript
98
+ import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
99
+ import { PineconeVector } from '@mastra/pinecone'
100
+ import { embedMany } from 'ai'
101
+ import { openai } from '@ai-sdk/openai'
102
+
103
+ const model = openai.embedding('text-embedding-3-small')
104
+
105
+ const workspace = new Workspace({
106
+ filesystem: new LocalFilesystem({ basePath: './workspace' }),
107
+ vectorStore: new PineconeVector({
108
+ apiKey: process.env.PINECONE_API_KEY,
109
+ index: 'workspace-index',
110
+ }),
111
+ embedder: Object.assign(
112
+ async (texts: string[]) => {
113
+ const { embeddings } = await embedMany({ model, values: texts })
114
+ return embeddings
115
+ },
116
+ { batch: true as const, maxBatchSize: 2048 },
117
+ ),
118
+ })
119
+ ```
120
+
121
+ `Object.assign` adds the `batch` and `maxBatchSize` properties to the embedder function. Mastra reads them as metadata and never passes them to the provider.
122
+
123
+ Single-text embedders still work. The function signature `(text: string) => Promise<number[]>` is unchanged, so existing code keeps running without modification.
124
+
86
125
  ## Hybrid search
87
126
 
88
127
  Configure both BM25 and vector search to enable hybrid mode, which combines keyword matching with semantic understanding.
@@ -143,7 +182,7 @@ Configure `autoIndexPaths` to automatically index files when the workspace initi
143
182
  const workspace = new Workspace({
144
183
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
145
184
  bm25: true,
146
- autoIndexPaths: ['/docs', '/support/faq'],
185
+ autoIndexPaths: ['docs', 'support/faq'],
147
186
  })
148
187
 
149
188
  await workspace.init()
@@ -157,7 +196,7 @@ Glob patterns let you index specific file types:
157
196
  const workspace = new Workspace({
158
197
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
159
198
  bm25: true,
160
- autoIndexPaths: ['/docs/**/*.md', '/support/**/*.txt'],
199
+ autoIndexPaths: ['docs/**/*.md', 'support/**/*.txt'],
161
200
  })
162
201
  ```
163
202
 
@@ -12,13 +12,13 @@ A skill is a folder containing:
12
12
  - `assets/`: Images and other files (optional)
13
13
 
14
14
  ```plaintext
15
- /skills
16
- /code-review
15
+ skills/
16
+ code-review/
17
17
  SKILL.md
18
- /references
18
+ references/
19
19
  style-guide.md
20
20
  pr-checklist.md
21
- /scripts
21
+ scripts/
22
22
  lint.ts
23
23
  ```
24
24
 
@@ -64,18 +64,18 @@ import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
64
64
 
65
65
  const workspace = new Workspace({
66
66
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
67
- skills: ['/skills'],
67
+ skills: ['skills'],
68
68
  })
69
69
  ```
70
70
 
71
- The `skills` directory is relative to your `basePath`. You can specify multiple skill directories or use glob patterns for discovery:
71
+ You can specify multiple skill directories:
72
72
 
73
73
  ```typescript
74
74
  const workspace = new Workspace({
75
75
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
76
76
  skills: [
77
- '/skills', // Project skills
78
- '/team-skills', // Shared team skills
77
+ 'skills', // Project skills
78
+ 'team-skills', // Shared team skills
79
79
  ],
80
80
  })
81
81
  ```
@@ -85,7 +85,7 @@ You can also pass a direct path to a skill directory or `SKILL.md` file:
85
85
  ```typescript
86
86
  const workspace = new Workspace({
87
87
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
88
- skills: ['/path/to/my-skill'],
88
+ skills: ['path/to/my-skill'],
89
89
  })
90
90
  ```
91
91
 
@@ -105,10 +105,10 @@ For dynamic skill paths based on context, pass a function:
105
105
  ```typescript
106
106
  const workspace = new Workspace({
107
107
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
108
- skills: context => {
109
- const paths = ['/skills']
110
- if (context.user?.role === 'developer') {
111
- paths.push('/dev-skills')
108
+ skills: ctx => {
109
+ const paths = ['skills']
110
+ if (ctx.requestContext?.get('userRole') === 'developer') {
111
+ paths.push('dev-skills')
112
112
  }
113
113
  return paths
114
114
  },
@@ -142,7 +142,7 @@ const workspace = new Workspace({
142
142
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
143
143
  skills: [
144
144
  'node_modules/@myorg/skills', // external: provides "brand-guidelines"
145
- '/skills', // local: also provides "brand-guidelines"
145
+ 'skills', // local: also provides "brand-guidelines"
146
146
  ],
147
147
  })
148
148
 
@@ -157,7 +157,7 @@ If BM25 or vector search is enabled on the workspace, skills are automatically i
157
157
  ```typescript
158
158
  const workspace = new Workspace({
159
159
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
160
- skills: ['/skills'],
160
+ skills: ['skills'],
161
161
  bm25: true,
162
162
  })
163
163
  ```
@@ -174,16 +174,16 @@ import { VersionedSkillSource } from '@mastra/core/workspace'
174
174
 
175
175
  const workspace = new Workspace({
176
176
  filesystem: new LocalFilesystem({ basePath: './workspace' }),
177
- skills: ['/skills'],
177
+ skills: ['skills'],
178
178
  skillSource: new VersionedSkillSource(versionTree, blobStore, versionCreatedAt),
179
179
  })
180
180
  ```
181
181
 
182
182
  `VersionedSkillSource` accepts three parameters:
183
183
 
184
- - **`versionTree`** (`SkillVersionTree`) — A manifest mapping relative file paths to blob entries (`{ entries: Record<string, { blobHash, size, mimeType?, encoding? }> }`).
185
- - **`blobStore`** (`BlobStore`) — A content-addressable blob store instance that holds the actual file contents referenced by hash.
186
- - **`versionCreatedAt`** (`Date`) — The timestamp when this skill version was published. Used as the modification time for all files in the version.
184
+ - **`versionTree`** (`SkillVersionTree`): A manifest mapping relative file paths to blob entries (`{ entries: Record<string, { blobHash, size, mimeType?, encoding? }> }`).
185
+ - **`blobStore`** (`BlobStore`): A content-addressable blob store instance that holds the actual file contents referenced by hash.
186
+ - **`versionCreatedAt`** (`Date`): The timestamp when this skill version was published. Used as the modification time for all files in the version.
187
187
 
188
188
  When `skillSource` is provided, it's used instead of the workspace filesystem for skill discovery.
189
189
 
@@ -134,7 +134,7 @@ const { text } = await generateText({
134
134
 
135
135
  ## Related
136
136
 
137
- - [`withMastra()`](https://mastra.ai/reference/ai-sdk/with-mastra) - API reference for `withMastra()`
138
- - [Processors](https://mastra.ai/docs/agents/processors) - Learn about input and output processors
139
- - [Memory](https://mastra.ai/docs/memory/overview) - Overview of Mastra's memory system
140
- - [AI SDK UI](https://mastra.ai/guides/build-your-ui/ai-sdk-ui) - Using AI SDK UI hooks with Mastra agents, workflows, and networks
137
+ - [`withMastra()`](https://mastra.ai/reference/ai-sdk/with-mastra): API reference for `withMastra()`
138
+ - [Processors](https://mastra.ai/docs/agents/processors): Learn about input and output processors
139
+ - [Memory](https://mastra.ai/docs/memory/overview): Overview of Mastra's memory system
140
+ - [AI SDK UI](https://mastra.ai/guides/build-your-ui/ai-sdk-ui): Using AI SDK UI hooks with Mastra agents, workflows, and networks
@@ -238,6 +238,40 @@ export default function Chat() {
238
238
 
239
239
  Use [`prepareSendMessagesRequest`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/use-chat#transport.default-chat-transport.prepare-send-messages-request) to customize the request sent to the chat route, for example to pass additional configuration to the agent.
240
240
 
241
+ ## Using Mastra Memory
242
+
243
+ When your agent has [memory](https://mastra.ai/docs/memory/overview) configured, Mastra loads conversation history from storage on the server. Send only the new message from the client instead of the full conversation history.
244
+
245
+ Sending the full history is redundant and can cause message-ordering bugs because client-side timestamps can conflict with the timestamps stored in your database.
246
+
247
+ ```typescript
248
+ import { useChat } from '@ai-sdk/react'
249
+ import { DefaultChatTransport } from 'ai'
250
+
251
+ const { messages, sendMessage } = useChat({
252
+ transport: new DefaultChatTransport({
253
+ api: 'http://localhost:4111/chat/weatherAgent',
254
+ prepareSendMessagesRequest({ messages }) {
255
+ return {
256
+ body: {
257
+ messages: [messages[messages.length - 1]],
258
+ memory: {
259
+ thread: 'user-thread-123',
260
+ resource: 'user-123',
261
+ },
262
+ },
263
+ }
264
+ },
265
+ }),
266
+ })
267
+ ```
268
+
269
+ Set `memory.thread` and `memory.resource` from your app's own state, such as URL params, auth context, or your database.
270
+
271
+ See [Message history](https://mastra.ai/docs/memory/message-history) for more on how Mastra memory loads and stores messages.
272
+
273
+ [`chatRoute()`](https://mastra.ai/reference/ai-sdk/chat-route) and [`handleChatStream()`](https://mastra.ai/reference/ai-sdk/handle-chat-stream) already work with memory. Configure the client to send only the new message and include the thread and resource identifiers.
274
+
241
275
  ### `useCompletion()`
242
276
 
243
277
  The `useCompletion()` hook handles single-turn completions between your frontend and a Mastra agent, allowing you to send a prompt and receive a streamed response over HTTP.
@@ -360,7 +394,8 @@ Mastra streams data to the frontend as "parts" within messages. Each part has a
360
394
  | Data Part Type | Source | Description |
361
395
  | -------------------- | ----------------------- | ---------------------------------------------------------------------------------- |
362
396
  | `tool-{toolKey}` | AI SDK built-in | Tool invocation with states: `input-available`, `output-available`, `output-error` |
363
- | `data-workflow` | `workflowRoute()` | Workflow execution with step inputs, outputs, and status |
397
+ | `data-workflow` | `workflowRoute()` | Workflow execution state snapshots with step status and final outputs |
398
+ | `data-workflow-step` | `workflowRoute()` | Workflow step delta with the full payload for the step that just changed |
364
399
  | `data-network` | `networkRoute()` | Agent network execution with ordered steps and outputs |
365
400
  | `data-tool-agent` | Nested agent in tool | Agent output streamed from within a tool's `execute()` |
366
401
  | `data-tool-workflow` | Nested workflow in tool | Workflow output streamed from within a tool's `execute()` |
@@ -473,11 +508,11 @@ export function Chat() {
473
508
 
474
509
  ### Rendering workflow data
475
510
 
476
- When using `workflowRoute()` or `handleWorkflowStream()`, Mastra emits `data-workflow` parts that contain the workflow's execution state, including step statuses and outputs.
511
+ When using `workflowRoute()` or `handleWorkflowStream()`, Mastra emits `data-workflow` parts for workflow state snapshots and `data-workflow-step` parts for the full payload of the step that just changed. This keeps long-running workflows from repeating every completed step output in every intermediate snapshot.
477
512
 
478
513
  **Backend**:
479
514
 
480
- Define a workflow with multiple steps that will emit `data-workflow` parts as it executes.
515
+ Define a workflow with multiple steps that will emit `data-workflow` and `data-workflow-step` parts as it executes.
481
516
 
482
517
  ```typescript
483
518
  import { createStep, createWorkflow } from '@mastra/core/workflows'
@@ -552,14 +587,15 @@ export const mastra = new Mastra({
552
587
 
553
588
  **Frontend**:
554
589
 
555
- Check for `data-workflow` parts and render each step's status and output using the `WorkflowDataPart` type for type safety.
590
+ Check for `data-workflow` parts to render workflow status snapshots. If you need the full payload for the step that just changed, also read `data-workflow-step` parts.
556
591
 
557
592
  ```typescript
558
593
  import { useChat } from '@ai-sdk/react'
559
594
  import { DefaultChatTransport } from 'ai'
560
- import type { WorkflowDataPart } from '@mastra/ai-sdk'
595
+ import type { WorkflowDataPart, WorkflowStepDataPart } from '@mastra/ai-sdk'
561
596
 
562
597
  type WorkflowData = WorkflowDataPart['data']
598
+ type WorkflowStepData = WorkflowStepDataPart['data']
563
599
  type StepStatus = 'running' | 'success' | 'failed' | 'suspended' | 'waiting'
564
600
 
565
601
  function StepIndicator({
@@ -620,6 +656,17 @@ export function WorkflowChat() {
620
656
  </div>
621
657
  )
622
658
  }
659
+ if (part.type === 'data-workflow-step') {
660
+ const stepData = part.data as WorkflowStepData
661
+ return (
662
+ <StepIndicator
663
+ key={index}
664
+ name={stepData.step.name}
665
+ status={stepData.step.status}
666
+ output={stepData.step.output}
667
+ />
668
+ )
669
+ }
623
670
  return null
624
671
  })}
625
672
  </div>
@@ -865,10 +912,10 @@ Tools can also stream data using `context.writer.write()` for lower-level contro
865
912
 
866
913
  For live examples of Custom UI patterns, visit [Mastra's UI Dojo](https://ui-dojo.mastra.ai/). The repository includes implementations for:
867
914
 
868
- - [Generative UIs](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/generative-user-interfaces.tsx) - Custom components for tool outputs
869
- - [Workflows](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/workflow.tsx) - Workflow step visualization
870
- - [Agent Networks](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/network.tsx) - Network execution display
871
- - [Custom Events](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/generative-user-interfaces-with-custom-events.tsx) - Progress indicators with custom events
915
+ - [Generative UIs](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/generative-user-interfaces.tsx): Custom components for tool outputs
916
+ - [Workflows](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/workflow.tsx): Workflow step visualization
917
+ - [Agent Networks](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/network.tsx): Network execution display
918
+ - [Custom Events](https://github.com/mastra-ai/ui-dojo/blob/main/src/pages/ai-sdk/generative-user-interfaces-with-custom-events.tsx): Progress indicators with custom events
872
919
 
873
920
  ## Recipes
874
921
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Assistant UI](https://assistant-ui.com) is the TypeScript/React library for AI Chat. Built on shadcn/ui and Tailwind CSS, it enables developers to create beautiful, enterprise-grade chat experiences in minutes.
4
4
 
5
- > **Info:** For a full-stack integration approach where Mastra runs directly in your Next.js API routes, see the [Full-Stack Integration Guide](https://www.assistant-ui.com/docs/runtimes/mastra/full-stack-integration) on Assistant UI's documentation site.
5
+ > **Info:** For a full-stack integration approach where Mastra runs directly in your Next.js API routes, see the [Full-Stack Integration Guide](https://www.assistant-ui.com/docs/integrations/frameworks/mastra/full-stack) on Assistant UI's documentation site.
6
6
 
7
7
  > **Tip:** Visit Mastra's [**"UI Dojo"**](https://ui-dojo.mastra.ai/) to see real-world examples of Assistant UI integrated with Mastra.
8
8
 
@@ -0,0 +1,191 @@
1
+ # Deploy to Mastra platform
2
+
3
+ Mastra Server deploys your application as a production API server on cloud infrastructure. You get a stable API endpoint, environment variable management, custom domain support, and deploy history out of the box.
4
+
5
+ > **Tip:** This guide covers deploying the standalone server generated by `mastra build`. If you need to deploy Studio to the Mastra platform, see [Studio deployment](https://mastra.ai/docs/studio/deployment) instead.
6
+
7
+ ## Before you begin
8
+
9
+ You'll need a [Mastra application](https://mastra.ai/guides/getting-started/quickstart) and a [Mastra platform](https://projects.mastra.ai) account.
10
+
11
+ > **Warning:** Mastra platform uses an ephemeral filesystem, so any storage you configure (including observability storage) must be hosted externally. If you're using [LibSQLStore](https://mastra.ai/reference/storage/libsql) with a file URL, switch to a remotely hosted database.
12
+
13
+ ## Installation
14
+
15
+ Install the `mastra` CLI globally:
16
+
17
+ **npm**:
18
+
19
+ ```bash
20
+ npm install -g mastra
21
+ ```
22
+
23
+ **pnpm**:
24
+
25
+ ```bash
26
+ pnpm add -g mastra
27
+ ```
28
+
29
+ **Yarn**:
30
+
31
+ ```bash
32
+ yarn global add mastra
33
+ ```
34
+
35
+ **Bun**:
36
+
37
+ ```bash
38
+ bun add --global mastra
39
+ ```
40
+
41
+ ## Deploy
42
+
43
+ 1. Deploy your project:
44
+
45
+ ```bash
46
+ mastra server deploy
47
+ ```
48
+
49
+ If you're not already authenticated, the CLI prompts you to log in. It stores your credentials locally and any subsequent CLI commands use these credentials.
50
+
51
+ The command runs `mastra build`, uploads the artifact, builds a Docker image, and deploys it to Railway. On first deploy, the CLI creates a `.mastra-project.json` file linking your local project to the platform. Commit this file so subsequent deploys and CI/CD target the same project.
52
+
53
+ > **Note:** Environment variables from `.env`, `.env.local`, and `.env.production` are included automatically. On the first deploy, these seed the project if no env vars are set yet. After that, manage env vars through the web dashboard. Review and sanitize these files before first deploy to avoid uploading development-only or personal secrets.
54
+
55
+ See the [CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags.
56
+
57
+ 2. Verify your deployment at the URL printed by the CLI. Append `/api/agents` to confirm it returns a JSON list of your agents.
58
+
59
+ > **Warning:** Set up [authentication](https://mastra.ai/docs/server/auth) before exposing your endpoints publicly.
60
+
61
+ ## Deploy lifecycle
62
+
63
+ A deploy transitions through **queued → uploading → building → deploying → running** (or **failed**, **cancelled**, **crashed**, or **stopped**). Only one build runs per project at a time. If multiple deploys queue up, only the latest proceeds and the rest are cancelled. Builds running longer than 15 minutes are automatically failed. The first deploy provisions Railway infrastructure and seeds environment variables from your local `.env`. Your server URL remains stable across deploys.
64
+
65
+ ## CI/CD
66
+
67
+ Automate deployments from GitHub Actions, GitLab CI, or any CI provider. After your first interactive deploy, CI/CD needs just two things: an API token and the `.mastra-project.json` file committed to your repository.
68
+
69
+ ### Create an API token
70
+
71
+ 1. Run the following command locally:
72
+
73
+ ```bash
74
+ mastra auth tokens create ci-deploy
75
+ ```
76
+
77
+ The CLI prints the token once. Copy it immediately — it cannot be retrieved again.
78
+
79
+ 2. Add the token as a secret in your CI provider. In GitHub Actions, go to **Settings → Secrets and variables → Actions** and create a secret named `MASTRA_API_TOKEN`.
80
+
81
+ 3. Ensure your `.mastra-project.json` file is committed to the repository. The CLI reads the `organizationId` and `projectId` from this file to target the correct project during CI deploys.
82
+
83
+ ### The `--yes` flag
84
+
85
+ Pass `--yes` (or `-y`) to skip all confirmation prompts. Without it, the CLI waits for interactive input and your CI job hangs.
86
+
87
+ ```bash
88
+ mastra server deploy --yes
89
+ ```
90
+
91
+ ### GitHub Actions
92
+
93
+ The following workflow deploys on every push to `main`:
94
+
95
+ ```yaml
96
+ name: Deploy to Mastra platform
97
+
98
+ on:
99
+ push:
100
+ branches: [main]
101
+ paths: ['src/mastra/**']
102
+
103
+ jobs:
104
+ deploy:
105
+ runs-on: ubuntu-latest
106
+ steps:
107
+ - uses: actions/checkout@v4
108
+ - uses: actions/setup-node@v4
109
+ with:
110
+ node-version: '22'
111
+ cache: 'npm'
112
+ - name: Install dependencies
113
+ run: npm install
114
+ - name: Deploy to Mastra platform
115
+ run: npx mastra server deploy --yes
116
+ env:
117
+ MASTRA_API_TOKEN: ${{ secrets.MASTRA_API_TOKEN }}
118
+ ```
119
+
120
+ Adjust the `paths` filter and `working-directory` if your Mastra project is in a subdirectory (e.g. a monorepo).
121
+
122
+ > **Note:** For Studio deploys, replace `mastra server deploy` with `mastra studio deploy`. The flags and environment variables are the same.
123
+
124
+ ### GitLab CI
125
+
126
+ The following pipeline deploys on pushes to `main`:
127
+
128
+ ```yaml
129
+ deploy:
130
+ image: node:22
131
+ stage: deploy
132
+ only:
133
+ - main
134
+ before_script:
135
+ - npm install
136
+ script:
137
+ - npx mastra server deploy --yes
138
+ ```
139
+
140
+ Add `MASTRA_API_TOKEN` as a CI/CD variable in **Settings → CI/CD → Variables**.
141
+
142
+ ### Other CI providers
143
+
144
+ Any CI system that runs Node.js and shell commands works with Mastra:
145
+
146
+ 1. Install dependencies.
147
+ 2. Set `MASTRA_API_TOKEN` as an environment variable.
148
+ 3. Run `mastra server deploy --yes` (or `mastra studio deploy --yes`).
149
+
150
+ ### Verify the deploy
151
+
152
+ After the workflow completes, verify the deployment by hitting the health endpoint:
153
+
154
+ ```bash
155
+ curl -f https://<your-project>.server.mastra.cloud/health
156
+ ```
157
+
158
+ Or check the agents endpoint, which returns a JSON list of your agents:
159
+
160
+ ```bash
161
+ curl -f https://<your-project>.server.mastra.cloud/api/agents
162
+ ```
163
+
164
+ The following example adds a verification step to a GitHub Actions workflow:
165
+
166
+ ```yaml
167
+ - name: Verify deployment
168
+ run: |
169
+ sleep 30
170
+ curl -f https://<your-project>.server.mastra.cloud/health
171
+ ```
172
+
173
+ ### Override project config with environment variables
174
+
175
+ The CLI reads `organizationId` and `projectId` from `.mastra-project.json` by default. To override these values (e.g. deploying to a different project from the same repository), set the following environment variables:
176
+
177
+ | Variable | Description |
178
+ | ------------------- | ---------------------------------------------------------- |
179
+ | `MASTRA_ORG_ID` | Overrides the organization ID from `.mastra-project.json`. |
180
+ | `MASTRA_PROJECT_ID` | Overrides the project ID from `.mastra-project.json`. |
181
+
182
+ ## Related
183
+
184
+ - [CLI reference: `mastra server deploy`](https://mastra.ai/reference/cli/mastra)
185
+ - [CLI reference: `mastra server pause`](https://mastra.ai/reference/cli/mastra)
186
+ - [CLI reference: `mastra server restart`](https://mastra.ai/reference/cli/mastra)
187
+ - [CLI reference: `mastra studio deploy`](https://mastra.ai/reference/cli/mastra)
188
+ - [CLI reference: `mastra auth tokens`](https://mastra.ai/reference/cli/mastra)
189
+ - [Mastra platform overview](https://mastra.ai/docs/mastra-platform/overview)
190
+ - [Studio deployment](https://mastra.ai/docs/studio/deployment)
191
+ - [Deployment overview](https://mastra.ai/docs/deployment/overview)
@@ -1,6 +1,6 @@
1
1
  # Deploy Mastra to Netlify
2
2
 
3
- Use `@mastra/deployer-netlify` to deploy your Mastra server as serverless functions on Netlify. The deployer bundles your code and generates a `.netlify` directory conforming to Netlify's [frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/#netlifyv1functions), ready to deploy.
3
+ Use `@mastra/deployer-netlify` to deploy your Mastra server on Netlify. The deployer bundles your code and generates a `.netlify` directory conforming to Netlify's [Frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/), ready to deploy. You can deploy as serverless functions (default) or as [edge functions](https://docs.netlify.com/build/edge-functions/overview/) for lower latency and longer execution times.
4
4
 
5
5
  > **Info:** This guide covers deploying the [Mastra server](https://mastra.ai/docs/server/mastra-server). If you're using a [server adapter](https://mastra.ai/docs/server/server-adapters) or [web framework](https://mastra.ai/docs/deployment/web-framework), deploy the way you normally would for that framework.
6
6
 
@@ -49,6 +49,21 @@ export const mastra = new Mastra({
49
49
  })
50
50
  ```
51
51
 
52
+ To deploy as edge functions instead, pass `{ target: 'edge' }`:
53
+
54
+ ```typescript
55
+ import { Mastra } from '@mastra/core'
56
+ import { NetlifyDeployer } from '@mastra/deployer-netlify'
57
+
58
+ export const mastra = new Mastra({
59
+ deployer: new NetlifyDeployer({
60
+ target: 'edge',
61
+ }),
62
+ })
63
+ ```
64
+
65
+ Edge functions run on Deno at the edge closest to your users. They have no hard execution timeout (only a CPU time limit), making them a better fit for longer-running AI workflows. See the [constructor options](https://mastra.ai/reference/deployer/netlify) for details.
66
+
52
67
  Create a `netlify.toml` file with the following contents in your project root:
53
68
 
54
69
  ```toml