@mastra/mcp-docs-server 1.2.8-alpha.2 → 1.2.8-alpha.23

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 (153) hide show
  1. package/.docs/docs/agent-builder/integrations.md +1 -3
  2. package/.docs/docs/agents/overview.md +17 -13
  3. package/.docs/docs/agents/skills.md +1 -3
  4. package/.docs/docs/agents/structured-output.md +14 -7
  5. package/.docs/docs/agents/using-tools.md +66 -49
  6. package/.docs/docs/browser/agent-browser.md +1 -0
  7. package/.docs/docs/browser/firecrawl.md +129 -0
  8. package/.docs/docs/browser/overview.md +16 -2
  9. package/.docs/docs/capabilities/channels/slack.md +111 -1
  10. package/.docs/docs/deployment/mastra-server.md +35 -0
  11. package/.docs/docs/deployment/monorepo.md +2 -0
  12. package/.docs/docs/deployment/overview.md +6 -0
  13. package/.docs/docs/deployment/sandbox.md +277 -0
  14. package/.docs/docs/editor/overview.md +2 -6
  15. package/.docs/docs/editor/tools.md +2 -6
  16. package/.docs/docs/evals/multi-turn.md +178 -0
  17. package/.docs/docs/evals/overview.md +1 -0
  18. package/.docs/docs/evals/running-in-ci.md +3 -9
  19. package/.docs/docs/getting-started/build-with-ai.md +2 -6
  20. package/.docs/docs/getting-started/manual-install.md +1 -1
  21. package/.docs/docs/index.md +17 -13
  22. package/.docs/docs/long-running-agents/background-tasks.md +2 -2
  23. package/.docs/docs/long-running-agents/durable-agents.md +2 -1
  24. package/.docs/docs/long-running-agents/goals.md +3 -1
  25. package/.docs/docs/mastra-platform/database.md +12 -6
  26. package/.docs/docs/mastra-platform/deploy.md +14 -7
  27. package/.docs/docs/mastra-platform/environments.md +5 -4
  28. package/.docs/docs/mastra-platform/observability.md +4 -12
  29. package/.docs/docs/mastra-platform/overview.md +1 -1
  30. package/.docs/docs/mastra-platform/regions.md +73 -0
  31. package/.docs/docs/mastra-platform/workspace.md +111 -0
  32. package/.docs/docs/mcp/overview.md +1 -1
  33. package/.docs/docs/memory/observational-memory.md +77 -2
  34. package/.docs/docs/memory/overview.md +4 -0
  35. package/.docs/docs/observability/feedback.md +4 -0
  36. package/.docs/docs/observability/integrations/bridges/otel.md +1 -3
  37. package/.docs/docs/observability/integrations/exporters/otel.md +1 -3
  38. package/.docs/docs/server/auth/fga.md +40 -0
  39. package/.docs/docs/server/auth/simple-auth.md +1 -3
  40. package/.docs/docs/server/request-context.md +2 -0
  41. package/.docs/docs/studio/overview.md +2 -0
  42. package/.docs/docs/workflows/control-flow.md +1 -3
  43. package/.docs/docs/workspace/filesystem.md +1 -0
  44. package/.docs/docs/workspace/sandbox.md +1 -0
  45. package/.docs/guides/getting-started/quickstart.md +40 -25
  46. package/.docs/guides/index.md +1 -1
  47. package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -3
  48. package/.docs/models/environment-variables.md +3 -0
  49. package/.docs/models/gateways/netlify.md +3 -1
  50. package/.docs/models/gateways/openrouter.md +343 -345
  51. package/.docs/models/gateways/vercel.md +8 -5
  52. package/.docs/models/index.md +1 -1
  53. package/.docs/models/providers/aki-io.md +78 -0
  54. package/.docs/models/providers/alibaba-token-plan-cn.md +22 -21
  55. package/.docs/models/providers/alibaba-token-plan.md +22 -21
  56. package/.docs/models/providers/ambient.md +12 -10
  57. package/.docs/models/providers/baseten.md +3 -2
  58. package/.docs/models/providers/cline-pass.md +82 -0
  59. package/.docs/models/providers/crossmodel.md +2 -1
  60. package/.docs/models/providers/deepinfra.md +4 -7
  61. package/.docs/models/providers/deepseek.md +3 -1
  62. package/.docs/models/providers/empiriolabs.md +2 -1
  63. package/.docs/models/providers/evroc.md +3 -2
  64. package/.docs/models/providers/google.md +6 -4
  65. package/.docs/models/providers/inferx.md +3 -3
  66. package/.docs/models/providers/kilo.md +1 -1
  67. package/.docs/models/providers/kimi-for-coding.md +10 -11
  68. package/.docs/models/providers/llmgateway.md +5 -8
  69. package/.docs/models/providers/moonshotai-cn.md +3 -2
  70. package/.docs/models/providers/moonshotai.md +3 -2
  71. package/.docs/models/providers/nebius.md +3 -1
  72. package/.docs/models/providers/novita-ai.md +3 -1
  73. package/.docs/models/providers/ollama-cloud.md +25 -42
  74. package/.docs/models/providers/opencode-go.md +5 -3
  75. package/.docs/models/providers/opencode.md +4 -2
  76. package/.docs/models/providers/orcarouter.md +1 -1
  77. package/.docs/models/providers/privatemode-ai.md +10 -10
  78. package/.docs/models/providers/thinkingmachines.md +73 -0
  79. package/.docs/models/providers/togetherai.md +2 -6
  80. package/.docs/models/providers/wandb.md +2 -1
  81. package/.docs/models/providers/zenmux.md +3 -1
  82. package/.docs/models/providers.md +3 -0
  83. package/.docs/reference/acp/acp-agent.md +2 -0
  84. package/.docs/reference/acp/create-acp-tool.md +28 -0
  85. package/.docs/reference/agent-controller/session.md +15 -0
  86. package/.docs/reference/agents/agent.md +13 -1
  87. package/.docs/reference/agents/durable-agent.md +23 -0
  88. package/.docs/reference/agents/generate.md +19 -1
  89. package/.docs/reference/browser/firecrawl-browser.md +71 -0
  90. package/.docs/reference/cli/create-mastra.md +118 -43
  91. package/.docs/reference/cli/mastra.md +47 -5
  92. package/.docs/reference/code-sdk/mount-agent-controller.md +4 -4
  93. package/.docs/reference/core/getMCPServer.md +1 -3
  94. package/.docs/reference/core/getMCPServerById.md +1 -3
  95. package/.docs/reference/core/getWorkflow.md +1 -3
  96. package/.docs/reference/core/listMCPServers.md +2 -6
  97. package/.docs/reference/datasets/addItem.md +1 -3
  98. package/.docs/reference/datasets/addItems.md +1 -3
  99. package/.docs/reference/datasets/compareExperiments.md +1 -3
  100. package/.docs/reference/datasets/create.md +1 -3
  101. package/.docs/reference/datasets/dataset.md +2 -6
  102. package/.docs/reference/datasets/datasets-manager.md +5 -15
  103. package/.docs/reference/datasets/delete.md +1 -3
  104. package/.docs/reference/datasets/deleteExperiment.md +1 -3
  105. package/.docs/reference/datasets/deleteItem.md +1 -3
  106. package/.docs/reference/datasets/deleteItems.md +1 -3
  107. package/.docs/reference/datasets/get.md +1 -3
  108. package/.docs/reference/datasets/getDetails.md +1 -3
  109. package/.docs/reference/datasets/getExperiment.md +1 -3
  110. package/.docs/reference/datasets/getItem.md +1 -3
  111. package/.docs/reference/datasets/getItemHistory.md +1 -3
  112. package/.docs/reference/datasets/list.md +1 -3
  113. package/.docs/reference/datasets/listExperimentResults.md +1 -3
  114. package/.docs/reference/datasets/listExperiments.md +1 -3
  115. package/.docs/reference/datasets/listItems.md +1 -3
  116. package/.docs/reference/datasets/listVersions.md +1 -3
  117. package/.docs/reference/datasets/startExperiment.md +1 -3
  118. package/.docs/reference/datasets/startExperimentAsync.md +1 -3
  119. package/.docs/reference/datasets/update.md +1 -3
  120. package/.docs/reference/datasets/updateItem.md +1 -3
  121. package/.docs/reference/editor/mastra-editor.md +1 -3
  122. package/.docs/reference/evals/context-recall.md +205 -0
  123. package/.docs/reference/evals/create-scorer.md +4 -10
  124. package/.docs/reference/evals/mastra-scorer.md +1 -3
  125. package/.docs/reference/evals/run-evals.md +94 -2
  126. package/.docs/reference/file-based-agents/tools.md +7 -6
  127. package/.docs/reference/index.md +5 -0
  128. package/.docs/reference/memory/observational-memory.md +21 -0
  129. package/.docs/reference/observability/tracing/exporters/posthog.md +39 -1
  130. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -3
  131. package/.docs/reference/processors/token-limiter-processor.md +1 -3
  132. package/.docs/reference/rag/database-config.md +12 -0
  133. package/.docs/reference/streaming/agents/stream.md +3 -1
  134. package/.docs/reference/templates/overview.md +6 -32
  135. package/.docs/reference/tools/create-tool.md +78 -52
  136. package/.docs/reference/tools/mcp-client.md +104 -24
  137. package/.docs/reference/tools/mcp-server.md +143 -44
  138. package/.docs/reference/tools/tavily.md +1 -1
  139. package/.docs/reference/tools/vector-query-tool.md +22 -0
  140. package/.docs/reference/vectors/mongodb.md +2 -0
  141. package/.docs/reference/vectors/turbopuffer.md +4 -0
  142. package/.docs/reference/voice/mistral.md +127 -0
  143. package/.docs/reference/workspace/daytona-sandbox.md +2 -6
  144. package/.docs/reference/workspace/platform-filesystem.md +182 -0
  145. package/.docs/reference/workspace/platform-sandbox.md +200 -0
  146. package/.docs/reference/workspace/railway-sandbox.md +37 -1
  147. package/CHANGELOG.md +78 -0
  148. package/dist/{chunk-GLPCVXXO.js → chunk-HGADBLKG.js} +2 -2
  149. package/dist/{chunk-GLPCVXXO.js.map → chunk-HGADBLKG.js.map} +1 -1
  150. package/dist/index.js +1 -1
  151. package/dist/stdio.js +1 -1
  152. package/dist/tools/docs.d.ts.map +1 -1
  153. package/package.json +7 -7
