@mastra/mcp-docs-server 1.2.6 → 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 +12 -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 +36 -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
@@ -75,7 +75,7 @@ The following environment variables are automatically used when constructor opti
75
75
  1. **Session cookie**: When SSO is enabled, reads the encrypted session cookie and decrypts it. If the session is valid and not expired, the user is authenticated.
76
76
  2. **Google ID token fallback**: If no valid session cookie is present, verifies the `Authorization` header token against Google's JWKS endpoint.
77
77
 
78
- After authentication, `authorizeUser` checks that the user has a valid Google user ID, the token-derived expiration has not passed, and the user's verified `hd` claim matches `allowedDomains` when domains are configured.
78
+ After authentication, `authorizeUser` checks that the user has a valid Google user ID, the token-derived expiration hasn't passed, and the user's verified `hd` claim matches `allowedDomains` when domains are configured.
79
79
 
80
80
  ### Authentication methods
81
81
 
@@ -101,7 +101,7 @@ Returns: `Promise<GoogleUser | null>`
101
101
 
102
102
  #### `authorizeUser(user)`
103
103
 
104
- Returns `true` when the user has an ID, has not expired, and matches `allowedDomains` when domains are configured.
104
+ Returns `true` when the user has an ID, hasn't expired, and matches `allowedDomains` when domains are configured.
105
105
 
106
106
  ```typescript
107
107
  const allowed = auth.authorizeUser(user)
@@ -111,7 +111,7 @@ Returns: `boolean`
111
111
 
112
112
  #### `getUser(userId)`
113
113
 
114
- Returns `null`. Google ID tokens are verified directly, so this provider does not perform user lookup by ID.
114
+ Returns `null`. Google ID tokens are verified directly, so this provider doesn't perform user lookup by ID.
115
115
 
116
116
  ```typescript
117
117
  const user = await auth.getUser(userId)
@@ -348,9 +348,9 @@ Returns: `{ size: number; maxSize: number }`
348
348
 
349
349
  `MastraRBACGoogle` uses `GET https://admin.googleapis.com/admin/directory/v1/groups?userKey=...` and handles pagination. Provide a service account with domain-wide delegation for production Google Workspace deployments, or pass `accessToken` / `getAccessToken` if your application already manages Google API tokens.
350
350
 
351
- If `user.groups` is already an array, `MastraRBACGoogle` uses that value and does not call the Directory API. An empty `groups` array means the user has no Google group roles and resolves to `_default` permissions when `_default` is configured.
351
+ If `user.groups` is already an array, `MastraRBACGoogle` uses that value and doesn't call the Directory API. An empty `groups` array means the user has no Google group roles and resolves to `_default` permissions when `_default` is configured.
352
352
 
353
- `MastraRBACGoogle` does not automatically read service-account environment variables. Pass service-account credentials through the `serviceAccount` option, or pass `accessToken` / `getAccessToken`.
353
+ `MastraRBACGoogle` doesn't automatically read service-account environment variables. Pass service-account credentials through the `serviceAccount` option, or pass `accessToken` / `getAccessToken`.
354
354
 
355
355
  ## Related
356
356
 
@@ -64,4 +64,4 @@ const all = mastra.getChannelProviders()
64
64
  ## Related
65
65
 
