@mastra/mcp-docs-server 1.2.7-alpha.8 → 1.2.7
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.
- package/.docs/docs/agent-builder/integrations.md +44 -2
- package/.docs/docs/agent-builder/skill-registries.md +1 -3
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agent-controller/session.md +1 -3
- package/.docs/docs/agents/code-mode.md +17 -1
- package/.docs/docs/agents/guardrails.md +8 -8
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +9 -3
- package/.docs/docs/agents/skills.md +2 -4
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +1 -3
- package/.docs/docs/agents/using-tools.md +4 -4
- package/.docs/docs/browser/agent-browser.md +1 -3
- package/.docs/docs/browser/browser-viewer.md +1 -3
- package/.docs/docs/browser/stagehand.md +1 -1
- package/.docs/docs/capabilities/channels/overview.md +1 -3
- package/.docs/docs/deployment/mastra-server.md +2 -4
- package/.docs/docs/editor/overview.md +2 -6
- package/.docs/docs/editor/prompts.md +1 -1
- package/.docs/docs/editor/tools.md +3 -5
- package/.docs/docs/evals/custom-scorers.md +1 -3
- package/.docs/docs/evals/datasets/overview.md +4 -4
- package/.docs/docs/evals/datasets/running-experiments.md +4 -2
- package/.docs/docs/evals/evals-with-memory.md +1 -3
- package/.docs/docs/evals/gates-and-verdicts.md +17 -2
- package/.docs/docs/evals/quick-checks.md +1 -3
- package/.docs/docs/getting-started/file-based-agents.md +9 -4
- package/.docs/docs/long-running-agents/background-tasks.md +1 -1
- package/.docs/docs/long-running-agents/durable-agents.md +3 -5
- package/.docs/docs/long-running-agents/goals.md +1 -3
- package/.docs/docs/long-running-agents/signal-providers.md +1 -3
- package/.docs/docs/long-running-agents/signals.md +7 -21
- package/.docs/docs/mastra-platform/configuration.md +15 -22
- package/.docs/docs/mastra-platform/database.md +50 -6
- package/.docs/docs/mastra-platform/deploy.md +142 -0
- package/.docs/docs/mastra-platform/environments.md +103 -0
- package/.docs/docs/mastra-platform/github.md +2 -2
- package/.docs/docs/mastra-platform/overview.md +5 -5
- package/.docs/docs/mastra-platform/server.md +2 -0
- package/.docs/docs/mastra-platform/studio.md +5 -3
- package/.docs/docs/mcp/mcp-apps.md +3 -3
- package/.docs/docs/mcp/overview.md +6 -10
- package/.docs/docs/memory/overview.md +4 -4
- package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -3
- package/.docs/docs/observability/logging.md +3 -1
- package/.docs/docs/observability/metrics/querying.md +2 -0
- package/.docs/docs/observability/tracing/overview.md +3 -1
- package/.docs/docs/server/auth/auth0.md +1 -1
- package/.docs/docs/server/auth/better-auth.md +2 -2
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/firebase.md +1 -1
- package/.docs/docs/server/auth/google.md +2 -2
- package/.docs/docs/server/auth/jwt.md +2 -2
- package/.docs/docs/server/auth/okta.md +2 -2
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/pubsub.md +1 -1
- package/.docs/docs/server/request-context.md +4 -4
- package/.docs/docs/server/server-adapters.md +8 -8
- package/.docs/docs/studio/auth.md +1 -3
- package/.docs/docs/workflows/agents-and-tools.md +3 -5
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/overview.md +5 -5
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
- package/.docs/guides/concepts/streaming.md +3 -3
- package/.docs/guides/guide/chef-michel.md +1 -1
- package/.docs/guides/guide/coding-agent.md +392 -0
- package/.docs/guides/migrations/mastra-cloud.md +5 -12
- package/.docs/models/environment-variables.md +14 -2
- package/.docs/models/gateways/azure-openai.md +15 -15
- package/.docs/models/gateways/mastra.md +2 -2
- package/.docs/models/gateways/openrouter.md +4 -7
- package/.docs/models/gateways/vercel.md +5 -10
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/abacus.md +44 -14
- package/.docs/models/providers/ai-router.md +77 -0
- package/.docs/models/providers/ambient.md +10 -6
- package/.docs/models/providers/baseten.md +1 -1
- package/.docs/models/providers/blueclaw.md +74 -0
- package/.docs/models/providers/crossmodel.md +8 -2
- package/.docs/models/providers/daoxe.md +81 -0
- package/.docs/models/providers/databricks.md +7 -2
- package/.docs/models/providers/deepinfra.md +2 -2
- package/.docs/models/providers/deepseek.md +2 -2
- package/.docs/models/providers/ebcloud.md +76 -0
- package/.docs/models/providers/empiriolabs.md +108 -0
- package/.docs/models/providers/google.md +4 -0
- package/.docs/models/providers/hpc-ai.md +16 -10
- package/.docs/models/providers/inferx.md +78 -0
- package/.docs/models/providers/llmgateway.md +2 -8
- package/.docs/models/providers/lynkr.md +73 -0
- package/.docs/models/providers/model-oracle-ai.md +87 -0
- package/.docs/models/providers/neon.md +1 -1
- package/.docs/models/providers/nvidia.md +1 -3
- package/.docs/models/providers/openai.md +12 -3
- package/.docs/models/providers/opencode.md +5 -2
- package/.docs/models/providers/pioneer.md +148 -0
- package/.docs/models/providers/routing-run.md +4 -1
- package/.docs/models/providers/snowflake-cortex.md +4 -1
- package/.docs/models/providers/stepfun-ai-step-plan.md +75 -0
- package/.docs/models/providers/stepfun-ai.md +6 -6
- package/.docs/models/providers/stepfun-step-plan.md +76 -0
- package/.docs/models/providers/stepfun.md +5 -5
- package/.docs/models/providers/unorouter.md +95 -0
- package/.docs/models/providers/vivgrid.md +5 -2
- package/.docs/models/providers/wafer.ai.md +9 -12
- package/.docs/models/providers/xai.md +1 -1
- package/.docs/models/providers/zenmux.md +5 -1
- package/.docs/models/providers.md +14 -2
- package/.docs/reference/agents/generateLegacy.md +8 -2
- package/.docs/reference/cli/mastra.md +131 -10
- package/.docs/reference/code-sdk/mount-agent-controller.md +2 -0
- package/.docs/reference/coding-agent/create-coding-agent.md +5 -4
- package/.docs/reference/evals/create-scorer.md +63 -0
- package/.docs/reference/evals/run-evals.md +2 -2
- package/.docs/reference/file-based-agents/logger.md +26 -0
- package/.docs/reference/file-based-agents/scorers.md +54 -0
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/mastra-platform/api.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +8 -8
- package/.docs/reference/observability/tracing/exporters/braintrust.md +1 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +10 -9
- package/.docs/reference/observability/tracing/exporters/langsmith.md +8 -7
- package/.docs/reference/observability/tracing/exporters/posthog.md +13 -12
- package/.docs/reference/observability/tracing/exporters/sentry.md +1 -0
- package/.docs/reference/observability/tracing/interfaces.md +9 -0
- package/.docs/reference/processors/stream-error-retry-processor.md +39 -2
- package/.docs/reference/pubsub/base.md +10 -0
- package/.docs/reference/pubsub/caching-pubsub.md +8 -0
- package/.docs/reference/pubsub/redis-streams.md +12 -0
- package/.docs/reference/server/express-adapter.md +1 -3
- package/.docs/reference/server/fastify-adapter.md +1 -3
- package/.docs/reference/server/hono-adapter.md +1 -3
- package/.docs/reference/server/koa-adapter.md +1 -3
- package/.docs/reference/server/nestjs-adapter.md +1 -3
- package/.docs/reference/server/register-api-route.md +5 -4
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/mcp-client.md +22 -0
- package/.docs/reference/tools/mcp-server.md +161 -4
- package/.docs/reference/voice/google.md +48 -8
- package/.docs/reference/voice/speechify.md +10 -6
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +1 -3
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -3
- package/.docs/reference/workspace/apple-container-sandbox.md +1 -3
- package/.docs/reference/workspace/archil-filesystem.md +1 -3
- package/.docs/reference/workspace/azure-blob-filesystem.md +1 -3
- package/.docs/reference/workspace/blaxel-sandbox.md +1 -3
- package/.docs/reference/workspace/daytona-sandbox.md +1 -3
- package/.docs/reference/workspace/docker-sandbox.md +1 -3
- package/.docs/reference/workspace/e2b-sandbox.md +20 -3
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -3
- package/.docs/reference/workspace/gcs-filesystem.md +1 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +1 -3
- package/.docs/reference/workspace/local-filesystem.md +1 -3
- package/.docs/reference/workspace/local-sandbox.md +1 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -3
- package/.docs/reference/workspace/railway-sandbox.md +1 -3
- package/.docs/reference/workspace/s3-filesystem.md +1 -3
- package/.docs/reference/workspace/vercel-sandbox.md +5 -7
- package/.docs/reference/workspace/vercel-serverless.md +1 -3
- package/CHANGELOG.md +79 -0
- package/package.json +10 -10
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
> **Beta:** This feature is in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
8
8
|
|
|
9
|
-
File-based agents are
|
|
9
|
+
File-based agents are an experimental, convention-based way to define [Mastra agents](https://mastra.ai/docs/agents/overview) and the primitives they use in files under `src/mastra/`, instead of registering them manually on your [`Mastra`](https://mastra.ai/reference/core/mastra-class) instance.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This approach reduces glue code and makes the file system itself a direct representation of your [project structure](https://mastra.ai/reference/project-structure), so both you and your coding agent can understand it at a glance.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You can build your entire project with file-based agents or combine this approach with agents and other primitives defined directly in code, making it easy to adopt incrementally.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
File-based agents have some limitations while in beta. Not every Mastra feature can be defined in a file yet, and they are not the best fit for dynamic configuration or runtime wiring. When needed, you can define agents and related primitives directly in code.
|
|
16
|
+
|
|
17
|
+
> **Note:** All Mastra documentation currently shows agents and primitives defined directly in code. File-based agents use the same underlying concepts and APIs, so the guidance elsewhere in the docs still applies. As file-based agents mature, more examples may use this structure where appropriate.
|
|
16
18
|
|
|
17
19
|
## Basic layout
|
|
18
20
|
|
|
@@ -70,12 +72,15 @@ Map each primitive or feature to its file convention:
|
|
|
70
72
|
| [Memory](https://mastra.ai/reference/file-based-agents/memory) | `src/mastra/agents/<agent-id>/memory.ts` |
|
|
71
73
|
| [Workspace](https://mastra.ai/reference/file-based-agents/workspace) | `src/mastra/agents/<agent-id>/workspace.ts` and `src/mastra/agents/<agent-id>/workspace/` |
|
|
72
74
|
| [Processors](https://mastra.ai/reference/file-based-agents/processors) | `src/mastra/agents/<agent-id>/processors/` |
|
|
75
|
+
| [Scorers](https://mastra.ai/reference/file-based-agents/scorers) | `src/mastra/agents/<agent-id>/scorers/` |
|
|
73
76
|
| [Subagents](https://mastra.ai/reference/file-based-agents/subagents) | `src/mastra/agents/<agent-id>/subagents/` |
|
|
74
77
|
| [Workflows](https://mastra.ai/reference/file-based-agents/workflows) | `src/mastra/workflows/` |
|
|
75
78
|
| [Storage](https://mastra.ai/reference/file-based-agents/storage) | `src/mastra/storage.ts` |
|
|
76
79
|
| [Observability](https://mastra.ai/reference/file-based-agents/observability) | `src/mastra/observability.ts` |
|
|
80
|
+
| [Logger](https://mastra.ai/reference/file-based-agents/logger) | `src/mastra/logger.ts` |
|
|
77
81
|
| [Server config](https://mastra.ai/reference/file-based-agents/server) | `src/mastra/server.ts` |
|
|
78
82
|
| [Studio config](https://mastra.ai/reference/file-based-agents/studio) | `src/mastra/studio.ts` |
|
|
83
|
+
| [Schedules](https://mastra.ai/docs/long-running-agents/schedules) | Not yet file-based — create at runtime with `mastra.schedules.create()` |
|
|
79
84
|
|
|
80
85
|
## Discovery lifecycle
|
|
81
86
|
|
|
@@ -168,7 +168,7 @@ const stream = await agent.stream('Research solana for me', {
|
|
|
168
168
|
})
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
Visit [`Agent.stream()`](https://mastra.ai/reference/streaming/agents/stream) for the full API.
|
|
172
172
|
|
|
173
173
|
### Aggregate properties
|
|
174
174
|
|
|
@@ -60,9 +60,7 @@ for await (const chunk of output.fullStream) {
|
|
|
60
60
|
cleanup()
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
The returned `runId` identifies the execution. Pass it to `observe()` to reconnect from a different client.
|
|
64
|
-
|
|
65
|
-
> **Note:** Visit the [DurableAgent reference](https://mastra.ai/reference/agents/durable-agent) for the full configuration and method API.
|
|
63
|
+
The returned `runId` identifies the execution. Pass it to `observe()` to reconnect from a different client. Visit the [DurableAgent reference](https://mastra.ai/reference/agents/durable-agent) for the full configuration and method API.
|
|
66
64
|
|
|
67
65
|
## How it works
|
|
68
66
|
|
|
@@ -140,7 +138,7 @@ const agent = new Agent({
|
|
|
140
138
|
export const inngestAnalyst = createInngestAgent({ agent, inngest })
|
|
141
139
|
```
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
Visit the [`createInngestAgent()` reference](https://mastra.ai/reference/agents/inngest-agent) for the full API, including Inngest-specific options like PubSub and cache configuration.
|
|
144
142
|
|
|
145
143
|
## Resumable streams
|
|
146
144
|
|
|
@@ -199,7 +197,7 @@ await durableAgent.stream('Research topic', {
|
|
|
199
197
|
})
|
|
200
198
|
```
|
|
201
199
|
|
|
202
|
-
|
|
200
|
+
Visit [Background tasks](https://mastra.ai/docs/long-running-agents/background-tasks) for the full background task guide, including configuration, subagents, and suspend/resume.
|
|
203
201
|
|
|
204
202
|
## Cleanup
|
|
205
203
|
|
|
@@ -103,9 +103,7 @@ await worker.updateObjectiveOptions({ threadId, maxRuns: 100 })
|
|
|
103
103
|
await worker.clearObjective({ threadId })
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Per-objective values written by `setObjective` / `updateObjectiveOptions` take precedence over the agent's `goal` config, and that precedence is remembered in thread state.
|
|
107
|
-
|
|
108
|
-
> **Note:** See the [`GoalEvaluationPayload` in the ChunkType reference](https://mastra.ai/reference/streaming/ChunkType) for the full goal chunk shape.
|
|
106
|
+
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.
|
|
109
107
|
|
|
110
108
|
## Related
|
|
111
109
|
|
|
@@ -157,9 +157,7 @@ export class CiSignals extends SignalProvider<'ci-signals'> {
|
|
|
157
157
|
}
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
`handleWebhook()` is a provider method, not an auto-mounted HTTP route. Invoke it from your own endpoint, passing the request body, headers, and any route params.
|
|
161
|
-
|
|
162
|
-
> **Note:** Visit [`SignalProvider` reference](https://mastra.ai/reference/signals/signal-provider) for subscription, polling, lifecycle, and `notify()` details. For the complete notification payload shape, including deduplication and coalescing fields, visit [`Agent.sendNotificationSignal()` reference](https://mastra.ai/reference/agents/agent).
|
|
160
|
+
`handleWebhook()` is a provider method, not an auto-mounted HTTP route. Invoke it from your own endpoint, passing the request body, headers, and any route params. Visit [`SignalProvider` reference](https://mastra.ai/reference/signals/signal-provider) for subscription, polling, lifecycle, and `notify()` details. For the complete notification payload shape, including deduplication and coalescing fields, visit [`Agent.sendNotificationSignal()` reference](https://mastra.ai/reference/agents/agent).
|
|
163
161
|
|
|
164
162
|
## Built-in webhook provider
|
|
165
163
|
|
|
@@ -112,9 +112,7 @@ const result = agent.sendSignal(
|
|
|
112
112
|
await result.persisted
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
Pass `ifIdle.streamOptions` when the idle wake-up stream needs options such as model settings, tools, or runtime context.
|
|
116
|
-
|
|
117
|
-
> **Note:** Visit [`Agent.sendSignal()` reference](https://mastra.ai/reference/agents/agent) for `ifActive`, `ifIdle`, branch attributes, and `streamOptions`.
|
|
115
|
+
Pass `ifIdle.streamOptions` when the idle wake-up stream needs options such as model settings, tools, or runtime context. Visit [`Agent.sendSignal()` reference](https://mastra.ai/reference/agents/agent) for `ifActive`, `ifIdle`, branch attributes, and `streamOptions`.
|
|
118
116
|
|
|
119
117
|
### Send notification context
|
|
120
118
|
|
|
@@ -199,9 +197,7 @@ Awaiting `sendSignal()` preserves stream echo ordering when a subscribed thread
|
|
|
199
197
|
|
|
200
198
|
### Conditional attributes
|
|
201
199
|
|
|
202
|
-
Use `ifActive.attributes` and `ifIdle.attributes` to tag input with context that depends on whether the agent is active or idle at delivery time. Top-level `attributes` always apply, and Mastra merges the selected branch's `attributes` into them when the input is accepted.
|
|
203
|
-
|
|
204
|
-
> **Note:** Visit [`Agent.sendMessage()` reference](https://mastra.ai/reference/agents/agent) and [`Agent.sendSignal()` reference](https://mastra.ai/reference/agents/agent) for branch-specific attributes.
|
|
200
|
+
Use `ifActive.attributes` and `ifIdle.attributes` to tag input with context that depends on whether the agent is active or idle at delivery time. Top-level `attributes` always apply, and Mastra merges the selected branch's `attributes` into them when the input is accepted. Visit [`Agent.sendMessage()` reference](https://mastra.ai/reference/agents/agent) and [`Agent.sendSignal()` reference](https://mastra.ai/reference/agents/agent) for branch-specific attributes.
|
|
205
201
|
|
|
206
202
|
## State and notification signals
|
|
207
203
|
|
|
@@ -276,9 +272,7 @@ Notification signals represent external events such as GitHub activity, email, S
|
|
|
276
272
|
|
|
277
273
|
Notification delivery has two phases. During ingress, `agent.sendNotificationSignal()` stores a notification record and resolves the agent's delivery policy. During dispatch, Mastra consumes due records and emits full notification or summary signals.
|
|
278
274
|
|
|
279
|
-
The default delivery policy is priority-aware. Urgent notifications deliver immediately, while lower-priority notifications may be batched into summaries or wait until the thread is idle.
|
|
280
|
-
|
|
281
|
-
> **Note:** Visit [`Agent.sendNotificationSignal()` reference](https://mastra.ai/reference/agents/agent) for notification fields, [`Agent` constructor reference](https://mastra.ai/reference/agents/agent) for `notifications.deliveryPolicy` configuration, and [`createNotificationInboxTool()` reference](https://mastra.ai/reference/signals/create-notification-inbox-tool) for inbox tool actions.
|
|
275
|
+
The default delivery policy is priority-aware. Urgent notifications deliver immediately, while lower-priority notifications may be batched into summaries or wait until the thread is idle. Visit [`Agent.sendNotificationSignal()` reference](https://mastra.ai/reference/agents/agent) for notification fields, [`Agent` constructor reference](https://mastra.ai/reference/agents/agent) for `notifications.deliveryPolicy` configuration, and [`createNotificationInboxTool()` reference](https://mastra.ai/reference/signals/create-notification-inbox-tool) for inbox tool actions.
|
|
282
276
|
|
|
283
277
|
```typescript
|
|
284
278
|
await agent.sendNotificationSignal(
|
|
@@ -314,15 +308,11 @@ Notification summaries tell the model that inbox records are waiting:
|
|
|
314
308
|
|
|
315
309
|
When Mastra emits a summary, it clears `summaryAt` and sets `summarySignalId` on each summarized record. The records stay pending and readable. When Mastra emits a full notification, it sets `deliveredSignalId` and marks the record `delivered`. If the inbox tool reads a notification first, it can inject the full notification signal and mark the record `seen`, which prevents duplicate full delivery.
|
|
316
310
|
|
|
317
|
-
Configure a delivery policy on the agent when some notifications should wait for a different dispatch window or summary rollup. Enable scheduled dispatch at the Mastra level when deferred notifications and summary rollups should be delivered automatically.
|
|
318
|
-
|
|
319
|
-
> **Note:** Visit [`Agent` constructor reference](https://mastra.ai/reference/agents/agent) for `notifications.deliveryPolicy` and [`Mastra` class reference](https://mastra.ai/reference/core/mastra-class) for runtime notification dispatch configuration.
|
|
311
|
+
Configure a delivery policy on the agent when some notifications should wait for a different dispatch window or summary rollup. Enable scheduled dispatch at the Mastra level when deferred notifications and summary rollups should be delivered automatically. Visit [`Agent` constructor reference](https://mastra.ai/reference/agents/agent) for `notifications.deliveryPolicy` and [`Mastra` class reference](https://mastra.ai/reference/core/mastra-class) for runtime notification dispatch configuration.
|
|
320
312
|
|
|
321
313
|
#### Notification inbox tool
|
|
322
314
|
|
|
323
|
-
Use `createNotificationInboxTool()` to give agents one tool for inbox actions instead of many CRUD tools. Use `read` after a `<notification-summary>` signal when the agent needs the full records behind the summary. The notification contents are delivered as signals, not as normal tool output.
|
|
324
|
-
|
|
325
|
-
> **Note:** Visit [`createNotificationInboxTool()` reference](https://mastra.ai/reference/signals/create-notification-inbox-tool) for the setup example, input schema, and action behavior.
|
|
315
|
+
Use `createNotificationInboxTool()` to give agents one tool for inbox actions instead of many CRUD tools. Use `read` after a `<notification-summary>` signal when the agent needs the full records behind the summary. The notification contents are delivered as signals, not as normal tool output. Visit [`createNotificationInboxTool()` reference](https://mastra.ai/reference/signals/create-notification-inbox-tool) for the setup example, input schema, and action behavior.
|
|
326
316
|
|
|
327
317
|
`sendNotificationSignal()` requires a storage domain with `notifications` support. Use `sendSignal({ type: 'notification' })` only for lower-level notification-shaped context that should bypass inbox storage.
|
|
328
318
|
|
|
@@ -358,15 +348,11 @@ Mastra still accepts legacy signal payloads such as `type: 'user-message'` and `
|
|
|
358
348
|
- `type: 'user-message'`: Normalizes to `type: 'user'` and `tagName: 'user'`
|
|
359
349
|
- `type: 'system-reminder'`: Normalizes to `type: 'reactive'` and `tagName: 'system-reminder'`
|
|
360
350
|
|
|
361
|
-
Existing stored signal rows and older clients continue to load through the compatibility layer. New clients call the message routes when the server supports them; React's thread signal path falls back to the legacy `/signals` route when it detects an older server.
|
|
362
|
-
|
|
363
|
-
> **Note:** Visit [Agent signals reference](https://mastra.ai/reference/agents/agent) for the full message, signal, and subscription types.
|
|
351
|
+
Existing stored signal rows and older clients continue to load through the compatibility layer. New clients call the message routes when the server supports them; React's thread signal path falls back to the legacy `/signals` route when it detects an older server. Visit [Agent signals reference](https://mastra.ai/reference/agents/agent) for the full message, signal, and subscription types.
|
|
364
352
|
|
|
365
353
|
### Approve tool calls
|
|
366
354
|
|
|
367
|
-
When a subscribed run pauses for tool approval, approve or decline the tool call with the subscription-native methods. The resumed chunks arrive through the existing thread subscription.
|
|
368
|
-
|
|
369
|
-
> **Note:** Visit [`client.getAgent().sendToolApproval()` reference](https://mastra.ai/reference/client-js/agents) and [server agent routes](https://mastra.ai/reference/server/routes) for request and response shapes.
|
|
355
|
+
When a subscribed run pauses for tool approval, approve or decline the tool call with the subscription-native methods. The resumed chunks arrive through the existing thread subscription. Visit [`client.getAgent().sendToolApproval()` reference](https://mastra.ai/reference/client-js/agents) and [server agent routes](https://mastra.ai/reference/server/routes) for request and response shapes.
|
|
370
356
|
|
|
371
357
|
### Use HTTP routes
|
|
372
358
|
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# Configuration
|
|
4
4
|
|
|
5
|
-
When you deploy to the Mastra platform, the CLI generates a `.mastra-project.json` config file and
|
|
5
|
+
When you deploy to the Mastra platform, the CLI generates a `.mastra-project.json` config file and resolves environment variables from the platform and, optionally, your local `.env` files.
|
|
6
6
|
|
|
7
|
-
This page explains both mechanisms
|
|
7
|
+
This page explains both mechanisms.
|
|
8
8
|
|
|
9
9
|
## Project config
|
|
10
10
|
|
|
11
|
-
The `.mastra-project.json` file is auto-generated on your first
|
|
11
|
+
The `.mastra-project.json` file is auto-generated on your first [`mastra deploy`](https://mastra.ai/docs/mastra-platform/deploy). It links your local project to a platform project. The [GitHub integration](https://mastra.ai/docs/mastra-platform/github) writes the same file into linked repositories.
|
|
12
12
|
|
|
13
13
|
Commit it to your version control so that subsequent deploys (including from CI) target the correct project.
|
|
14
14
|
|
|
@@ -30,19 +30,20 @@ Your file will look something like this:
|
|
|
30
30
|
|
|
31
31
|
## Environment variables
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
A local env file is optional. [`mastra deploy`](https://mastra.ai/docs/mastra-platform/deploy) resolves variables from three sources:
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
- **Managed variables**: Injected by platform resources like [hosted databases](https://mastra.ai/docs/mastra-platform/database). The platform defines these, and you can't edit them.
|
|
36
|
+
- **Stored variables**: Saved on the project or environment through the dashboard. Used as-is on every deploy with no local file needed.
|
|
37
|
+
- **Local env files**: An explicit `--env-file`, or ambient `.env` and `.env.local` files, layered on top at deploy time. Variables from `.env.local` override those in `.env`.
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
- **Server**: On the first deploy, the CLI automatically seeds environment variables from your local `.env` files. After that, manage them per-project through the dashboard or API.
|
|
39
|
-
|
|
40
|
-
To pin the deploy to a specific env file (instead of relying on the default selection), pass `--env-file`:
|
|
39
|
+
To pin the deploy to a specific env file instead of relying on the default selection, pass `--env-file`:
|
|
41
40
|
|
|
42
41
|
```bash
|
|
43
|
-
mastra
|
|
42
|
+
mastra deploy --env-file .env.production --yes
|
|
44
43
|
```
|
|
45
44
|
|
|
45
|
+
Review and sanitize local env files before deploying to avoid uploading development-only or personal secrets.
|
|
46
|
+
|
|
46
47
|
### Observability
|
|
47
48
|
|
|
48
49
|
The following environment variables configure the Observability product on the Mastra platform.
|
|
@@ -58,19 +59,11 @@ The following environment variables configure the Observability product on the M
|
|
|
58
59
|
|
|
59
60
|
## Multiple environments
|
|
60
61
|
|
|
61
|
-
A
|
|
62
|
+
A single project runs the same codebase across multiple [environments](https://mastra.ai/docs/mastra-platform/environments), such as `production` and `staging`. Each environment has its own URL, its own stored variables, and its own deploy history. One `.mastra-project.json` file covers all of them:
|
|
62
63
|
|
|
63
64
|
```bash
|
|
64
|
-
|
|
65
|
-
mastra
|
|
66
|
-
mastra studio deploy --project "my-app-production" --env-file .env.production --yes
|
|
67
|
-
|
|
68
|
-
# For subsequent deploys, restore the matching .mastra-project.json file before deploying.
|
|
69
|
-
cp .mastra-project.staging.json .mastra-project.json
|
|
70
|
-
mastra studio deploy --env-file .env.staging --yes
|
|
71
|
-
|
|
72
|
-
cp .mastra-project.production.json .mastra-project.json
|
|
73
|
-
mastra studio deploy --env-file .env.production --yes
|
|
65
|
+
mastra deploy --env production --yes
|
|
66
|
+
mastra deploy --env staging --env-file .env.staging --yes
|
|
74
67
|
```
|
|
75
68
|
|
|
76
|
-
|
|
69
|
+
> **Note:** Earlier platform versions required one project per environment. Environments replace that pattern, so keep one project and deploy to named environments instead.
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# Hosted databases
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Provision a fully managed database from the CLI or your [platform](https://mastra.ai/docs/mastra-platform/overview) project settings and attach it to your project. Mastra creates it with your provider, stores credentials securely, and injects connection details as runtime environment variables when the database is ready, so there are no connection strings to copy or configure.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mastra env db create --kind turso
|
|
9
|
+
```
|
|
6
10
|
|
|
7
11
|
## When to use hosted databases
|
|
8
12
|
|
|
@@ -14,9 +18,9 @@ Use a hosted database when your project needs durable storage that's managed by
|
|
|
14
18
|
|
|
15
19
|
## Providers
|
|
16
20
|
|
|
17
|
-
Hosted databases are available through
|
|
21
|
+
Hosted databases are available through two providers today — Turso and Postgres — with MongoDB coming soon. Pick one when you attach a database, then wire its injected variables into the matching Mastra storage adapter in your code.
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
Each provider injects a fixed set of variable names — for example, a single `DATABASE_URL` for Postgres and separate `TURSO_*` variables for Turso. Those names must be unique within each environment, which means an environment can use at most one database per provider. Attach Turso and Postgres to the same project when you need separate stores for different workloads.
|
|
20
24
|
|
|
21
25
|
For most agent-focused projects, **Turso** is the simplest starting point. It provides a lightweight, SQLite-compatible engine well suited to agent memory, conversation history, and per-tenant isolation. Choose **Postgres** when your workload needs full SQL, relational schemas, or structured application data beyond Mastra runtime state. **MongoDB** (_coming soon_) will add document storage and built-in vector search for workloads that don't map cleanly to SQL.
|
|
22
26
|
|
|
@@ -26,7 +30,47 @@ For most agent-focused projects, **Turso** is the simplest starting point. It pr
|
|
|
26
30
|
| **PostgreSQL** | Serverless Postgres | Relational workloads, structured data |
|
|
27
31
|
| **MongoDB** | Document and vector search | Document storage, vector search (_coming soon_) |
|
|
28
32
|
|
|
29
|
-
##
|
|
33
|
+
## Database scope
|
|
34
|
+
|
|
35
|
+
A database is attached at one of two scopes:
|
|
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.
|
|
39
|
+
|
|
40
|
+
The scope is set when you attach the database and shown in `mastra env db list`.
|
|
41
|
+
|
|
42
|
+
The two scopes can't overlap for the same provider. Because a project-scoped database already injects its variables into every environment, attaching an environment-scoped database of the same provider is rejected with a variable name conflict. To move from a shared database to per-environment databases, delete the project-scoped database first, then attach one database per environment. Deleting a database destroys it with the provider along with all of its data — export anything you need to keep before switching scopes. Environment-scoped databases on different environments never conflict — each deploy only receives the variables for its own environment.
|
|
43
|
+
|
|
44
|
+
## Attach with the CLI
|
|
45
|
+
|
|
46
|
+
Create and attach a database in one command. The CLI polls until it's ready, which takes a few seconds:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Shared by all environments
|
|
50
|
+
mastra env db create --kind turso
|
|
51
|
+
|
|
52
|
+
# Scoped to the staging environment
|
|
53
|
+
mastra env db create staging --kind turso
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Supported kinds are `turso` and `neon` (Postgres). Useful flags:
|
|
57
|
+
|
|
58
|
+
- `--name <name>`: Database name. Defaults to a name derived from the project slug.
|
|
59
|
+
- `--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
|
+
- `--no-wait`: Return immediately instead of polling. Check progress later with `mastra env db show`.
|
|
61
|
+
- `--json`: Machine-readable output.
|
|
62
|
+
|
|
63
|
+
Inspect and manage attached databases:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
mastra env db list
|
|
67
|
+
mastra env db show <database>
|
|
68
|
+
mastra env db delete <database>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`mastra env db list` shows each database's kind, status, scope, and injected variable names. `mastra env db show` prints connection instructions with secret values masked; pass `--show-secrets` to reveal them. `mastra env db delete` permanently deletes the database and all of its data with the provider. Creating and deleting databases requires the admin role in your organization.
|
|
72
|
+
|
|
73
|
+
## Attach from project settings
|
|
30
74
|
|
|
31
75
|
1. Open your project in the [platform](https://mastra.ai/docs/mastra-platform/overview) and go to **Project Settings**.
|
|
32
76
|
|
|
@@ -41,7 +85,7 @@ For most agent-focused projects, **Turso** is the simplest starting point. It pr
|
|
|
41
85
|
|
|
42
86
|
5. Select **Attach database**. Provisioning runs in the background. The database starts in a `provisioning` state and moves to `ready` once the provider finishes setup. Connection details are injected into your project as server runtime environment variables automatically.
|
|
43
87
|
|
|
44
|
-
|
|
88
|
+
Databases attached from project settings are project-scoped. Use the [CLI](#attach-with-the-cli) to attach an environment-scoped database.
|
|
45
89
|
|
|
46
90
|
## Connect from your code
|
|
47
91
|
|
|
@@ -149,4 +193,4 @@ Each provider injects a fixed set of managed environment variables. These are av
|
|
|
149
193
|
## Manage a database
|
|
150
194
|
|
|
151
195
|
- **View connection details**: Open a `ready` database in your project settings to see its environment variables and a copy-pasteable code snippet.
|
|
152
|
-
- **
|
|
196
|
+
- **Delete**: Removing a database from a project deletes it with the provider and clears its injected environment variables. This is irreversible, so ensure you no longer need the data.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Deploy to Mastra platform
|
|
4
|
+
|
|
5
|
+
[`mastra deploy`](https://mastra.ai/reference/cli/mastra) is the single command for shipping a Mastra application to the [Mastra platform](https://mastra.ai/docs/mastra-platform/overview). One command builds your project, validates it before anything ships, creates the platform project and environment on your first run, deploys, streams build logs, and prints your public URL once the deploy is serving traffic.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mastra deploy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> **Note:** This page covers the unified deploy flow. The earlier split commands, [`mastra server deploy`](https://mastra.ai/docs/mastra-platform/server) and [`mastra studio deploy`](https://mastra.ai/docs/mastra-platform/studio), still work but `mastra deploy` is the recommended path.
|
|
12
|
+
|
|
13
|
+
## Before you begin
|
|
14
|
+
|
|
15
|
+
You'll need a [Mastra application](https://mastra.ai/guides/getting-started/quickstart) and a [Mastra platform](https://projects.mastra.ai) account. If you're not authenticated, the CLI prompts you to log in on first use.
|
|
16
|
+
|
|
17
|
+
A local `.env` file is optional. Environment variables stored on the platform are used as-is at deploy time, and managed resources like [hosted databases](https://mastra.ai/docs/mastra-platform/database) inject their own variables. Pass `--env-file` only when you want to layer local values on top.
|
|
18
|
+
|
|
19
|
+
## Your first deploy
|
|
20
|
+
|
|
21
|
+
1. From your project directory, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
mastra deploy
|
|
25
|
+
```
|
|
26
|
+
|
|
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
|
+
|
|
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:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
[LOCAL_STORAGE_PATH] file:./mastra.db will be used at runtime because TURSO_DATABASE_URL is not set
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Attach a [hosted database](https://mastra.ai/docs/mastra-platform/database) that provides the missing variables:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
mastra env db create --kind turso
|
|
39
|
+
```
|
|
40
|
+
|
|
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.
|
|
42
|
+
|
|
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:
|
|
44
|
+
>
|
|
45
|
+
> ```ts
|
|
46
|
+
> new LibSQLStore({
|
|
47
|
+
> // Uses the hosted database when deployed, a local file during development
|
|
48
|
+
> url: process.env.TURSO_DATABASE_URL ?? 'file:./mastra.db',
|
|
49
|
+
> authToken: process.env.TURSO_AUTH_TOKEN,
|
|
50
|
+
> })
|
|
51
|
+
> ```
|
|
52
|
+
|
|
53
|
+
3. Run `mastra deploy` again. Preflight passes, the build uploads, and the CLI streams build logs until the deploy is live. Expect the full build and deploy to take between 30 seconds and a few minutes. The success message prints only when the new version is serving traffic.
|
|
54
|
+
|
|
55
|
+
4. Verify your deployment at the URL printed by the CLI. Append `/api/agents` to confirm it returns a JSON list of your agents.
|
|
56
|
+
|
|
57
|
+
> **Warning:** Set up [authentication](https://mastra.ai/docs/server/auth) before exposing your endpoints publicly.
|
|
58
|
+
|
|
59
|
+
The first deploy writes a `.mastra-project.json` file linking your directory to the platform project. Commit it so later deploys, CI runs, and [`mastra env`](https://mastra.ai/docs/mastra-platform/environments) commands target the same project without extra flags.
|
|
60
|
+
|
|
61
|
+
## Deploy to another environment
|
|
62
|
+
|
|
63
|
+
`mastra deploy` targets the `production` environment by default. Pass `--env` to target a different one. If the environment doesn't exist yet, the CLI offers to create it:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
mastra deploy --env staging
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Each environment gets its own URL, its own environment variables, and optionally its own [hosted database](https://mastra.ai/docs/mastra-platform/database). See [Environments](https://mastra.ai/docs/mastra-platform/environments) for the full model.
|
|
70
|
+
|
|
71
|
+
## Choose a region
|
|
72
|
+
|
|
73
|
+
Pass `--region` when a deploy creates a new environment to control where it runs. Use the `us` or `eu` shorthand:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
mastra deploy --env production --region eu
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The region is fixed when the environment is created. Databases attached to an environment are placed near that environment's region automatically.
|
|
80
|
+
|
|
81
|
+
## Preflight checks
|
|
82
|
+
|
|
83
|
+
Preflight validates the built output before anything ships, and only flags issues in your own code:
|
|
84
|
+
|
|
85
|
+
- **Local storage paths**: A hard block. File-backed storage (for example `file:./mastra.db`) is lost on every deploy. Preflight passes when the path is guarded by an environment variable that is set locally, stored on the platform, or provided by a managed database:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
89
|
+
|
|
90
|
+
export const storage = new LibSQLStore({
|
|
91
|
+
// Uses the hosted database when deployed, a local file during development
|
|
92
|
+
url: process.env.TURSO_DATABASE_URL ?? 'file:./mastra.db',
|
|
93
|
+
authToken: process.env.TURSO_AUTH_TOKEN,
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- **Missing environment variables**: A warning for variables your code reads but no source provides. Variables referenced only by library code are excluded.
|
|
98
|
+
|
|
99
|
+
The recommended response to a preflight block is to fix the cause, usually by attaching a hosted database or storing the variable on the platform. `--skip-preflight` exists as an escape hatch but skips the checks that prevent broken deploys.
|
|
100
|
+
|
|
101
|
+
Run the checks without deploying:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
mastra lint --preflight
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`mastra lint` only sees your local env files. Variables stored on the platform or injected by managed databases aren't visible to it, so a deploy can pass preflight where lint still reports an error.
|
|
108
|
+
|
|
109
|
+
## Environment variables
|
|
110
|
+
|
|
111
|
+
Deploys resolve environment variables from three sources:
|
|
112
|
+
|
|
113
|
+
- **Managed variables**: Injected by platform resources like hosted databases (for example `TURSO_DATABASE_URL`). The platform defines these, and you can't edit them.
|
|
114
|
+
- **Stored variables**: Saved on the project or environment through the dashboard. Used as-is on every deploy with no local file needed.
|
|
115
|
+
- **Local env files**: An explicit `--env-file`, or ambient `.env` and `.env.local` files, layered on top at deploy time.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
mastra deploy --env staging --env-file .env.staging
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
To change variables on a running service without a redeploy, update them in the dashboard and run [`mastra env restart`](https://mastra.ai/reference/cli/mastra).
|
|
122
|
+
|
|
123
|
+
## Project resolution
|
|
124
|
+
|
|
125
|
+
Every deploy resolves its target project in this order:
|
|
126
|
+
|
|
127
|
+
1. The `MASTRA_PROJECT_ID` environment variable
|
|
128
|
+
2. The `--project <name|slug|id>` flag
|
|
129
|
+
3. The `.mastra-project.json` file in the current directory
|
|
130
|
+
|
|
131
|
+
In CI, set `MASTRA_PROJECT_ID` and `MASTRA_API_TOKEN` and pass `--yes`:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
mastra deploy --env production --yes
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Related
|
|
138
|
+
|
|
139
|
+
- [Environments](https://mastra.ai/docs/mastra-platform/environments)
|
|
140
|
+
- [Hosted databases](https://mastra.ai/docs/mastra-platform/database)
|
|
141
|
+
- [`mastra deploy` CLI reference](https://mastra.ai/reference/cli/mastra)
|
|
142
|
+
- [Configuration](https://mastra.ai/docs/mastra-platform/configuration)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Environments
|
|
4
|
+
|
|
5
|
+
Every platform project contains one or more environments. An environment is an isolated deployment target with its own URL, its own environment variables, its own deploy history, and optionally its own [hosted database](https://mastra.ai/docs/mastra-platform/database). Use environments to run `production`, `staging`, and preview versions of the same codebase inside a single project.
|
|
6
|
+
|
|
7
|
+
Your first [`mastra deploy`](https://mastra.ai/docs/mastra-platform/deploy) creates the `production` environment. Create more with the CLI or by deploying to a name that doesn't exist yet.
|
|
8
|
+
|
|
9
|
+
## Create an environment
|
|
10
|
+
|
|
11
|
+
Create an environment explicitly:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
mastra env create staging
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or let a deploy create it, which prompts for confirmation:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
mastra deploy --env staging
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`mastra env create` defaults to the `staging` type. Pass `--type` to set `staging` or `preview` explicitly, and `--region` to choose where the environment runs:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
mastra env create eu-preview --type preview --region eu
|
|
27
|
+
```
|
|
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.
|
|
30
|
+
|
|
31
|
+
## List environments
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
mastra env list
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The output shows each environment's name, region, active deploy status, and the managed environment variables injected by attached databases. Pass `--json` for machine-readable output in CI.
|
|
38
|
+
|
|
39
|
+
All `mastra env` commands resolve their project from `MASTRA_PROJECT_ID`, the `--project` flag, or the `.mastra-project.json` file written by your first deploy, in that order. Run them from your project directory and you never need to name the project.
|
|
40
|
+
|
|
41
|
+
## Environment variables
|
|
42
|
+
|
|
43
|
+
An environment resolves its variables from three scopes:
|
|
44
|
+
|
|
45
|
+
- **Managed variables**: Injected by attached [hosted databases](https://mastra.ai/docs/mastra-platform/database) (for example `TURSO_DATABASE_URL`). The platform defines these, and you can't edit them.
|
|
46
|
+
- **Environment-scoped variables**: Stored on one environment through the dashboard. Use these for values that differ between environments, like API keys for staging and production services.
|
|
47
|
+
- **Project-scoped variables**: Stored on the project and shared by all environments.
|
|
48
|
+
|
|
49
|
+
Environment-scoped and project-scoped variables together are the stored variables described on the [Deploy](https://mastra.ai/docs/mastra-platform/deploy) page.
|
|
50
|
+
|
|
51
|
+
Variables are applied when a deploy starts. To apply changed variables to a running service without a full redeploy:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mastra env restart staging
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To see the full set an environment's deploys actually run with — environment-scoped and project-scoped values merged, with managed variables listed by name — pull them into a local env file:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mastra env vars pull staging --output .env.staging
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Managed variable values are injected at deploy time and never written to the file; they appear as name-only comments.
|
|
64
|
+
|
|
65
|
+
> **Note:** Environment variables don't override managed database variables. To point an environment at a different database, attach an [environment-scoped database](https://mastra.ai/docs/mastra-platform/database) instead.
|
|
66
|
+
|
|
67
|
+
## Deploy history
|
|
68
|
+
|
|
69
|
+
List deploys across all environments, or filter to one:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
mastra env deploys
|
|
73
|
+
mastra env deploys staging
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Each row shows the deploy status, environment, timestamp, and which deploy is currently active. A deploy transitions through **queued → uploading → building → deploying → running**, and the platform reports **running** only when the new version is serving traffic.
|
|
77
|
+
|
|
78
|
+
## Isolate an environment's data
|
|
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:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
mastra env db create production --kind turso --name my-project-production-db
|
|
84
|
+
mastra env db create staging --kind turso --name my-project-staging-db
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Each environment then reads and writes only its own database.
|
|
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.
|
|
90
|
+
|
|
91
|
+
## Delete an environment
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mastra env delete staging
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The CLI asks for confirmation before deleting. Deleting an environment removes its deploys and stored variables.
|
|
98
|
+
|
|
99
|
+
## Related
|
|
100
|
+
|
|
101
|
+
- [Deploy](https://mastra.ai/docs/mastra-platform/deploy)
|
|
102
|
+
- [Hosted databases](https://mastra.ai/docs/mastra-platform/database)
|
|
103
|
+
- [`mastra env` CLI reference](https://mastra.ai/reference/cli/mastra)
|
|
@@ -9,7 +9,7 @@ The GitHub integration links a Mastra platform project to a GitHub repository. W
|
|
|
9
9
|
After a repository is linked, the platform:
|
|
10
10
|
|
|
11
11
|
- Builds and deploys Studio and Server on every push to the configured branches.
|
|
12
|
-
- Provisions managed databases and the
|
|
12
|
+
- Provisions managed databases and the Gateway API key for projects created from a template.
|
|
13
13
|
- Surfaces commit, branch, and pull request context on each deploy.
|
|
14
14
|
- Reports build status back to GitHub as check runs and to the project dashboard with live status badges and inline logs.
|
|
15
15
|
|
|
@@ -59,7 +59,7 @@ Templates are the fastest way to get started. The platform creates a new reposit
|
|
|
59
59
|
|
|
60
60
|
3. Configure the template's managed database requirements. Templates can declare required databases (such as Turso or Neon) and you pick the provider and region per requirement.
|
|
61
61
|
|
|
62
|
-
4. Add any template-specific environment variables (for example, AI provider API keys). The platform seeds `MASTRA_GATEWAY_API_KEY` and `MASTRA_PLATFORM_ACCESS_TOKEN` automatically so that template code that talks to the
|
|
62
|
+
4. Add any template-specific environment variables (for example, AI provider API keys). The platform seeds `MASTRA_GATEWAY_API_KEY` and `MASTRA_PLATFORM_ACCESS_TOKEN` automatically so that template code that talks to the Gateway works on the first deploy.
|
|
63
63
|
|
|
64
64
|
5. Select **Create project**. The platform creates the repository, writes a `.mastra-project.json` config file into it, provisions the managed databases, and triggers the initial Studio and Server deploys.
|
|
65
65
|
|