@@ -44,17 +44,31 @@ export const weatherTool = createTool({
44
44
  location: z.string().describe('City name'),
45
45
  }),
46
46
  outputSchema: z.object({
47
- output: z.string(),
47
+ location: z.string(),
48
+ temperatureCelsius: z.number(),
49
+ conditions: z.string(),
48
50
  }),
49
51
  execute: async ({ location }) => {
50
52
  return {
51
- output: `The weather in ${location} is sunny`,
53
+ location,
54
+ temperatureCelsius: 21,
55
+ conditions: 'sunny',
52
56
  }
53
57
  },
54
58
  })
55
59
  ```
56
60
 
57
- If you need to create an agent, create a new file and use `import { Agent } from "@mastra/core/agent"`. The constructor takes `{ id, name, instructions, model }`. The `model` property is a string in Mastra's model router format: `provider/model`, for example `openai/gpt-5.5`. For OpenAI models, use `openai/<model>`, not `openai:<model>`, and don't pass a provider object. No provider import is needed for this format. Don't install any AI SDK package unless Mastra's documentation says otherwise.
61
+ If you need to create an agent, create a new file and use `import { Agent } from "@mastra/core/agent"`. The constructor takes `{ id, name, instructions, model }`. The `model` property is a string in Mastra's model router format. No provider import is needed for this format. Don't install any AI SDK package unless Mastra's documentation says otherwise.
62
+
63
+ By defining the model using `provider/model` format Mastra automatically looks for environment variables for the given provider. The defined model requires an environment variable to be set for the provider. OpenAI: `OPENAI_API_KEY`. Anthropic: `ANTHROPIC_API_KEY`. Google: `GOOGLE_API_KEY`. Example: Any `openai/<model>` requires the `OPENAI_API_KEY` environment variable. Go to <https://mastra.ai/models/environment-variables> for a full list of supported providers and their environment variable names.
64
+
65
+ Short list of known model IDs are:
66
+
67
+ - `openai/gpt-5.5`, `openai/gpt-5-mini`
68
+ - `anthropic/claude-sonnet-4-6`, `anthropic/claude-opus-4-7`, `anthropic/claude-haiku-4-5`
69
+ - `google/gemini-2.5-flash`
70
+
71
+ Go to <https://mastra.ai/models> for a full list of supported models.
58
72
 
59
73
  Add a tool an agent by importing the tool and passing it to the agent constructor as a tools object.
60
74
 
@@ -83,16 +97,6 @@ export const weatherAgent = new Agent({
83
97
  })
84
98
  ```