66
66
  - [SlackProvider](https://mastra.ai/reference/channels/slack-provider)
67
- - [Channels](https://mastra.ai/docs/agents/channels)
67
+ - [Channels](https://mastra.ai/docs/capabilities/channels/overview)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # SlackProvider
4
4
 
5
- `SlackProvider` is the managed path for connecting agents to Slack. Register it on `Mastra.channels` and it provisions Slack apps via the Manifest API, runs the OAuth install flow, rotates configuration tokens, and routes Slack events to your agents. Use it when you want Mastra to own app creation and installation. For the lower-level path where you create the Slack app and configure scopes and webhooks yourself, use [`createSlackAdapter`](https://mastra.ai/docs/agents/channels) on the agent's `channels.adapters` instead.
5
+ `SlackProvider` is the managed path for connecting agents to Slack. Register it on `Mastra.channels` and it provisions Slack apps via the Manifest API, runs the OAuth install flow, rotates configuration tokens, and routes Slack events to your agents. Use it when you want Mastra to own app creation and installation. For the lower-level path where you create the Slack app and configure scopes and webhooks yourself, use [`createSlackAdapter`](https://mastra.ai/docs/capabilities/channels/slack) on the agent's `channels.adapters` instead.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -171,7 +171,7 @@ slack.setBaseUrl('https://abc123.trycloudflare.com')
171
171
 
172
172
  #### `initialize()`
173
173
 
174
- Recreates a `SlackAdapter` for each active installation in storage and injects `AgentChannels` into the corresponding agent so it receives Slack events on startup. Does not auto-provision new apps; use `connect()` to create one. Mastra calls this automatically, so you rarely call it directly.
174
+ Recreates a `SlackAdapter` for each active installation in storage and injects `AgentChannels` into the corresponding agent so it receives Slack events on startup. Doesn't auto-provision new apps; use `connect()` to create one. Mastra calls this automatically, so you rarely call it directly.
175
175
 
176
176
  ```typescript
177
177
  await slack.initialize()
@@ -224,5 +224,5 @@ const result = await slack.connect('support-agent')
224
224
  ## Related
225
225
 
226
226
  - [ChannelProvider](https://mastra.ai/reference/channels/channel-provider): the interface `SlackProvider` implements
227
- - [Channels](https://mastra.ai/docs/agents/channels): concepts, platform setup, and the `createSlackAdapter` path
227
+ - [Channels](https://mastra.ai/docs/capabilities/channels/overview): concepts, platform setup, and the `createSlackAdapter` path
228
228
  - [Channels reference](https://mastra.ai/reference/agents/channels): the `channels` config on the `Agent` constructor
@@ -215,7 +215,7 @@ If the project doesn't exist yet, the CLI creates it from the `package.json` `na
215
215
  mastra deploy --env staging --yes
216
216
  ```
217
217
 
218
- When `--env <name>` is set and `--env-file` is not, the CLI auto-selects `.env.<name>` from the project directory if present (for example `.env.staging`). The `<name>` value is validated against a strict allowlist before being interpolated into a file path.
218
+ When `--env <name>` is set and `--env-file` isn't, the CLI auto-selects `.env.<name>` from the project directory if present (for example `.env.staging`). The `<name>` value is validated against a strict allowlist before being interpolated into a file path.
219
219
 
220
220
  ### Arguments
221
221
 
@@ -227,7 +227,7 @@ Project directory. Defaults to the current directory.
227
227
 
228
228
  #### `--env`
229
229
 
230
- Target environment name. Defaults to `production`. Auto-selects `.env.<name>` from the project directory when `--env-file` is not set. If the environment doesn't exist, the CLI creates it after confirmation.
230
+ Target environment name. Defaults to `production`. Auto-selects `.env.<name>` from the project directory when `--env-file` isn't set. If the environment doesn't exist, the CLI creates it after confirmation.
231
231
 
232
232
  #### `--org`
233
233
 
@@ -282,32 +282,30 @@ mastra deploy --env staging --yes
282
282
 
283
283
  ## `mastra env`
284
284
 
285
- Manages environments on Mastra platform. Environments are named deploy targets (for example `production`, `staging`, `preview-42`) that belong to a project. Every subcommand takes a `<project>` argument (name, slug, or ID) and resolves the current organization from stored credentials.
285
+ Manages environments on Mastra platform. Environments are named deploy targets (for example `production`, `staging`, `preview-42`) that belong to a project. The current organization is resolved from stored credentials.
286
+
287
+ Every subcommand resolves its project from, in order: the `MASTRA_PROJECT_ID` environment variable, the `--project <name|slug|id>` flag, or the `.mastra-project.json` file written by [`mastra deploy`](#mastra-deploy) in the current directory. Run from your project directory and you never need to name the project.
286
288
 
287
289
  ### `mastra env list`
288
290
 
289
- Lists environments for a project.
291
+ Lists environments for a project. Each environment shows its latest deploy (with an `(active)` marker when it's serving traffic) and the env var names injected by managed resources such as attached databases.
290
292
 
291
293
  ```bash
292
- mastra env list <project>
294
+ mastra env list
293
295
  ```
294
296
 
295
297
  #### `--json`
296
298
 
297
- Emit machine-readable JSON. Only non-sensitive metadata (id, name, slug, type, region, branch, and URLs) is included so the output is safe to log in CI.
299
+ Emit machine-readable JSON. Only non-sensitive metadata (id, name, slug, type, region, branch, URLs, managed env var names, and latest deploy status) is included so the output is safe to log in CI.
298
300
 
299
301
  ### `mastra env create`
300
302
 
301
303
  Creates a new environment for a project.
302
304
 
303
305
  ```bash
304
- mastra env create <project> --name staging --type staging --region eu
306
+ mastra env create staging --type staging --region eu
305
307
  ```
306
308
 
307
- #### `-n, --name`
308
-
309
- Environment name (required).
310
-
311
309
  #### `-t, --type`
312
310
 
313
311
  Environment type. One of `production`, `staging`, or `preview`. Defaults to `staging`.
@@ -325,7 +323,7 @@ Emit machine-readable JSON. Sensitive fields are omitted, as with [`mastra env l
325
323
  Deletes an environment.
326
324
 
327
325
  ```bash
328
- mastra env delete <project> <env>
326
+ mastra env delete <env>
329
327
  ```
330
328
 
331
329
  `<env>` can be an environment name, slug, or ID. The CLI prompts for confirmation unless `--yes` is passed.
@@ -334,6 +332,112 @@ mastra env delete <project> <env>
334
332
 
335
333
  Skip the confirmation prompt.
336
334
 
335
+ ### `mastra env restart`
336
+
337
+ Restarts an environment's running service so saved env vars (including managed vars from attached databases) take effect immediately, without a new deploy.
338
+
339
+ ```bash
340
+ mastra env restart <env>
341
+ ```
342
+
343
+ `<env>` can be an environment name, slug, or ID. Fails with a conflict error if the environment has never been deployed.
344
+
345
+ ### `mastra env db`
346
+
347
+ Manages databases attached to a project on Mastra platform. Databases are provisioned from a managed provider (for example Turso or Neon) and inject their connection env vars into deploys automatically.
348
+
349
+ A database is either **environment-scoped** (its env vars only go to one environment) or **shared** (project-scoped: its env vars go to all environments). Pass the environment argument to work with environment-scoped databases; omit it for shared databases.
350
+
351
+ Creating and detaching databases requires the `admin` role in the organization.
352
+
353
+ ### `mastra env db list`
354
+
355
+ Lists databases attached to a project, including provider, provisioning status, scope (which environment each database feeds), and the env var names each database injects. Pass an environment to only show databases feeding that environment (environment-scoped plus shared).
356
+
357
+ ```bash
358
+ mastra env db list
359
+ mastra env db list <env>
360
+ ```
361
+
362
+ #### `--json`
363
+
364
+ Emit machine-readable JSON.
365
+
366
+ ### `mastra env db create`
367
+
368
+ Provisions a managed database, attaches it, and polls until it's ready. Provisioning errors are printed with the provider's error detail.
369
+
370
+ With an environment argument, the database is scoped to that environment: only it receives the database's connection env vars, and the provider region is derived from the environment's region. Without one, the database is shared by all environments.
371
+
372
+ ```bash
373
+ mastra env db create <env> --kind turso
374
+ mastra env db create --kind neon --name my-app-db --region aws-us-east-1
375
+ ```
376
+
377
+ #### `--kind`
378
+
379
+ Database provider (required). One of `turso` or `neon`.
380
+
381
+ #### `--name`
382
+
383
+ Database name. Defaults to a name derived from the project slug (for example `my-app-db`).
384
+
385
+ #### `--region`
386
+
387
+ Provider region ID for shared databases. Ignored for environment-scoped databases.
388
+
389
+ #### `--no-wait`
390
+
391
+ Return immediately after the attach is queued instead of polling until the database is ready. Check progress later with `mastra env db show`.
392
+
393
+ #### `--json`
394
+
395
+ Emit machine-readable JSON.
396
+
397
+ ### `mastra env db show`
398
+
399
+ Shows database details and, once the database is ready, its connection env vars. Secret values are masked by default.
400
+
401
+ ```bash
402
+ mastra env db show <database>
403
+ ```
404
+
405
+ `<database>` can be a database ID or name.
406
+
407
+ #### `--show-secrets`
408
+
409
+ Print secret connection values instead of masking them.
410
+
411
+ #### `--json`
412
+
413
+ Emit machine-readable JSON. Secret values are masked unless `--show-secrets` is passed.
414
+
415
+ ### `mastra env db detach`
416
+
417
+ Detaches a database from the project. The CLI prompts for confirmation unless `--yes` is passed. After detaching, deploys no longer receive the database's env vars.
418
+
419
+ ```bash
420
+ mastra env db detach <database>
421
+ ```
422
+
423
+ #### `-y, --yes`
424
+
425
+ Skip the confirmation prompt.
426
+
427
+ ### `mastra env deploys`
428
+
429
+ Lists deploys for a project, newest first. Deploys that are serving traffic are marked `(active)`.
430
+
431
+ ```bash
432
+ mastra env deploys [environment]
433
+ ```
434
+
435
+ Omit `[environment]` to show deploys across all environments; pass an environment name, slug, or ID to filter to one.
436
+
437
+ #### `--json`
438
+
439
+ Emit machine-readable JSON.
440
+
337
441
  ## `mastra studio deploy`
338
442
 
339
443
  > **Info:** `mastra studio deploy` continues to work but is superseded by [`mastra deploy`](#mastra-deploy), which supports named environments (`--env staging`, `--env production`) on a single project. New setups should use `mastra deploy`.
@@ -736,6 +840,7 @@ Runs database migrations to update your storage schema. This command is useful w
736
840
  The command bundles your project, connects to your configured storage backend, and executes any pending migrations. Currently supports:
737
841
 
738
842
  - **Duplicate spans migration**: Removes duplicate `(traceId, spanId)` entries and adds a unique constraint to ensure data integrity.
843
+ - **ClickHouse legacy-to-vNext span migration**: Copies historical spans from the legacy `mastra_ai_spans` table to the vNext `mastra_span_events` schema. Runs in batches to stay within memory limits. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for details.
739
844
 
740
845
  ```bash
741
846
  mastra migrate
@@ -1379,6 +1484,8 @@ By default, Mastra collects anonymous information about your project like your O
1379
1484
 
1380
1485
  When a server started with `mastra dev` or `mastra start` has observability metrics enabled, Mastra also sends anonymous, aggregated model usage at startup: input and output token counts per provider and model, plus the command (`dev` or `start`) and `NODE_ENV`. No prompts, responses, or other message content is ever sent. You can read the [source code](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/telemetry/usage-telemetry.ts) to check what's collected.
1381
1486
 
1487
+ At server startup, Mastra also sends an anonymous project-surface snapshot: counts of registered agents, agent controllers, workflows, tools, processors, vector stores, scorers, workspaces, MCP servers, gateways, and channels, plus booleans for memory, voice, editor, and observability usage and the coarse storage backend category. It doesn't send names or identifiers. You can read the [source code](https://github.com/mastra-ai/mastra/blob/main/packages/core/src/telemetry/feature-telemetry.ts) to check what's collected.
1488
+
1382
1489
  You can opt out of all CLI and usage analytics by setting an environment variable:
1383
1490
 
1384
1491
  ```bash
@@ -0,0 +1,76 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # mountAgentControllerOnMastra()
4
+
5
+ > **Beta:** The `@mastra/code-sdk` package is experimental and subject to breaking changes in minor versions.
6
+
7
+ The `mountAgentControllerOnMastra()` function builds the Mastra Code agent controller — the coding agent behind the [`mastracode`](https://www.npmjs.com/package/mastracode) CLI, with its modes, tools, memory, and thread management — and registers it on a server-owned [Mastra](https://mastra.ai/reference/core/mastra-class) instance. Use it to serve the Mastra Code agent to your own UI (web app, editor, bot): each client creates or resumes its own isolated session through the returned [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class).
8
+
9
+ To construct the `Mastra` instance yourself (for example in a deployable entry file), use `prepareAgentControllerMount()` from the same package, which returns the constructor args plus a `finalize()` callback.
10
+
11
+ ## Usage example
12
+
13
+ ```typescript
14
+ import { mountAgentControllerOnMastra } from '@mastra/code-sdk'
15
+
16
+ const { mastra, controller } = await mountAgentControllerOnMastra({
17
+ cwd: process.cwd(),
18
+ })
19
+
20
+ // Each client drives its own session
21
+ const session = await controller.createSession({ resourceId: 'user-123' })
22
+ ```
23
+
24
+ Pass an existing `mastra` to mount the controller onto a Mastra instance that already hosts other primitives:
25
+
26
+ ```typescript
27
+ import { Mastra } from '@mastra/core/mastra'
28
+ import { mountAgentControllerOnMastra } from '@mastra/code-sdk'
29
+
30
+ const mastra = new Mastra({
31
+ /* ... */
32
+ })
33
+
34
+ const { controller } = await mountAgentControllerOnMastra({ mastra })
35
+ ```
36
+
37
+ ## Parameters
38
+
39
+ **cwd** (`string`): Working directory for project detection. (Default: `process.cwd()`)
40
+
41
+ **mastra** (`Mastra`): Existing Mastra instance to mount onto. When omitted, a Mastra is created that owns the controller storage.
42
+
43
+ **controllerId** (`string`): Id under which the controller is registered on the Mastra instance.
44
+
45
+ **modes** (`AgentControllerMode[]`): Override agent modes (model ids, colors, which modes exist). (Default: `build/plan/fast`)
46
+
47
+ **subagents** (`AgentControllerSubagent[]`): Override or extend subagent definitions. (Default: `explore/plan/execute`)
48
+
49
+ **extraTools** (`Record<string, ToolAction> | (ctx) => Record<string, ToolAction>`): Extra tools merged into the dynamic tool set.
50
+
51
+ **disabledTools** (`string[]`): Tools removed from the dynamic tool set before exposure to the model.
52
+
53
+ **storage** (`StorageConfig`): Custom storage config instead of the auto-detected default.
54
+
55
+ **workspace** (`AgentControllerConfig["workspace"]`): Override the workspace. (Default: `local filesystem + local sandbox based on the detected project`)
56
+
57
+ **configDir** (`string`): Override the config directory name used for all project-level and global config paths (MCP, hooks, commands, database, skills, agent instructions). (Default: `'.mastracode'`)
58
+
59
+ **mcpServers** (`Record<string, McpServerConfig>`): Programmatic MCP server configurations, merged with (and overriding) file-based configs.
60
+
61
+ **buildApiRoutes** (`(deps: { controller, authStorage }) => ApiRoute[]`): Additional API routes registered on the constructed Mastra. Ignored when mastra is provided.
62
+
63
+ **buildServerConfig** (`(deps: { controller, authStorage }) => ServerConfig`): Additional server config (middleware, CORS) folded onto the constructed Mastra. Ignored when mastra is provided.
64
+
65
+ ## Returns
66
+
67
+ **mastra** (`Mastra`): The Mastra instance the controller is mounted on (created or passed in).
68
+
69
+ **controller** (`AgentController`): The initialized Mastra Code agent controller. Create sessions with controller.createSession().
70
+
71
+ **authStorage** (`AuthStorage`): Credential storage used by the built-in model gateway.
72
+
73
+ ## Related
74
+
75
+ - [AgentController class](https://mastra.ai/reference/agent-controller/agent-controller-class)
76
+ - [Session class](https://mastra.ai/reference/agent-controller/session)
@@ -48,7 +48,7 @@ const agent = createCodingAgent({
48
48
 
49
49
  ## Defaults
50
50
 
51
- The factory only fills a default when you do not provide the corresponding field. Caller-provided values always win.
51
+ The factory only fills a default when you don't provide the corresponding field. Caller-provided values always win.
52
52
 
53
53
  | Field | Default when omitted |
54
54
  | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -366,7 +366,7 @@ export const mastra = new Mastra({
366
366
 
367
367
  Storage provider for persisting application data. Used by memory, workflows, traces, and other components that require persistence. Mastra supports multiple database backends including PostgreSQL, MongoDB, libSQL, and more.
368
368
 
369
- Visit the [Storage documentation](https://mastra.ai/docs/memory/storage) to learn more.
369
+ Visit the [Storage documentation](https://mastra.ai/docs/storage/overview) to learn more.
370
370
 
371
371
  ```typescript
372
372
  import { Mastra } from '@mastra/core'
@@ -4,7 +4,7 @@
4
4
 
5
5
  Quick Checks are zero-LLM, composable micro-scorers for common assertions. They plug into the existing `scorers: [...]` array anywhere scorers are used — in `runEvals`, live scoring, experiments, and Studio.
6
6
 
7
- Internally they are standard `createScorer()` instances, so they have the same observability, storage, and pipeline integration as any other scorer.
7
+ Internally they're standard `createScorer()` instances, so they have the same observability, storage, and pipeline integration as any other scorer.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -46,7 +46,7 @@ Returns: `1` if found, `0` otherwise.
46
46
 
47
47
  ### `checks.excludes(unwanted, options?)`
48
48
 
49
- Scores 1 if the agent's output text does NOT contain the substring, 0 otherwise.
49
+ Scores 1 if the agent's output text doesn't contain the substring, 0 otherwise.
50
50
 
51
51
  ```typescript
52
52
  checks.excludes('error')
@@ -125,7 +125,7 @@ Returns: `1` if called at least `times` times, `0` otherwise.
125
125
 
126
126
  ### `checks.didNotCall(toolName)`
127
127
 
128
- Scores 1 if the agent did NOT call the specified tool.
128
+ Scores 1 if the agent didn't call the specified tool.
129
129
 
130
130
  ```typescript
131
131
  checks.didNotCall('delete_user')
@@ -133,7 +133,7 @@ checks.didNotCall('delete_user')
133
133
 
134
134
  **toolName** (`string`): Name of the tool that must not appear.
135
135
 
136
- Returns: `1` if the tool was not called, `0` otherwise.
136
+ Returns: `1` if the tool wasn't called, `0` otherwise.
137
137
 
138
138
  ### `checks.toolOrder(expectedOrder)`
139
139
 
@@ -53,6 +53,14 @@ const scorer = createScorer({
53
53
 
54
54
  **judge.jsonPromptInjection** (`boolean`): When true, inject the JSON schema into the prompt instead of using the provider's native response\_format API. Set this for models that don't support native structured output (e.g. some Groq Llama models) to avoid a wasted 400 call.
55
55
 
56
+ **judge.inputProcessors** (`Processor[]`): Input processors applied to the internal judge agent before its messages reach the model (e.g. redaction, validation).
57
+
58
+ **judge.outputProcessors** (`Processor[]`): Output processors applied to the internal judge agent's output before it is returned (e.g. moderation, transformation).
59
+
60
+ **judge.errorProcessors** (`Processor[]`): Error processors for the internal judge agent. These implement processAPIError and can inspect LLM API rejections and signal a retry, e.g. StreamErrorRetryProcessor. Requires maxProcessorRetries to be set for retry-based processors to take effect.
61
+
62
+ **judge.maxProcessorRetries** (`number`): Maximum number of times processors can trigger a retry per judge generation. Required for retry-based error processors (e.g. StreamErrorRetryProcessor) to take effect.
63
+
56
64
  **type** (`string`): Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.
57
65
 
58
66
  **prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transform the scorer run data before the pipeline executes. Use this to filter messages, limit context size, or drop fields the scorer doesn't need. The \`filterRun()\` utility creates this function from declarative options. Can be async.
@@ -0,0 +1,97 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # config.ts
4
+
5
+ An agent's `config.ts` sets its model and runtime options. Use it for options that belong to the [`Agent`](https://mastra.ai/reference/agents/agent) itself, while sibling files provide instructions, tools, skills, et cetera.
6
+
7
+ ## What belongs in `config.ts`
8
+
9
+ `config.ts` is the required entry point for a file-based agent's model and runtime options. Put agent-level settings here when they don't need their own file, such as the model, description, default execution options, retry behavior, scorers, and display identity.
10
+
11
+ Keep adjacent concerns in sibling files when you want file-based routing to merge them into the agent. For example, use `instructions.md` for the always-on prompt and `tools/` for model-callable actions.
12
+
13
+ ## Quickstart
14
+
15
+ The following `config.ts` plus an `instructions.md` file creates a working file-based agent:
16
+
17
+ ```typescript
18
+ import { agentConfig } from '@mastra/core/agent'
19
+
20
+ export default agentConfig({
21
+ model: 'openai/gpt-5.5',
22
+ })
23
+ ```
24
+
25
+ ```markdown
26
+ You are a helpful weather assistant. Answer questions about current conditions and forecasts.
27
+ ```
28
+
29
+ Mastra uses the `weather` directory name as the default agent `id` and `name`. The sibling `instructions.md` supplies the required instructions.
30
+
31
+ ## Set the model
32
+
33
+ The `model` field is the only required field in `agentConfig()`. The build fails when an agent directory doesn't provide a model. Other capabilities either come from sibling files or have defaults.
34
+
35
+ ```typescript
36
+ import { agentConfig } from '@mastra/core/agent'
37
+
38
+ export default agentConfig({
39
+ model: 'openai/gpt-5.5',
40
+ })
41
+ ```
42
+
43
+ ## Identity from the directory
44
+
45
+ A file-based agent's `id` and `name` default to the directory name. For `src/mastra/agents/weather/`, Mastra registers the agent as `weather` unless you override those fields.
46
+
47
+ Override `id` or `name` when the stable routing key and the display name should differ.
48
+
49
+ ```typescript
50
+ import { agentConfig } from '@mastra/core/agent'
51
+
52
+ export default agentConfig({
53
+ id: 'weather-assistant',
54
+ name: 'Weather Assistant',
55
+ model: 'openai/gpt-5.5',
56
+ })
57
+ ```
58
+
59
+ ## Set runtime options
60
+
61
+ `agentConfig()` accepts [`Agent` constructor options](https://mastra.ai/reference/agents/agent), except that `id`, `name`, and sibling-file fields can be supplied by the file-based convention. Use the Agent reference for the full option list.
62
+
63
+ Please note:
64
+
65
+ - File-based subagents require a non-empty `description` because the parent model uses it for delegation routing.
66
+ - `defaultOptions`, `maxRetries`, `scorers`, and other Agent options can live in `config.ts` when they don't need their own file.
67
+
68
+ ## Where adjacent settings live
69
+
70
+ Keep `config.ts` focused on runtime options. Use sibling files for concerns that benefit from their own location.
71
+
72
+ | Setting | File or folder | Why it lives there |
73
+ | ------------ | ------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
74
+ | Instructions | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | Keeps the always-on prompt readable as markdown |
75
+ | Tools | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Gives each callable action its own typed module |
76
+ | Skills | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Keeps load-on-demand procedures separate from always-on instructions |
77
+ | Memory | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | Configures persistent memory without crowding runtime options |
78
+ | Workspace | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | Configures files and sandbox behavior separately from model settings |
79
+ | Processors | [`processors/`](https://mastra.ai/reference/file-based-agents/processors) | Separates input and output processing pipelines |
80
+ | Subagents | [`subagents/`](https://mastra.ai/reference/file-based-agents/subagents) | Gives each specialist child agent its own directory |
81
+
82
+ ## Precedence
83
+
84
+ `config.ts` merges with the agent's other files according to these rules:
85
+
86
+ | Domain | Source A | Source B | Winner |
87
+ | ------------ | ----------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------- |
88
+ | Instructions | Dynamic `config.instructions` | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | Dynamic `config.instructions` |
89
+ | Instructions | Static `config.instructions` | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | `instructions.md` |
90
+ | Tools | `config.tools` | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Both merge; `config.tools` wins on key collisions |
91
+ | Tools | Function `config.tools` | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | Function `config.tools`; discovered tools are ignored |
92
+ | Skills | `config.skills` | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Both merge; `config.skills` wins on name collisions |
93
+ | Skills | Function `config.skills` | [`skills/`](https://mastra.ai/reference/file-based-agents/skills) | Function `config.skills`; discovered skills are ignored |
94
+ | Memory | `config.memory` | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | `config.memory` |
95
+ | Workspace | `config.workspace` | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | `config.workspace` |
96
+
97
+ Missing both `instructions.md` and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
@@ -0,0 +1,54 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Instructions
4
+
5
+ An agent's `instructions.md` holds its always-on system prompt: the model reads it on every turn. Use it to define the agent's identity, tone, role, and standing rules.
6
+
7
+ Instructions are always in context, so keep them for stable behavior that applies to every request. Move anything conditional, large, or action-oriented out of `instructions.md` and into [`tools/`](https://mastra.ai/reference/file-based-agents/tools) or [`skills/`](https://mastra.ai/reference/file-based-agents/skills), which the model uses only when relevant.
8
+
9
+ ## Quickstart
10
+
11
+ Add an `instructions.md` at the agent root. Whatever you write becomes the prompt, so the shortest version is a single sentence.
12
+
13
+ ```markdown
14
+ You are a helpful weather assistant. Answer questions about current conditions and forecasts.
15
+ ```
16
+
17
+ ## What goes in instructions
18
+
19
+ Effective instructions cover the parts of an agent's behavior that don't change between requests:
20
+
21
+ - Role and identity
22
+ - Tone and style
23
+ - Standing rules
24
+ - Output format
25
+
26
+ Move conditional, large, or action-oriented guidance into [`tools/`](https://mastra.ai/reference/file-based-agents/tools) or [`skills/`](https://mastra.ai/reference/file-based-agents/skills), which the model uses only when relevant.
27
+
28
+ ## Dynamic instructions
29
+
30
+ When the prompt needs to change per request, for example based on the current user or runtime context, set a dynamic `instructions` function in [`config.ts`](https://mastra.ai/reference/file-based-agents/config) instead of using `instructions.md`. A function `instructions` wins over `instructions.md`, so the static file is ignored when both are present.
31
+
32
+ ```typescript
33
+ import { agentConfig } from '@mastra/core/agent'
34
+
35
+ export default agentConfig({
36
+ model: 'openai/gpt-5.5',
37
+ instructions: ({ runtimeContext }) => {
38
+ const tier = runtimeContext.get('tier') ?? 'standard'
39
+ return `You are a support agent. Treat this as a ${tier}-tier customer.`
40
+ },
41
+ })
42
+ ```
43
+
44
+ ## Build-time behavior
45
+
46
+ Mastra reads `instructions.md` and inlines its contents into the generated code when the bundler builds your project. The deployed agent doesn't read the file at runtime, so changes to `instructions.md` take effect only after the next build.
47
+
48
+ ## Precedence with config
49
+
50
+ Instructions can come from `instructions.md` or from the `instructions` field in [`config.ts`](https://mastra.ai/reference/file-based-agents/config):
51
+
52
+ - A dynamic (function) `instructions` in `config.ts` wins over `instructions.md`.
53
+ - Otherwise `instructions.md` wins over a static `instructions` string.
54
+ - If neither is present, the build fails and names the agent directory.
@@ -0,0 +1,58 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Memory
4
+
5
+ A file-based agent gets [memory](https://mastra.ai/docs/memory/overview) from a `memory.ts` file that default-exports a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance. Use this page for the file-based convention; use the memory docs for message history, semantic recall, storage, and processors.
6
+
7
+ Without `memory.ts` or `config.memory`, the agent has no memory by default. Each `generate()` or `stream()` call starts without remembered conversation state unless you pass the prior context yourself.
8
+
9
+ ## Quickstart
10
+
11
+ Create `memory.ts` next to the agent's `config.ts`:
12
+
13
+ ```typescript
14
+ import { Memory } from '@mastra/memory'
15
+
16
+ export default new Memory()
17
+ ```
18
+
19
+ The exported instance becomes the agent's `memory`. If your app configures a storage provider on the main Mastra instance, memory data is stored there. See [storage](https://mastra.ai/docs/storage/overview) for more information.
20
+
21
+ Use the same `resource` and `thread` values when calling the agent to continue a conversation:
22
+
23
+ ```typescript
24
+ const response = await weatherAgent.generate('Remember that I prefer Celsius.', {
25
+ memory: {
26
+ resource: 'user-123',
27
+ thread: 'weather-chat',
28
+ },
29
+ })
30
+ ```
31
+
32
+ ## Configure memory
33
+
34
+ Pass options to `new Memory()` when the default behavior isn't enough.
35
+
36
+ ```typescript
37
+ import { Memory } from '@mastra/memory'
38
+
39
+ export default new Memory({
40
+ options: {
41
+ lastMessages: 20,
42
+ workingMemory: {
43
+ enabled: true,
44
+ scope: 'resource',
45
+ },
46
+ },
47
+ })
48
+ ```
49
+
50
+ Visit the [`Memory` reference](https://mastra.ai/reference/memory/memory-class) for constructor options. Use these pages for related memory features:
51
+
52
+ - [Storage](https://mastra.ai/docs/storage/overview): configure persistence for memory data.
53
+ - [Semantic recall](https://mastra.ai/docs/memory/semantic-recall): retrieve relevant past messages by semantic meaning.
54
+ - [Memory processors](https://mastra.ai/docs/memory/memory-processors): filter, trim, or transform messages before memory adds them to model context.
55
+
56
+ ## Precedence with config
57
+
58
+ `config.memory` wins over `memory.ts`. If neither is present, the assembled file-based agent has no memory. See [`config.ts` precedence](https://mastra.ai/reference/file-based-agents/config) for the full merge table.