85
99
 
86
- By defining the model using `provider/model` format Mastra automatically looks for environment variables for the given provider. The defined model requires an environment variable to be set for the provider. OpenAI: `OPENAI_API_KEY`. Anthropic: `ANTHROPIC_API_KEY`. Google: `GOOGLE_API_KEY`. Example: Any `openai/<model>` requires the `OPENAI_API_KEY` environment variable. Go to <https://mastra.ai/models/environment-variables> for a full list of supported providers and their environment variable names.
87
-
88
- Short list of known model IDs are:
89
-
90
- - `openai/gpt-5.5`, `openai/gpt-5-mini`
91
- - `anthropic/claude-sonnet-4-6`, `anthropic/claude-opus-4-7`, `anthropic/claude-haiku-4-5`
92
- - `google/gemini-2.5-flash`
93
-
94
- Go to <https://mastra.ai/models> for a full list of supported models.
95
-
96
100
  Create a Mastra entry point at `src/mastra/index.ts` and register the agent:
97
101
 
98
102
  ```ts
@@ -66,8 +66,8 @@ export const researchTool = createTool({
66
66
  timeoutMs: 600_000,
67
67
  maxRetries: 1,
68
68
  },
69
- execute: async ({ context }) => {
70
- // ...
69
+ execute: async ({ topic }) => {
70
+ // Run the research job for topic
71
71
  },
72
72
  })
73
73
  ```
@@ -159,8 +159,9 @@ cleanup()
159
159
  ```typescript
160
160
  import { createDurableAgent } from '@mastra/core/agent/durable'
161
161
  import { RedisServerCache } from '@mastra/redis'
162
+ import Redis from 'ioredis'
162
163
 
163
- const cache = new RedisServerCache({ url: 'redis://localhost:6379' })
164
+ const cache = new RedisServerCache({ client: new Redis('redis://localhost:6379') })
164
165
 
165
166
  export const durableAgent = createDurableAgent({
166
167
  agent,
@@ -59,7 +59,7 @@ A goal step runs inside the agentic execution loop, right after `isTaskComplete`
59
59
 
60
60
  - **Not satisfied, budget remaining** → the loop continues; per-evaluation feedback is injected so the agent iterates.
61
61
  - **Satisfied** → the loop stops and the objective is marked `done`.
62
- - **Budget exhausted** (`runsUsed >= maxRuns`) → the loop stops but the objective stays `active`, so raising `maxRuns` later can resume it.
62
+ - **Budget exhausted** (`runsUsed >= maxRuns`) → the loop stops and the objective is marked `paused`. Raise `maxRuns`, then resume the objective to continue.
63
63
 
64
64
  The step is a no-op for background-task, mid-tool-loop, and working-memory-only iterations — the same gating as `isTaskComplete`.
65
65
 
@@ -103,6 +103,8 @@ await worker.updateObjectiveOptions({ threadId, maxRuns: 100 })
103
103
  await worker.clearObjective({ threadId })
104
104
  ```
105
105
 
106
+ Objective records include an optional `activeDurationMs` value for user interfaces that display active pursuit time. Mastra advances this value while an agent runs toward an active objective and checkpoints it when the run ends or waits for tool approval. Missing values represent zero, and the duration measures agent execution rather than the goal's wall-clock age.
107
+
106
108
  Per-objective values written by `setObjective` / `updateObjectiveOptions` take precedence over the agent's `goal` config, and that precedence is remembered in thread state. See the [`GoalEvaluationPayload` in the ChunkType reference](https://mastra.ai/reference/streaming/ChunkType) for the full goal chunk shape.
107
109
 
108
110
  ## Related
@@ -34,8 +34,8 @@ For most agent-focused projects, **Turso** is the simplest starting point. It pr
34
34
 
35
35
  A database is attached at one of two scopes:
36
36
 
37
- - **Project scope**: The default. One database shared by all of the project's [environments](https://mastra.ai/docs/mastra-platform/environments). Its variables are injected into every deploy.
38
- - **Environment scope**: Attached to a single environment. Use this to isolate data between environments, for example separate production and staging databases.
37
+ - **Environment scope**: The default. Attached to a single environment so data stays isolated between environments (for example separate production and staging databases). When your project has one environment, `mastra env db create` picks it automatically; with several, the CLI prompts you to select one.
38
+ - **Project scope**: One database shared by all of the project's [environments](https://mastra.ai/docs/mastra-platform/environments). Opt in with `--shared`. Its variables are injected into every deploy.
39
39
 
40
40
  The scope is set when you attach the database and shown in `mastra env db list`.
41
41
 
@@ -43,22 +43,28 @@ The two scopes can't overlap for the same provider. Because a project-scoped dat
43
43
 
44
44
  ## Attach with the CLI
45
45
 
46
- Create and attach a database in one command. The CLI polls until it's ready, which takes a few seconds:
46
+ You don't have to run this command up front. If your project needs a hosted database but doesn't have one yet, `mastra deploy` offers to attach one for you when the deploy preflight check runs. Say yes and the deploy continues without leaving the CLI.
47
+
48
+ Alternatively, create and attach a database ahead of time. The CLI polls until it's ready, which takes a few seconds:
47
49
 
48
50
  ```bash
49
- # Shared by all environments
51
+ # Scoped to a single environment (the CLI picks the only one, or prompts if there are several)
50
52
  mastra env db create --kind turso
51
53
 
52
- # Scoped to the staging environment
54
+ # Scoped to a specific environment
53
55
  mastra env db create staging --kind turso
56
+
57
+ # Shared by all environments
58
+ mastra env db create --kind turso --shared
54
59
  ```
55
60
 
56
61
  Supported kinds are `turso` and `neon` (Postgres). Useful flags:
57
62
 
63
+ - `--shared`: Attach a project-scoped database shared by every environment. Cannot be combined with an environment argument.
58
64
  - `--name <name>`: Database name. Defaults to a name derived from the project slug.
59
65
  - `--region <region>`: Provider region ID for project-scoped databases (for example `fra`). Environment-scoped databases are placed near the environment's region automatically, and an explicit `--region` is ignored.
60
66
  - `--no-wait`: Return immediately instead of polling. Check progress later with `mastra env db show`.
61
- - `--json`: Machine-readable output.
67
+ - `--json`: Machine-readable output. When the project has multiple environments, `--json` requires an environment argument or `--shared` (no interactive prompt).
62
68
 
63
69
  Inspect and manage attached databases:
64
70
 
@@ -26,21 +26,27 @@ A local `.env` file is optional. Environment variables stored on the platform ar
26
26
 
27
27
  On the first run the CLI prompts you to create the platform project (named after your `package.json`) and the `production` environment. Accept the prompts, or pass `--yes` to accept defaults without confirmation.
28
28
 
29
- 2. The CLI runs a preflight check before anything ships. Storage that would fall back to a local file path blocks the deploy, because local files don't survive on the platform's ephemeral filesystem:
29
+ 2. The CLI runs a preflight check before anything ships. Storage that would fall back to a local file path (which doesn't survive on the platform's ephemeral filesystem) would normally block the deploy:
30
30
 
31
31
  ```text
32
- [LOCAL_STORAGE_PATH] file:./mastra.db will be used at runtime because TURSO_DATABASE_URL is not set
32
+ file:./mastra.db will be used at runtime because TURSO_DATABASE_URL is not set
33
33
  ```
34
34
 
35
- Attach a [hosted database](https://mastra.ai/docs/mastra-platform/database) that provides the missing variables:
35
+ Instead of erroring out, the CLI offers to fix it inline for you:
36
+
37
+ ```text
38
+ Preflight needs TURSO_DATABASE_URL for the production environment. Create a managed turso database now and attach it? (Y/n)
39
+ ```
40
+
41
+ Accept the prompt and provisioning takes a few seconds — the database's connection variables are injected into your deploys automatically, with nothing to copy into an `.env` file. Decline it, or run in a non-interactive shell (CI, `--yes`), and the CLI falls back to the previous behavior: it prints the exact command to run yourself.
36
42
 
37
43
  ```bash
38
- mastra env db create --kind turso
44
+ mastra env db create production --kind turso
39
45
  ```
40
46
 
41
- Provisioning takes a few seconds. The database's connection variables are injected into your deploys automatically, with nothing to copy into an `.env` file.
47
+ The environment slug (`production` above) matches the environment the CLI would have deployed to this is important because `mastra env db create` requires an environment argument in non-interactive shells when the project has more than one environment.
42
48
 
43
- > **Note:** If preflight reports a hard-coded local path instead (`Build contains a host-local storage URL`), guard it with an environment variable first so the file is only used during local development:
49
+ > **Note:** If preflight reports a hard-coded local path instead (`Build contains a host-local storage URL`), it can't offer the inline fix — guard the path with an environment variable first so the file is only used during local development:
44
50
  >
45
51
  > ```ts
46
52
  > new LibSQLStore({
@@ -77,7 +83,7 @@ Pass `--region` when a deploy creates a new environment to control where it runs
77
83
  mastra deploy --env production --region eu
78
84
  ```
79
85
 
80
- The region is fixed when the environment is created. Databases attached to an environment are placed near that environment's region automatically.
86
+ The region is fixed when the environment is created. Databases attached to an environment are placed near that environment's region automatically, and observability data is routed to the ingest region that matches the environment's residency zone. See [Regions](https://mastra.ai/docs/mastra-platform/regions) for the full list of supported regions, database placement, and observability co-location.
81
87
 
82
88
  ## Preflight checks
83
89
 
@@ -139,6 +145,7 @@ mastra deploy --env production --yes
139
145
  ## Related
140
146
 
141
147
  - [Environments](https://mastra.ai/docs/mastra-platform/environments)
148
+ - [Regions](https://mastra.ai/docs/mastra-platform/regions)
142
149
  - [Hosted databases](https://mastra.ai/docs/mastra-platform/database)
143
150
  - [`mastra deploy` CLI reference](https://mastra.ai/reference/cli/mastra)
144
151
  - [Configuration](https://mastra.ai/docs/mastra-platform/configuration)
@@ -26,7 +26,7 @@ mastra deploy --env staging
26
26
  mastra env create eu-preview --type preview --region eu
27
27
  ```
28
28
 
29
- Each project has a single `production` environment, created by your first deploy. The region is fixed at creation. Databases attached to an environment are placed near the environment's region automatically. The number of environments per project depends on your plan.
29
+ Each project has a single `production` environment, created by your first deploy. The region is fixed at creation. Databases attached to an environment are placed near the environment's region automatically, and observability data is routed to the ingest region for the matching residency zone. See [Regions](https://mastra.ai/docs/mastra-platform/regions) for the supported regions, database placement, and observability co-location. The number of environments per project depends on your plan.
30
30
 
31
31
  ## List environments
32
32
 
@@ -77,16 +77,16 @@ Each row shows the deploy status, environment, timestamp, and which deploy is cu
77
77
 
78
78
  ## Isolate an environment's data
79
79
 
80
- By default a hosted database attached to the project is shared by all environments. To isolate production data from staging data, attach a separate database to each environment instead:
80
+ Hosted databases are scoped to a single environment by default, so production and staging each read and write their own database:
81
81
 
82
82
  ```bash
83
83
  mastra env db create production --kind turso --name my-project-production-db
84
84
  mastra env db create staging --kind turso --name my-project-staging-db
85
85
  ```
86
86
 
87
- Each environment then reads and writes only its own database.
87
+ If you'd rather share one database across every environment, attach it with `--shared` instead: `mastra env db create --kind turso --shared`.
88
88
 
89
- An environment can only use one database per provider. If the project already has a shared project-scoped database of the same provider, attaching an environment-scoped one is rejected with a variable name conflict — delete the shared database with `mastra env db delete` first. Deleting a database destroys it with the provider along with all of its data, so export anything you need to keep. See [Hosted databases](https://mastra.ai/docs/mastra-platform/database) for the full scoping model.
89
+ An environment can only use one database per provider. If the project already has a shared (`--shared`) database of the same provider, attaching an environment-scoped one is rejected with a variable name conflict — delete the shared database with `mastra env db delete` first. Deleting a database destroys it with the provider along with all of its data, so export anything you need to keep. See [Hosted databases](https://mastra.ai/docs/mastra-platform/database) for the full scoping model.
90
90
 
91
91
  ## Delete an environment
92
92
 
@@ -99,5 +99,6 @@ The CLI asks for confirmation before deleting. Deleting an environment removes i
99
99
  ## Related
100
100
 
101
101
  - [Deploy](https://mastra.ai/docs/mastra-platform/deploy)
102
+ - [Regions](https://mastra.ai/docs/mastra-platform/regions)
102
103
  - [Hosted databases](https://mastra.ai/docs/mastra-platform/database)
103
104
  - [`mastra env` CLI reference](https://mastra.ai/reference/cli/mastra)
@@ -4,15 +4,15 @@
4
4
 
5
5
  Observability on Mastra platform is a standalone hosted product for searchable traces, logs, and metrics across Mastra projects and deploys. Use it when you want observability without deploying Studio first or setting up local storage.
6
6
 
7
- Mastra can configure platform observability during project setup. The CLI provisions a platform project, writes the required environment variables, and registers observability exporters in your Mastra config.
7
+ Use `mastra init` to configure platform observability while adding Mastra to an existing application, or configure it manually in a newly created Mastra project.
8
8
 
9
9
  ## Quickstart
10
10
 
11
- Choose the setup path that matches your project. New and existing projects can use the CLI to provision Observability automatically, while manual setup is available when you already manage platform projects and environment variables yourself.
11
+ Choose the setup path that matches your project.
12
12
 
13
13
  ### New project
14
14
 
15
- Create a new Mastra project:
15
+ Create a managed Mastra project. When prompted, opt into Mastra Platform Observability to configure it automatically:
16
16
 
17
17
  **npm**:
18
18
 
@@ -38,15 +38,7 @@ yarn create mastra
38
38
  bunx create-mastra
39
39
  ```
40
40
 
41
- When prompted, enable Mastra Observability:
42
-
43
- ```bash
44
- Enable Mastra Observability? (will open auth flow)
45
-
46
- > Yes
47
- ```
48
-
49
- The CLI authenticates with Mastra platform, creates a platform project, writes the required environment variables, and configures the observability exporters.
41
+ When you select observability, the create command authenticates with Mastra Platform, provisions a platform project, and writes the credentials to your project. If you skip platform setup or use a prompt-free creation flow, follow the [manual setup](#manual-setup) steps instead.
50
42
 
51
43
  ### Existing non-Mastra projects
52
44
 
@@ -10,7 +10,7 @@ The [Mastra platform](https://projects.mastra.ai) provides three products for de
10
10
 
11
11
  Deploy with a single command, [`mastra deploy`](https://mastra.ai/docs/mastra-platform/deploy), or connect a GitHub repository for push-to-deploy. See the [GitHub integration](https://mastra.ai/docs/mastra-platform/github) for the repository-linked flow.
12
12
 
13
- Each project can run multiple [**Environments**](https://mastra.ai/docs/mastra-platform/environments) (for example `production` and `staging`) and provision [**Hosted databases**](https://mastra.ai/docs/mastra-platform/database) from the CLI or project settings to persist application data with no manual configuration.
13
+ Each project can run multiple [**Environments**](https://mastra.ai/docs/mastra-platform/environments) (for example `production` and `staging`), provision [**Hosted databases**](https://mastra.ai/docs/mastra-platform/database) from the CLI or project settings to persist application data, and get a managed [**Workspace**](https://mastra.ai/docs/mastra-platform/workspace) per environment that gives agents a filesystem and a sandbox with no manual configuration.
14
14
 
15
15
  ## Get started
16
16
 
@@ -0,0 +1,73 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Regions
4
+
5
+ A region controls where a platform environment runs, where its [hosted database](https://mastra.ai/docs/mastra-platform/database) is placed, and where its observability data is stored. The region is fixed when the environment is created and can't be changed later.
6
+
7
+ Mastra platform offers two residency zones today, `us` and `eu`, backed by specific compute regions on Railway. Databases and observability follow the environment's region automatically.
8
+
9
+ ## Choose a region
10
+
11
+ Pass `--region` when creating or first deploying to an environment:
12
+
13
+ ```bash
14
+ mastra deploy --env production --region eu
15
+ mastra env create staging --region us
16
+ ```
17
+
18
+ Both `mastra deploy --region` and `mastra env create --region` accept either the `us` / `eu` shorthand or a canonical Railway region code from the table below. Shorthand is the recommended form.
19
+
20
+ The default when no region is passed is `us`, which resolves to `pdx` (Portland, Oregon).
21
+
22
+ ## Available regions
23
+
24
+ The residency selector offers four Railway regions across two zones. `us` and `eu` shorthand resolve to the underlined default in each zone.
25
+
26
+ | Zone | Railway code | Location |
27
+ | ---- | --------------- | ------------------------- |
28
+ | `us` | `pdx` (default) | Portland, Oregon |
29
+ | `us` | `iad` | Ashburn, Virginia |
30
+ | `us` | `sfo` | San Francisco, California |
31
+ | `eu` | `ams` (default) | Amsterdam, Netherlands |
32
+
33
+ Pass a Railway code directly when you need to pin an environment to a specific data center. Passing `us` selects `pdx`, and passing `eu` selects `ams`.
34
+
35
+ > **Note:** Additional Railway regions exist in the deploy pipeline (for example Singapore, `sin`) but aren't offered in the residency selector yet, because hosted databases and observability don't have local placement outside the US and EU. Passing an unrecognized region falls back to the US default rather than pinning to it.
36
+
37
+ ## Hosted database placement
38
+
39
+ When you attach an [environment-scoped database](https://mastra.ai/docs/mastra-platform/database), the platform picks the provider region closest to the environment. This is server-authoritative, so an explicit `--region` on `mastra env db create <env>` is ignored. The environment's region is the source of truth.
40
+
41
+ | Environment region | Turso region | Postgres (Neon) region |
42
+ | ------------------ | ----------------- | ------------------------------ |
43
+ | `pdx` | `sjc` (San Jose) | `aws-us-west-2` (Oregon) |
44
+ | `iad` | `iad` (Ashburn) | `aws-us-east-1` (N. Virginia) |
45
+ | `sfo` | `sjc` (San Jose) | `aws-us-west-2` (Oregon) |
46
+ | `ams` | `ams` (Amsterdam) | `aws-eu-central-1` (Frankfurt) |
47
+
48
+ Project-scoped databases (shared across environments) accept an explicit `--region` because they aren't bound to a single environment. Use a provider region ID for the flag, not the `us` / `eu` shorthand:
49
+
50
+ ```bash
51
+ mastra env db create --kind turso --region fra
52
+ mastra env db create --kind neon --region aws-us-east-1
53
+ ```
54
+
55
+ Turso offers 20+ regions and Postgres (Neon) is available across AWS and Azure regions in the US, EU, and APAC. See the [Turso regions list](https://docs.turso.tech/features/data-edge#locations) and [Neon regions list](https://neon.com/docs/introduction/regions) for the full set. Passing a code not offered by the provider fails at attach time with the provider's error.
56
+
57
+ ## Observability co-location
58
+
59
+ Observability ingest runs in two regions today: **US** (Iowa, `us-central1`) and **EU** (Amsterdam). Every environment's traces, logs, and metrics are routed to the ingest region that matches its residency zone:
60
+
61
+ | Environment region | Observability region |
62
+ | ----------------------------------- | -------------------- |
63
+ | `pdx`, `iad`, `sfo`, `us` shorthand | US (Iowa) |
64
+ | `ams`, `eu` shorthand | EU (Amsterdam) |
65
+
66
+ Compute and databases can be placed in more Railway and provider regions than observability supports, so co-location isn't perfect for every combination. A `us`-zone environment always sends telemetry to US ingest, and an `eu`-zone environment always sends telemetry to EU ingest, even if the underlying Railway region is a specific city not directly served by an ingest endpoint. Data residency is preserved at the zone level. Telemetry from an `eu` environment never crosses into the US.
67
+
68
+ ## Related
69
+
70
+ - [Deploy](https://mastra.ai/docs/mastra-platform/deploy)
71
+ - [Environments](https://mastra.ai/docs/mastra-platform/environments)
72
+ - [Hosted databases](https://mastra.ai/docs/mastra-platform/database)
73
+ - [Observability](https://mastra.ai/docs/mastra-platform/observability)
@@ -0,0 +1,111 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Workspace
4
+
5
+ A workspace gives an environment two things your agents can use at runtime:
6
+
7
+ - A **bucket** for filesystem storage, exposed to your code as [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem).
8
+ - A **sandbox** for executing commands, exposed as [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox).
9
+
10
+ Workspaces are provisioned per [environment](https://mastra.ai/docs/mastra-platform/environments), so `production` and `staging` each get their own bucket and sandbox. The platform manages provisioning, credentials, and lifecycle; your deploy code only needs to construct the providers.
11
+
12
+ ## When workspaces are provisioned
13
+
14
+ New projects have workspaces enabled by default. When you create an environment, the platform provisions a bucket for it automatically. The sandbox base image is warmed in the background so the first `PlatformSandbox` call starts quickly.
15
+
16
+ Existing projects that haven't opted in show an **Enable workspaces** action in the Workspaces tab. Enabling provisions a bucket for every environment on the project.
17
+
18
+ If provisioning fails for an environment — for example while Railway is under load — the Workspaces tab shows the failure and offers a retry. The environment itself is still created; only the workspace is unavailable until you retry.
19
+
20
+ ## Use the workspace from your code
21
+
22
+ Install the provider package:
23
+
24
+ **npm**:
25
+
26
+ ```bash
27
+ npm install @mastra/platform-workspace
28
+ ```
29
+
30
+ **pnpm**:
31
+
32
+ ```bash
33
+ pnpm add @mastra/platform-workspace
34
+ ```
35
+
36
+ **Yarn**:
37
+
38
+ ```bash
39
+ yarn add @mastra/platform-workspace
40
+ ```
41
+
42
+ **Bun**:
43
+
44
+ ```bash
45
+ bun add @mastra/platform-workspace
46
+ ```
47
+
48
+ Compose the providers into a workspace and register it with Mastra:
49
+
50
+ ```typescript
51
+ import { Workspace } from '@mastra/core/workspace'
52
+ import { PlatformFilesystem, PlatformSandbox } from '@mastra/platform-workspace'
53
+
54
+ export const workspace = new Workspace({
55
+ filesystem: new PlatformFilesystem(),
56
+ sandbox: new PlatformSandbox(),
57
+ })
58
+ ```
59
+
60
+ ```typescript
61
+ import { Mastra } from '@mastra/core'
62
+ import { workspace } from './workspace'
63
+
64
+ export const mastra = new Mastra({
65
+ workspace,
66
+ })
67
+ ```
68
+
69
+ `PlatformFilesystem` and `PlatformSandbox` read their credentials from environment variables the platform injects at deploy time, so you don't pass any options on the platform.
70
+
71
+ ## Injected environment variables
72
+
73
+ Every deploy that runs on a platform environment with a workspace receives these variables:
74
+
75
+ | Variable | Contents |
76
+ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
+ | `MASTRA_PLATFORM_SECRET_KEY` | Secret key scoped to the deploy. Used by the workspace providers to authenticate. `MASTRA_PLATFORM_ACCESS_TOKEN` is also injected as a deprecated alias. |
78
+ | `MASTRA_PROJECT_ID` | Project the deploy belongs to. |
79
+ | `MASTRA_ENVIRONMENT_ID` | Environment the deploy belongs to. Selects which sandbox pool the platform uses. |
80
+ | `MASTRA_PLATFORM_BUCKET_NAME` | Bucket name attached to the environment. Selects which bucket `PlatformFilesystem` reads and writes. |
81
+
82
+ These names are reserved. If your project sets any of them explicitly, the platform-managed values take precedence.
83
+
84
+ ## Local development
85
+
86
+ Reuse the same providers locally by putting the four variables in your `.env` file. Get the values from your project's Workspaces tab:
87
+
88
+ ```bash
89
+ MASTRA_PLATFORM_SECRET_KEY=your-secret-key
90
+ MASTRA_PROJECT_ID=your-project-id
91
+ MASTRA_ENVIRONMENT_ID=your-environment-id
92
+ MASTRA_PLATFORM_BUCKET_NAME=your-bucket-name
93
+ ```
94
+
95
+ `PlatformFilesystem` and `PlatformSandbox` behave the same locally as on the platform — they connect to the same bucket and sandbox pool for that environment. Use a `staging` or `preview` environment's variables for local runs if you want to keep production data isolated.
96
+
97
+ For a purely offline loop that never touches the platform, swap the providers for [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) and [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) in a local build.
98
+
99
+ ## Inspect the workspace
100
+
101
+ The Workspaces tab in your platform project shows, per environment:
102
+
103
+ - Bucket status and its contents, with upload, download, and delete actions.
104
+ - Recent sandbox sessions with their command, exit code, and duration.
105
+ - Provisioning failures with a **Retry** action.
106
+
107
+ ## See also
108
+
109
+ - [`PlatformFilesystem`](https://mastra.ai/reference/workspace/platform-filesystem) — reference for the filesystem provider.
110
+ - [`PlatformSandbox`](https://mastra.ai/reference/workspace/platform-sandbox) — reference for the sandbox provider.
111
+ - [Environments](https://mastra.ai/docs/mastra-platform/environments) — how environments scope workspaces, variables, and databases.
@@ -64,7 +64,7 @@ export const testMcpClient = new MCPClient({
64
64
 
65
65
  Visit [MCPClient](https://mastra.ai/reference/tools/mcp-client) for a full list of configuration options.
66
66
 
67
- > **Authentication:** For connecting to OAuth-protected MCP servers, see the [OAuth Authentication](https://mastra.ai/reference/tools/mcp-client) section.
67
+ > **Authentication:** For connecting to OAuth-protected MCP servers — including completing the browser-based authorization flow with `authenticate()` — see the [OAuth Authentication](https://mastra.ai/reference/tools/mcp-client) section.
68
68
 
69
69
  ## Using `MCPClient` with an agent
70
70
 
@@ -8,7 +8,7 @@ Observational Memory (OM) is Mastra's memory system for long-context agentic mem
8
8
 
9
9
  ## Quickstart
10
10
 
11
- Enable `observationalMemory` in the memory options when creating your agent:
11
+ Ensure you have `@mastra/memory` installed in your project. Set `observationalMemory: true` in your Memory config to enable Observational Memory.
12
12
 
13
13
  ```typescript
14
14
  import { Memory } from '@mastra/memory'
@@ -27,7 +27,54 @@ export const agent = new Agent({
27
27
  })
28
28
  ```
29
29
 
30
- That's it. The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses `google/gemini-2.5-flash` by default. Config objects also use this model unless you set a different one. To use a different model, pass it in the config object:
30
+ **For AI agents:** Using Observational Memory requires a storage provider! You either need to set it on the Mastra instance at `src/mastra/index.ts` or pass it to the Agent constructor.
31
+
32
+ The following script creates a local LibSQL database, enables Observational Memory, and uses one resource and thread across two agent calls:
33
+
34
+ ```typescript
35
+ import { Agent } from '@mastra/core/agent'
36
+ import { LibSQLStore } from '@mastra/libsql'
37
+ import { Memory } from '@mastra/memory'
38
+
39
+ const memory = new Memory({
40
+ storage: new LibSQLStore({
41
+ id: 'memory-storage',
42
+ url: 'file:./memory.db',
43
+ }),
44
+ options: {
45
+ observationalMemory: {
46
+ model: 'openai/gpt-5-mini',
47
+ },
48
+ },
49
+ })
50
+
51
+ const agent = new Agent({
52
+ id: 'memory-agent',
53
+ name: 'Memory Agent',
54
+ instructions: 'You are a helpful assistant.',
55
+ model: 'openai/gpt-5-mini',
56
+ memory,
57
+ })
58
+
59
+ const memoryOptions = {
60
+ resource: 'user-123',
61
+ thread: 'conversation-123',
62
+ }
63
+
64
+ const firstResponse = await agent.generate('Remember that my favorite color is blue.', {
65
+ memory: memoryOptions,
66
+ })
67
+ console.log(firstResponse.text)
68
+
69
+ const secondResponse = await agent.generate('What is my favorite color?', {
70
+ memory: memoryOptions,
71
+ })
72
+ console.log(secondResponse.text)
73
+ ```
74
+
75
+ The `resource` identifies the user or entity, while the `thread` identifies the conversation. Reuse both values to continue the same conversation. Observational Memory processes the stored history as it grows and replaces older messages with observations when its activation conditions are met.
76
+
77
+ The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses `google/gemini-2.5-flash` by default. To use a different model, pass it in the config object:
31
78
 
32
79
  ```typescript
33
80
  const memory = new Memory({
@@ -237,6 +284,34 @@ new Extractor({
237
284
  })
238
285
  ```
239
286
 
287
+ #### Read extracted values from a stream
288
+
289
+ Extractor results are emitted when OM completes an observation or reflection. Read both completion data parts from the stream:
290
+
291
+ ```typescript
292
+ const stream = await agent.stream('Remember that I prefer dark mode.')
293
+
294
+ for await (const chunk of stream.fullStream) {
295
+ if (chunk.type === 'data-om-observation-end' || chunk.type === 'data-om-buffering-end') {
296
+ const { operationType, extractedValues = {}, extractionFailures = [] } = chunk.data
297
+
298
+ for (const [slug, value] of Object.entries(extractedValues)) {
299
+ console.log(`${operationType} extractor ${slug}:`, value)
300
+ }
301
+
302
+ for (const failure of extractionFailures) {
303
+ console.error(`Extractor ${failure.slug} failed:`, failure.error)
304
+ }
305
+ }
306
+ }
307
+ ```
308
+
309
+ `extractedValues` uses each extractor's slug as its key. Both result fields are optional, and a failed extractor doesn't remove values from successful extractors.
310
+
311
+ `data-om-observation-end` reports a synchronous completion. `data-om-buffering-end` reports completed background work. Its extractor metadata is persisted immediately, but the buffered content remains inactive until activation. Check `operationType` to determine whether the completed work was an observation or reflection.
312
+
313
+ See the [`data-om-observation-end`](https://mastra.ai/reference/memory/observational-memory) and [`data-om-buffering-end`](https://mastra.ai/reference/memory/observational-memory) reference tables for the complete payloads.
314
+
240
315
  ### Working memory updates
241
316
 
242
317
  Use `observationalMemory.observation.manageWorkingMemory` to let the Observer manage working memory automatically. The main agent no longer needs to call the working memory tool while it handles the user request, so working memory updates don't depend on the agent remembering to make them.
@@ -81,6 +81,8 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
81
81
 
82
82
  3. Add the storage provider to your main Mastra instance to enable memory across all configured agents.
83
83
 
84
+ **For AI agents:** Important: Add `id` to `LibSQLStore`.
85
+
84
86
  ```typescript
85
87
  import { Mastra } from '@mastra/core'
86
88
  import { LibSQLStore } from '@mastra/libsql'
@@ -151,6 +153,8 @@ To list all threads for a resource, or retrieve a specific thread, [use the memo
151
153
 
152
154
  For long-running conversations, raw message history grows until it fills the context window, degrading agent performance. [Observational Memory](https://mastra.ai/docs/memory/observational-memory) solves this by running background agents that compress old messages into dense observations, keeping the context window small while preserving long-term memory.
153
155
 
156
+ **For AI agents:** Using Observational Memory requires a storage provider! You either need to set it on the Mastra instance at `src/mastra/index.ts` or pass it to the Agent constructor.
157
+
154
158
  ```typescript
155
159
  import { Agent } from '@mastra/core/agent'
156
160
  import { Memory } from '@mastra/memory'
@@ -127,6 +127,10 @@ const ratingsOverTime = await observability!.getFeedbackTimeSeries({
127
127
 
128
128
  See the [feedback reference](https://mastra.ai/reference/observability/feedback) for all fields, filters, return types, and percentile query parameters.
129
129
 
130
+ ## Export feedback to external platforms
131
+
132
+ Feedback flows through the observability event bus, so exporters that support feedback forward it automatically. The [PostHog exporter](https://mastra.ai/reference/observability/tracing/exporters/posthog) sends feedback as native `$ai_feedback` events that appear on the linked trace in PostHog.
133
+
130
134
  ## Related
131
135
 
132
136
  - [Observability overview](https://mastra.ai/docs/observability/overview)
@@ -126,9 +126,7 @@ export const mastra = new Mastra({
126
126
  },
127
127
  },
128
128
  }),
129
- agents: {
130
- /* your agents */
131
- },
129
+ agents: {/* your agents */},
132
130
  })
133
131
  ```
134
132
 
@@ -425,9 +425,7 @@ To disable a signal, set the `signals` option:
425
425
 
426
426
  ```typescript
427
427
  new OtelExporter({
428
- provider: {
429
- /* ... */
430
- },
428
+ provider: {/* ... */},
431
429
  signals: {
432
430
  traces: true, // default
433
431
  logs: false, // disable log export