@mastra/mcp-docs-server 1.1.46-alpha.3 → 1.1.46-alpha.4

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 (145) hide show
  1. package/.docs/docs/agent-builder/browser.md +1 -1
  2. package/.docs/docs/agent-builder/channels.md +1 -1
  3. package/.docs/docs/agent-builder/integrations.md +73 -0
  4. package/.docs/docs/agent-builder/overview.md +1 -0
  5. package/.docs/docs/agents/adding-voice.md +1 -1
  6. package/.docs/docs/agents/agent-approval.md +2 -2
  7. package/.docs/docs/agents/background-tasks.md +1 -1
  8. package/.docs/docs/agents/channels.md +2 -2
  9. package/.docs/docs/agents/code-mode.md +20 -56
  10. package/.docs/docs/agents/overview.md +1 -0
  11. package/.docs/docs/agents/sdk-agents.md +165 -1
  12. package/.docs/docs/agents/supervisor-agents.md +40 -2
  13. package/.docs/docs/agents/using-tools.md +59 -1
  14. package/.docs/docs/browser/agent-browser.md +1 -1
  15. package/.docs/docs/browser/browser-viewer.md +22 -15
  16. package/.docs/docs/browser/overview.md +1 -1
  17. package/.docs/docs/browser/stagehand.md +1 -1
  18. package/.docs/docs/editor/overview.md +6 -6
  19. package/.docs/docs/editor/prompts.md +3 -3
  20. package/.docs/docs/editor/tools.md +2 -2
  21. package/.docs/docs/evals/evals-with-memory.md +8 -8
  22. package/.docs/docs/mastra-platform/observability.md +1 -1
  23. package/.docs/docs/mastra-platform/server.md +1 -1
  24. package/.docs/docs/mcp/mcp-apps.md +4 -4
  25. package/.docs/docs/memory/observational-memory.md +1 -1
  26. package/.docs/docs/memory/working-memory.md +2 -2
  27. package/.docs/docs/observability/integrations/bridges/datadog.md +1 -1
  28. package/.docs/docs/observability/integrations/bridges/otel.md +1 -1
  29. package/.docs/docs/observability/integrations/exporters/laminar.md +1 -1
  30. package/.docs/docs/observability/integrations/exporters/langfuse.md +26 -1
  31. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -1
  32. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +4 -4
  33. package/.docs/docs/observability/integrations/exporters/otel.md +1 -1
  34. package/.docs/docs/observability/integrations/overview.md +1 -1
  35. package/.docs/docs/observability/logging.md +1 -1
  36. package/.docs/docs/observability/metrics/overview.md +3 -3
  37. package/.docs/docs/observability/metrics/querying.md +2 -2
  38. package/.docs/docs/observability/storage.md +2 -2
  39. package/.docs/docs/observability/tracing/overview.md +1 -1
  40. package/.docs/docs/server/auth/fga.md +15 -15
  41. package/.docs/docs/server/auth/okta.md +2 -2
  42. package/.docs/docs/server/auth/workos.md +1 -1
  43. package/.docs/docs/server/custom-api-routes.md +1 -1
  44. package/.docs/docs/server/pubsub.md +4 -4
  45. package/.docs/docs/studio/auth.md +1 -1
  46. package/.docs/docs/studio/observability.md +3 -1
  47. package/.docs/docs/workflows/scheduled-workflows.md +13 -13
  48. package/.docs/docs/workspace/filesystem.md +1 -1
  49. package/.docs/docs/workspace/lsp.md +1 -1
  50. package/.docs/docs/workspace/overview.md +35 -1
  51. package/.docs/docs/workspace/sandbox.md +4 -3
  52. package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
  53. package/.docs/guides/deployment/aws-bedrock-agentcore.md +3 -3
  54. package/.docs/guides/deployment/inngest.md +5 -5
  55. package/.docs/guides/deployment/temporal.md +3 -3
  56. package/.docs/guides/getting-started/nestjs.md +1 -1
  57. package/.docs/guides/migrations/mastra-cloud.md +3 -3
  58. package/.docs/guides/migrations/upgrade-to-v1/overview.md +1 -1
  59. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
  60. package/.docs/reference/acp/acp-agent.md +2 -2
  61. package/.docs/reference/agents/agent.md +44 -0
  62. package/.docs/reference/agents/channels.md +1 -1
  63. package/.docs/reference/agents/durable-agent.md +2 -2
  64. package/.docs/reference/agents/generate.md +2 -0
  65. package/.docs/reference/agents/generateLegacy.md +2 -0
  66. package/.docs/reference/ai-sdk/handle-chat-stream.md +1 -1
  67. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
  68. package/.docs/reference/auth/okta.md +1 -1
  69. package/.docs/reference/auth/workos.md +1 -1
  70. package/.docs/reference/browser/agent-browser.md +1 -1
  71. package/.docs/reference/browser/browser-viewer.md +11 -9
  72. package/.docs/reference/browser/stagehand-browser.md +1 -1
  73. package/.docs/reference/cli/mastra.md +3 -1
  74. package/.docs/reference/client-js/responses.md +2 -2
  75. package/.docs/reference/client-js/workflows.md +1 -1
  76. package/.docs/reference/configuration.md +1 -1
  77. package/.docs/reference/core/removeWorkspace.md +26 -0
  78. package/.docs/reference/editor/browser-provider.md +1 -1
  79. package/.docs/reference/editor/storage-browser-ref.md +3 -3
  80. package/.docs/reference/editor/storage-workspace-ref.md +1 -1
  81. package/.docs/reference/evals/rubric.md +113 -0
  82. package/.docs/reference/evals/trajectory-accuracy.md +3 -3
  83. package/.docs/reference/harness/harness-class.md +81 -62
  84. package/.docs/reference/index.md +5 -0
  85. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  86. package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
  87. package/.docs/reference/observability/tracing/bridges/datadog.md +1 -1
  88. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
  89. package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
  90. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +5 -5
  91. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
  92. package/.docs/reference/observability/tracing/exporters/otel.md +1 -1
  93. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +2 -2
  94. package/.docs/reference/processors/cost-guard-processor.md +2 -2
  95. package/.docs/reference/processors/processor-interface.md +4 -4
  96. package/.docs/reference/processors/response-cache.md +2 -2
  97. package/.docs/reference/processors/skill-search-processor.md +3 -3
  98. package/.docs/reference/processors/tool-search-processor.md +108 -4
  99. package/.docs/reference/pubsub/base.md +1 -1
  100. package/.docs/reference/pubsub/caching-pubsub.md +2 -2
  101. package/.docs/reference/pubsub/event-emitter.md +3 -3
  102. package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
  103. package/.docs/reference/pubsub/redis-streams.md +1 -1
  104. package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
  105. package/.docs/reference/server/nestjs-adapter.md +2 -2
  106. package/.docs/reference/signals/task-signal-provider.md +62 -0
  107. package/.docs/reference/storage/clickhouse.md +49 -4
  108. package/.docs/reference/storage/composite.md +33 -1
  109. package/.docs/reference/storage/convex.md +2 -2
  110. package/.docs/reference/storage/dsql.md +7 -7
  111. package/.docs/reference/storage/duckdb.md +3 -3
  112. package/.docs/reference/storage/redis.md +3 -3
  113. package/.docs/reference/storage/spanner.md +7 -7
  114. package/.docs/reference/streaming/agents/stream.md +2 -0
  115. package/.docs/reference/streaming/agents/streamLegacy.md +2 -0
  116. package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
  117. package/.docs/reference/tools/brightdata.md +3 -3
  118. package/.docs/reference/tools/create-code-mode.md +124 -0
  119. package/.docs/reference/tools/create-tool.md +1 -1
  120. package/.docs/reference/tools/mcp-client.md +5 -5
  121. package/.docs/reference/tools/mcp-server.md +45 -0
  122. package/.docs/reference/tools/perplexity.md +4 -4
  123. package/.docs/reference/tools/tavily.md +3 -3
  124. package/.docs/reference/voice/aws-nova-sonic.md +1 -1
  125. package/.docs/reference/voice/google-gemini-live.md +1 -1
  126. package/.docs/reference/voice/inworld-realtime.md +5 -5
  127. package/.docs/reference/voice/inworld.md +1 -1
  128. package/.docs/reference/voice/sarvam.md +1 -1
  129. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +7 -7
  130. package/.docs/reference/workspace/azure-blob-filesystem.md +2 -2
  131. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
  132. package/.docs/reference/workspace/google-drive-filesystem.md +7 -7
  133. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  134. package/.docs/reference/workspace/railway-sandbox.md +230 -0
  135. package/.docs/reference/workspace/vercel-microvm-sandbox.md +1 -1
  136. package/.docs/reference/workspace/vercel.md +2 -2
  137. package/.docs/reference/workspace/workspace-class.md +39 -3
  138. package/CHANGELOG.md +10 -0
  139. package/dist/chunk-GLPCVXXO.js +2075 -0
  140. package/dist/chunk-GLPCVXXO.js.map +1 -0
  141. package/dist/index.js +3 -0
  142. package/dist/index.js.map +1 -0
  143. package/dist/stdio.js +1 -2070
  144. package/dist/stdio.js.map +1 -1
  145. package/package.json +5 -5
@@ -265,7 +265,7 @@ Native-audio Gemini Live models — any model whose ID contains `native-audio`,
265
265
  - The model's spoken reply is delivered as audio plus an `output_audio_transcription` transcript and surfaced as `writing` with `role: 'assistant'`.
266
266
  - The model's internal reasoning is delivered as `modelTurn.parts.text` and surfaced as `thinking`.
267
267
 
268
- On non-native-audio models there is no `output_audio_transcription` channel, so `modelTurn.parts.text` is the spoken response itself and is emitted as `writing`; the `thinking` event does not fire.
268
+ On non-native-audio models there is no `output_audio_transcription` channel, so `modelTurn.parts.text` is the spoken response itself and is emitted as `writing`; the `thinking` event doesn't fire.
269
269
 
270
270
  Input transcription, output transcription, and barge-in detection (`realtime_input_config.activity_handling = 'START_OF_ACTIVITY_INTERRUPTS'`) are enabled automatically in the setup payload — no extra configuration is required.
271
271
 
@@ -54,7 +54,7 @@ await voice.send(microphoneStream)
54
54
  voice.close()
55
55
  ```
56
56
 
57
- > Inworld API keys ship pre-Basic-encoded. Paste them verbatim into `INWORLD_API_KEY`; the package does not re-encode them.
57
+ > Inworld API keys ship pre-Basic-encoded. Paste them verbatim into `INWORLD_API_KEY`; the package doesn't re-encode them.
58
58
 
59
59
  ## Constructor parameters
60
60
 
@@ -116,7 +116,7 @@ Use the typed `session` field for documented Inworld realtime options. Fields co
116
116
 
117
117
  ### `providerData` (Inworld extensions)
118
118
 
119
- `providerData` is a typed object for Inworld-specific realtime extensions. It is sent under `session.providerData` on every `session.update`, and composes with any `session.providerData` you set via the `session` field — the constructor `providerData` wins on key collisions.
119
+ `providerData` is a typed object for Inworld-specific realtime extensions. It's sent under `session.providerData` on every `session.update`, and composes with any `session.providerData` you set via the `session` field — the constructor `providerData` wins on key collisions.
120
120
 
121
121
  It has five branches plus two session-level fields:
122
122
 
@@ -342,12 +342,12 @@ Any voice ID from [Inworld's voice catalog](https://docs.inworld.ai/quickstart-t
342
342
 
343
343
  ## Notes
344
344
 
345
- - API keys can be provided via constructor options or the `INWORLD_API_KEY` environment variable. Keys are pre-Basic-encoded; do not re-encode them.
345
+ - API keys can be provided via constructor options or the `INWORLD_API_KEY` environment variable. Keys are pre-Basic-encoded; don't re-encode them.
346
346
  - The WebSocket URL appends `?key=<sessionId>&protocol=realtime`. The model is configured via the initial `session.update`, not the URL.
347
- - Per-call `speak(input, { speaker })` scopes the voice override to a single response (via the flat `response.voice` field) and does NOT mutate the session.
347
+ - Per-call `speak(input, { speaker })` scopes the voice override to a single response (via the flat `response.voice` field) and doesn't mutate the session.
348
348
  - Audio output defaults to PCM16 at 24 kHz. Telephony `audio/pcmu` and `audio/pcma` at 8 kHz, and `audio/float32`, are also supported via `session.audio.output.format`.
349
349
  - Use `connect()` before any send, speak, or listen call. Events sent before the WebSocket is open are queued and flushed once the server acknowledges `session.updated`.
350
350
  - The voice instance must be closed with `close()` or `disconnect()` to release the WebSocket.
351
- - `audio.input.turn_detection` defaults to semantic VAD when `session` does not supply it. Override with your own object, or pass `null` to disable turn detection entirely.
351
+ - `audio.input.turn_detection` defaults to semantic VAD when `session` doesn't supply it. Override with your own object, or pass `null` to disable turn detection entirely.
352
352
  - `audio.input.transcription` defaults to `{ model: 'inworld/inworld-stt-1' }`, so user-side `writing` events fire out of the box. Override with your own object, or pass `null` to disable user-side transcription.
353
353
  - `on()` and `off()` are typed against `InworldVoiceEventMap` — known event names yield a typed callback payload, unknown names fall back to `unknown`.
@@ -130,6 +130,6 @@ const speakers = await voice.getSpeakers()
130
130
  ## Notes
131
131
 
132
132
  - The TTS endpoint uses progressive NDJSON streaming, so audio playback can begin before the full response is received.
133
- - An API key can be provided via the `speechModel` or `listeningModel` config, or the `INWORLD_API_KEY` environment variable. TTS and STT keys are resolved independently: passing distinct `speechModel.apiKey` and `listeningModel.apiKey` values lets each service use its own credential. If only one is provided, it is reused for both services as a fallback before the env var.
133
+ - An API key can be provided via the `speechModel` or `listeningModel` config, or the `INWORLD_API_KEY` environment variable. TTS and STT keys are resolved independently: passing distinct `speechModel.apiKey` and `listeningModel.apiKey` values lets each service use its own credential. If only one is provided, it's reused for both services as a fallback before the env var.
134
134
  - `inworld-tts-2` is the default flagship model. Use `deliveryMode` (`STABLE` | `BALANCED` | `CREATIVE`) to steer delivery style on this model. The `temperature` option is ignored on `inworld-tts-2`.
135
135
  - The `inworld-tts-1.5-mini` model offers lower latency at the cost of reduced voice quality compared to `inworld-tts-1.5-max`.
@@ -127,4 +127,4 @@ Returns: `Promise<Array<{voiceId: SarvamVoiceId}>>`
127
127
  - Audio is returned as a stream containing binary audio data
128
128
  - Speech recognition supports mp3 and wav audio formats
129
129
  - `bulbul:v1`, `saarika:v1`, `saarika:v2`, and `saarika:flash` have been deprecated by Sarvam and are no longer supported. Use `bulbul:v3` (or `bulbul:v2`) for TTS and `saarika:v2.5` (or `saaras:v3`) for STT.
130
- - Speaker names are not interchangeable between `bulbul:v2` and `bulbul:v3` — each model version has its own speaker catalog.
130
+ - Speaker names aren't interchangeable between `bulbul:v2` and `bulbul:v3` — each model version has its own speaker catalog.
@@ -6,7 +6,7 @@ Use `AgentCoreRuntimeSandbox` when your agent already runs in AgentCore Runtime
6
6
 
7
7
  > **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
8
8
 
9
- > **Warning:** `AgentCoreRuntimeSandbox` only supports one-shot command execution. It does not support background process management, stdin, or filesystem mounts. AgentCore Code Interpreter is a separate AWS service and is not part of this provider.
9
+ > **Warning:** `AgentCoreRuntimeSandbox` only supports one-shot command execution. It doesn't support background process management, stdin, or filesystem mounts. AgentCore Code Interpreter is a separate AWS service and isn't part of this provider.
10
10
 
11
11
  ## Installation
12
12
 
@@ -139,7 +139,7 @@ Returns: `Promise<CommandResult>`.
139
139
 
140
140
  #### `start()`
141
141
 
142
- Runs the sandbox lifecycle start hook. This provider does not create an AgentCore Runtime session during `start()`.
142
+ Runs the sandbox lifecycle start hook. This provider doesn't create an AgentCore Runtime session during `start()`.
143
143
 
144
144
  ```typescript
145
145
  await sandbox.start()
@@ -157,7 +157,7 @@ await sandbox.stop()
157
157
 
158
158
  Explicitly stops the AgentCore Runtime session used by this sandbox.
159
159
 
160
- Use this when the sandbox owns the runtime session and you want to clean it up directly. `destroy()` does not call this method unless `stopSessionOnLifecycle` is `true`, because AgentCore Runtime sessions can be shared with agent invocations outside the Workspace sandbox lifecycle.
160
+ Use this when the sandbox owns the runtime session and you want to clean it up directly. `destroy()` doesn't call this method unless `stopSessionOnLifecycle` is `true`, because AgentCore Runtime sessions can be shared with agent invocations outside the Workspace sandbox lifecycle.
161
161
 
162
162
  ```typescript
163
163
  await sandbox.stopRuntimeSession()
@@ -188,10 +188,10 @@ Returns: `Promise<SandboxInfo>`.
188
188
  `AgentCoreRuntimeSandbox` follows AgentCore Runtime command execution semantics:
189
189
 
190
190
  - **One-shot commands**: Each command runs to completion or timeout.
191
- - **No persistent shell**: Shell state does not carry over between commands. Encode state in each command, for example `cd /workspace && npm test`.
192
- - **Background processes are not supported**: The provider does not expose a `processes` manager.
193
- - **Interactive stdin is unavailable**: Runtime command execution does not provide an interactive stdin stream through this provider.
194
- - **Workspace filesystem mounts are unsupported**: Workspace filesystem mounting is not supported by this provider.
191
+ - **No persistent shell**: Shell state doesn't carry over between commands. Encode state in each command, for example `cd /workspace && npm test`.
192
+ - **Background processes aren't supported**: The provider doesn't expose a `processes` manager.
193
+ - **Interactive stdin is unavailable**: Runtime command execution doesn't provide an interactive stdin stream through this provider.
194
+ - **Workspace filesystem mounts are unsupported**: Workspace filesystem mounting isn't supported by this provider.
195
195
  - **Container-dependent tools**: Commands can only use tools installed in the AgentCore Runtime container image.
196
196
 
197
197
  ## Related
@@ -55,7 +55,7 @@ const agent = new Agent({
55
55
 
56
56
  ### Account key
57
57
 
58
- Use an account name and account key when you do not want to pass a full connection string:
58
+ Use an account name and account key when you don't want to pass a full connection string:
59
59
 
60
60
  ```typescript
61
61
  import { AzureBlobFilesystem } from '@mastra/azure/blob'
@@ -209,7 +209,7 @@ const config = filesystem.getMountConfig()
209
209
  // { type: 'azure-blob', container: 'my-container', ... }
210
210
  ```
211
211
 
212
- > **Note:** Azure Blob sandbox mounting depends on sandbox support for `azure-blob` mount configs. Use `filesystem` for direct workspace file operations when your sandbox provider does not support Azure Blob mounts.
212
+ > **Note:** Azure Blob sandbox mounting depends on sandbox support for `azure-blob` mount configs. Use `filesystem` for direct workspace file operations when your sandbox provider doesn't support Azure Blob mounts.
213
213
 
214
214
  ## Related
215
215
 
@@ -170,10 +170,10 @@ const url = await filesystem.files.url('reports/q3.pdf')
170
170
  `FilesSDKFilesystem` treats the configured backend as an object store, even when the underlying adapter is hierarchical (such as `fs`). This keeps behavior consistent across adapters:
171
171
 
172
172
  - **`mkdir`** is a no-op. Directories exist implicitly when keys with that prefix exist.
173
- - **`exists`** returns `true` only when an exact key is present as a file, or when the path is a prefix that contains at least one child key. Empty leftover directories on hierarchical adapters do not count.
174
- - **`deleteFile`** throws `FileNotFoundError` when the key does not exist, unless `{ force: true }` is passed.
173
+ - **`exists`** returns `true` only when an exact key is present as a file, or when the path is a prefix that contains at least one child key. Empty leftover directories on hierarchical adapters don't count.
174
+ - **`deleteFile`** throws `FileNotFoundError` when the key doesn't exist, unless `{ force: true }` is passed.
175
175
  - **`deleteFile`** on a directory delegates to `rmdir({ recursive: true })`, matching the [`S3Filesystem`](https://mastra.ai/reference/workspace/s3-filesystem) and [`GCSFilesystem`](https://mastra.ai/reference/workspace/gcs-filesystem) behavior.
176
- - **`moveFile`** is implemented as `copyFile` followed by `deleteFile`. It is **not atomic** — if the source delete fails after a successful copy, the destination remains and the source is not removed.
176
+ - **`moveFile`** is implemented as `copyFile` followed by `deleteFile`. it's **not atomic** — if the source delete fails after a successful copy, the destination remains and the source isn't removed.
177
177
  - **`appendFile`** is a read-modify-write operation. Concurrent appends to the same key may overwrite each other; this is inherent to object storage and not specific to FilesSDK.
178
178
  - **`readdir({ recursive: true })`** emits intermediate directory entries (for example, `a/b` is emitted alongside `a/b/c.txt`).
179
179
 
@@ -64,7 +64,7 @@ Supply one of the following authentication options:
64
64
 
65
65
  #### Service account
66
66
 
67
- Service account auth is the recommended option for backend agents. There is no user consent flow and no token refresh handling. You only need **two values** from the service account JSON key file: `client_email` and `private_key`.
67
+ Service account auth is the recommended option for backend agents. No user consent flow and no token refresh handling is required. You only need **two values** from the service account JSON key file: `client_email` and `private_key`.
68
68
 
69
69
  ##### Set up the service account
70
70
 
@@ -76,19 +76,19 @@ Service account auth is the recommended option for backend agents. There is no u
76
76
 
77
77
  ##### Share the Drive folder with the service account
78
78
 
79
- The service account is its own Google identity. It cannot see anything in Drive until you share with it explicitly.
79
+ The service account is its own Google identity. It can't see anything in Drive until you share with it explicitly.
80
80
 
81
81
  1. Open the target folder in [Google Drive](https://drive.google.com/).
82
82
  2. Select **Share**.
83
83
  3. Paste the service account's `client_email` address.
84
84
  4. Set the role to **Editor** (for read and write) or **Viewer** (for read-only access). Select **Send**.
85
- 5. Copy the folder ID from the URL. It is the segment after `/folders/` in `https://drive.google.com/drive/folders/<folderId>`.
85
+ 5. Copy the folder ID from the URL. it's the segment after `/folders/` in `https://drive.google.com/drive/folders/<folderId>`.
86
86
 
87
- > **Warning:** Service accounts cannot create files in standard "My Drive" folders. A service account has no personal Drive storage quota, so any file it creates needs to be owned by a quota-bearing entity. If you only share a personal Drive folder, read operations work but writes fail with a quota error.
87
+ > **Warning:** Service accounts can't create files in standard "My Drive" folders. A service account has no personal Drive storage quota, so any file it creates needs to be owned by a quota-bearing entity. If you only share a personal Drive folder, read operations work but writes fail with a quota error.
88
88
  >
89
89
  > For write access, place the folder inside a **shared drive** (formerly Team Drive) and add the service account as a member of that shared drive. Shared drives provide the storage quota that service-account-created files need.
90
90
  >
91
- > Read-only workloads against a personal Drive folder do not have this restriction.
91
+ > Read-only workloads against a personal Drive folder don't have this restriction.
92
92
 
93
93
  ##### Configure the filesystem
94
94
 
@@ -113,13 +113,13 @@ const filesystem = new GoogleDriveFilesystem({
113
113
  })
114
114
  ```
115
115
 
116
- You do **not** need to copy the entire JSON file or pass other fields like `project_id`, `client_id`, `private_key_id`, or `token_uri`. They are not used. Only `clientEmail` and `privateKey` are required. `privateKeyId`, `scopes`, and `subject` are optional. `scopes` defaults to `['https://www.googleapis.com/auth/drive']`, which is the scope required for the service account to see folders shared with it. The narrower `drive.file` scope only grants access to files the application created itself, so a folder shared with the service account would return `404 Not Found`.
116
+ You **don't** need to copy the entire JSON file or pass other fields like `project_id`, `client_id`, `private_key_id`, or `token_uri`. They're not used. Only `clientEmail` and `privateKey` are required. `privateKeyId`, `scopes`, and `subject` are optional. `scopes` defaults to `['https://www.googleapis.com/auth/drive']`, which is the scope required for the service account to see folders shared with it. The narrower `drive.file` scope only grants access to files the application created itself, so a folder shared with the service account would return `404 Not Found`.
117
117
 
118
118
  `GoogleDriveFilesystem` automatically normalizes the `privateKey` string before signing. It strips surrounding quotes (including escaped quotes from JSON-wrapped values), converts literal `\n` sequences to real newlines, normalizes `\r\n` line endings, and removes a trailing comma. The key works regardless of how your `.env` loader handles the value.
119
119
 
120
120
  ##### Troubleshoot
121
121
 
122
- - **`404 File not found: <folderId>`**: The service account does not have access to the folder. Confirm the folder is shared with the exact `client_email` address and that the folder ID matches the URL.
122
+ - **`404 File not found: <folderId>`**: The service account doesn't have access to the folder. Confirm the folder is shared with the exact `client_email` address and that the folder ID matches the URL.
123
123
  - **`storageQuotaExceeded` on write**: The folder is in a personal "My Drive". Move the folder to a shared drive and add the service account as a member.
124
124
  - **`error:1E08010C:DECODER routines::unsupported`**: The `privateKey` value is malformed. Confirm the value contains the full PEM block and that newlines are preserved (literal `\n` is fine).
125
125
 
@@ -155,7 +155,7 @@ console.log(result.exitCode)
155
155
  await handle.kill()
156
156
  ```
157
157
 
158
- > **Note:** `sendStdin()` is not supported — the Modal JS SDK does not expose stdin on `Sandbox.exec()`.
158
+ > **Note:** `sendStdin()` isn't supported — the Modal JS SDK doesn't expose stdin on `Sandbox.exec()`.
159
159
 
160
160
  See [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager) for the full API.
161
161
 
@@ -0,0 +1,230 @@
1
+ # RailwaySandbox
2
+
3
+ Executes commands in ephemeral, isolated [Railway](https://docs.railway.com/sandboxes) sandboxes. Each sandbox is an isolated Debian Linux VM provisioned on demand through the Railway TypeScript SDK. Supports command execution with streaming output, command timeouts, configurable idle timeout, `ISOLATED`/`PRIVATE` network isolation, custom base images via the Railway template builder, forking a running sandbox, and reattaching to an existing sandbox by ID.
4
+
5
+ > **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
6
+
7
+ ## Installation
8
+
9
+ **npm**:
10
+
11
+ ```bash
12
+ npm install @mastra/railway
13
+ ```
14
+
15
+ **pnpm**:
16
+
17
+ ```bash
18
+ pnpm add @mastra/railway
19
+ ```
20
+
21
+ **Yarn**:
22
+
23
+ ```bash
24
+ yarn add @mastra/railway
25
+ ```
26
+
27
+ **Bun**:
28
+
29
+ ```bash
30
+ bun add @mastra/railway
31
+ ```
32
+
33
+ Set your Railway credentials in one of three ways.
34
+
35
+ **Shell export**:
36
+
37
+ ```bash
38
+ export RAILWAY_API_TOKEN=your-api-token
39
+ export RAILWAY_ENVIRONMENT_ID=your-environment-id
40
+ ```
41
+
42
+ **.env file**:
43
+
44
+ ```bash
45
+ RAILWAY_API_TOKEN=your-api-token
46
+ RAILWAY_ENVIRONMENT_ID=your-environment-id
47
+ ```
48
+
49
+ **Constructor**:
50
+
51
+ ```typescript
52
+ new RailwaySandbox({
53
+ token: 'your-api-token',
54
+ environmentId: 'your-environment-id',
55
+ })
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ Add a `RailwaySandbox` to a workspace and assign it to an agent:
61
+
62
+ ```typescript
63
+ import { Agent } from '@mastra/core/agent'
64
+ import { Workspace } from '@mastra/core/workspace'
65
+ import { RailwaySandbox } from '@mastra/railway'
66
+
67
+ const workspace = new Workspace({
68
+ sandbox: new RailwaySandbox({
69
+ // token + environmentId read from RAILWAY_API_TOKEN / RAILWAY_ENVIRONMENT_ID
70
+ idleTimeoutMinutes: 30,
71
+ }),
72
+ })
73
+
74
+ const agent = new Agent({
75
+ id: 'code-agent',
76
+ name: 'Code Agent',
77
+ instructions: 'You are a coding assistant working in this workspace.',
78
+ model: 'anthropic/claude-sonnet-4-6',
79
+ workspace,
80
+ })
81
+
82
+ const response = await agent.generate(
83
+ 'Print "Hello, world!" and show the current working directory.',
84
+ )
85
+
86
+ console.log(response.text)
87
+ ```
88
+
89
+ ### Private networking
90
+
91
+ Join the environment's private network to reach other Railway services (for example `postgres.railway.internal`):
92
+
93
+ ```typescript
94
+ const workspace = new Workspace({
95
+ sandbox: new RailwaySandbox({
96
+ networkIsolation: 'PRIVATE',
97
+ env: { NODE_ENV: 'production' },
98
+ }),
99
+ })
100
+ ```
101
+
102
+ The default `ISOLATED` mode allows outbound internet access only, with no private network connectivity.
103
+
104
+ ### Custom base image (templates)
105
+
106
+ Pre-install packages and run setup steps so every sandbox starts ready. Pass a builder callback over the Railway template builder — the template is built once on the first `start()`:
107
+
108
+ ```typescript
109
+ const workspace = new Workspace({
110
+ sandbox: new RailwaySandbox({
111
+ template: t => t.withPackages('git', 'curl').run('npm i -g pnpm').workdir('/app'),
112
+ }),
113
+ })
114
+ ```
115
+
116
+ You can also pass a pre-built `SandboxTemplate` to reuse it across sandboxes without rebuilding. Templates are ignored when `sandboxId` is set, since reattaching uses the existing sandbox's filesystem.
117
+
118
+ ### Forking a running sandbox
119
+
120
+ Clone a running sandbox's filesystem into a new, independent sandbox — a fresh boot, not live processes. The returned `RailwaySandbox` is already started:
121
+
122
+ ```typescript
123
+ const child = await sandbox.fork({ idleTimeoutMinutes: 15 })
124
+
125
+ const result = await child.executeCommand('cat', ['/app/state.json'])
126
+ console.log(result.stdout)
127
+ ```
128
+
129
+ The forked sandbox inherits the parent's credentials and defaults unless overridden via the `fork()` options.
130
+
131
+ ### Streaming output
132
+
133
+ Stream command output in real time via `onStdout` and `onStderr` callbacks:
134
+
135
+ ```typescript
136
+ await sandbox.executeCommand('bash', ['-c', 'for i in 1 2 3; do echo "line $i"; sleep 1; done'], {
137
+ onStdout: chunk => process.stdout.write(chunk),
138
+ onStderr: chunk => process.stderr.write(chunk),
139
+ })
140
+ ```
141
+
142
+ Both callbacks are optional and can be used independently.
143
+
144
+ ### Reattaching to an existing sandbox
145
+
146
+ A Railway sandbox outlives the process that created it. Reconnect by its Railway ID instead of provisioning a new one:
147
+
148
+ ```typescript
149
+ const sandbox = new RailwaySandbox({ sandboxId: 'existing-railway-sandbox-id' })
150
+ await sandbox._start()
151
+
152
+ const result = await sandbox.executeCommand('cat', ['/tmp/state.txt'])
153
+ ```
154
+
155
+ ## Constructor parameters
156
+
157
+ **id** (`string`): Unique identifier for this sandbox instance. (Default: `Auto-generated`)
158
+
159
+ **token** (`string`): Railway API token for authentication. Falls back to the RAILWAY\_API\_TOKEN environment variable.
160
+
161
+ **environmentId** (`string`): Railway environment ID. Falls back to the RAILWAY\_ENVIRONMENT\_ID environment variable.
162
+
163
+ **sandboxId** (`string`): Reattach to an existing Railway sandbox by its Railway ID instead of creating a new one. When set, start() calls Sandbox.connect().
164
+
165
+ **idleTimeoutMinutes** (`number`): How long the sandbox can sit idle (no exec interaction) before Railway destroys it automatically. The valid range and default depend on your Railway plan.
166
+
167
+ **networkIsolation** (`'ISOLATED' | 'PRIVATE'`): Network access mode. 'ISOLATED' allows outbound internet only; 'PRIVATE' joins the environment's private network. (Default: `'ISOLATED'`)
168
+
169
+ **env** (`Record<string, string>`): Environment variables baked into the sandbox, available to every command. (Default: `{}`)
170
+
171
+ **template** (`SandboxTemplate | (base: SandboxTemplate) => SandboxTemplate`): Provision the sandbox from a custom base image built with the Railway template builder. Accepts a builder callback or a pre-built template. Ignored when sandboxId is set.
172
+
173
+ **timeout** (`number`): Default execution timeout in milliseconds applied to commands that do not specify their own timeout. Commands run until they exit when omitted.
174
+
175
+ **instructions** (`string | (opts) => string`): Override the default agent instructions. A string replaces them entirely; a function receives the default instructions and returns the final text.
176
+
177
+ ## Properties
178
+
179
+ **id** (`string`): Sandbox instance identifier.
180
+
181
+ **name** (`string`): Provider name ('RailwaySandbox').
182
+
183
+ **provider** (`string`): Provider identifier ('railway').
184
+
185
+ **status** (`ProviderStatus`): 'pending' | 'initializing' | 'ready' | 'stopped' | 'destroyed' | 'error'
186
+
187
+ **railway** (`Sandbox`): The underlying Railway Sandbox instance for direct SDK access. Throws SandboxNotReadyError if the sandbox has not been started.
188
+
189
+ **processes** (`RailwayProcessManager`): Background process manager. See \[SandboxProcessManager reference]\(/reference/workspace/process-manager).
190
+
191
+ ## Methods
192
+
193
+ **fork** (`(options?) => Promise<RailwaySandbox>`): Clone this running sandbox into a new, independent RailwaySandbox. The returned sandbox is already started and reattached to the forked Railway sandbox. Accepts optional id, idleTimeoutMinutes, networkIsolation, and env overrides. Throws SandboxNotReadyError if this sandbox has not been started.
194
+
195
+ ## Background processes
196
+
197
+ `RailwaySandbox` includes a built-in process manager for spawning and managing background processes. Each spawned process runs as a Railway `exec` session.
198
+
199
+ ```typescript
200
+ const sandbox = new RailwaySandbox()
201
+ await sandbox.start()
202
+
203
+ // Spawn a background process
204
+ const handle = await sandbox.processes.spawn('node server.js', {
205
+ env: { PORT: '3000' },
206
+ onStdout: data => console.log(data),
207
+ })
208
+
209
+ // Interact with the process
210
+ console.log(handle.stdout)
211
+ await handle.kill()
212
+ ```
213
+
214
+ Railway's `exec` API does not stream stdin, so `sendStdin()` is not supported.
215
+
216
+ See [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager) for the full API.
217
+
218
+ ## Editor provider
219
+
220
+ Register the provider with `MastraEditor` to hydrate stored sandbox configs into runtime instances:
221
+
222
+ ```typescript
223
+ import { railwaySandboxProvider } from '@mastra/railway'
224
+
225
+ const editor = new MastraEditor({
226
+ sandboxes: { [railwaySandboxProvider.id]: railwaySandboxProvider },
227
+ })
228
+ ```
229
+
230
+ See the [Sandbox provider reference](https://mastra.ai/reference/editor/sandbox-provider) for details on registering custom sandbox providers.
@@ -187,7 +187,7 @@ await handle.kill()
187
187
 
188
188
  See the [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager) for the full API.
189
189
 
190
- > **Note:** The Vercel Sandbox SDK does not expose a stdin channel for running commands, so `handle.sendStdin()` throws. Filesystem mounting (FUSE) is also not supported by this provider.
190
+ > **Note:** The Vercel Sandbox SDK doesn't expose a stdin channel for running commands, so `handle.sendStdin()` throws. Filesystem mounting (FUSE) is also not supported by this provider.
191
191
 
192
192
  ## Limits
193
193
 
@@ -4,7 +4,7 @@ Executes commands as [Vercel](https://vercel.com) serverless functions. Provides
4
4
 
5
5
  > **Info:** For interface details, see [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox).
6
6
 
7
- > **Warning:** VercelSandbox is stateless. There is no persistent filesystem, no interactive shell, and no support for long-running or background processes. Only `/tmp` is writable and is ephemeral between invocations.
7
+ > **Warning:** VercelSandbox is stateless. No persistent filesystem, no interactive shell, and no support for long-running or background processes exist. Only `/tmp` is writable and is ephemeral between invocations.
8
8
 
9
9
  > **Note:** For a full Linux MicroVM with a persistent filesystem, `sudo` access, exposed ports, and background processes, use [`VercelMicroVMSandbox`](https://mastra.ai/reference/workspace/vercel-microvm-sandbox), which is backed by the [Vercel Sandbox](https://vercel.com/docs/vercel-sandbox) product.
10
10
 
@@ -110,7 +110,7 @@ VercelSandbox uses serverless functions under the hood, which means:
110
110
  - **No persistent filesystem**: Files written to `/tmp` are ephemeral and cleared between invocations.
111
111
  - **No interactive shell**: Commands run via `/bin/sh -c` with no stdin streaming.
112
112
  - **No background processes**: No process manager, PIDs, or long-running tasks.
113
- - **No mounting**: Cloud storage mounting (S3, GCS) is not supported.
113
+ - **No mounting**: Cloud storage mounting (S3, GCS) isn't supported.
114
114
  - **Timeout limits**: Maximum execution time is bounded by `maxDuration` (default 60s).
115
115
 
116
116
  ## Related
@@ -65,6 +65,8 @@ const workspace = new Workspace({
65
65
 
66
66
  **tools.maxOutputTokens** (`number`): Maximum tokens for tool output. Output exceeding this limit is truncated using tiktoken.
67
67
 
68
+ **tools.hooks** (`WorkspaceToolHooks`): Hooks that run before and after every enabled workspace tool call. See Tool hooks below.
69
+
68
70
  **operationTimeout** (`number`): Timeout for operations in milliseconds
69
71
 
70
72
  ## Tool configuration
@@ -118,6 +120,34 @@ const workspace = new Workspace({
118
120
 
119
121
  Tool names must be unique across all workspace tools. Setting a custom name that conflicts with another tool's default or custom name throws an error.
120
122
 
123
+ ### Tool hooks
124
+
125
+ Set `tools.hooks` to run logic before and after every enabled workspace tool call. Hooks run after name remapping, so the context includes both the exposed `toolName` and the original `workspaceToolName`.
126
+
127
+ ```typescript
128
+ import { Workspace } from '@mastra/core/workspace'
129
+
130
+ const workspace = new Workspace({
131
+ id: 'my-workspace',
132
+ tools: {
133
+ hooks: {
134
+ beforeToolCall: ({ toolName, workspaceToolName, input }) => {
135
+ console.log(`Running ${toolName} (${workspaceToolName})`, input)
136
+ },
137
+ afterToolCall: ({ toolName, output, error }) => {
138
+ console.log(`Finished ${toolName}`, { output, error })
139
+ },
140
+ },
141
+ },
142
+ })
143
+ ```
144
+
145
+ **beforeToolCall** (`(context: WorkspaceToolHookContext) => void | WorkspaceToolBeforeHookResult | Promise<void | WorkspaceToolBeforeHookResult>`): Runs before a workspace tool executes. Receives \`{ toolName, workspaceToolName, input, context }\`. Return \`{ proceed: false, output }\` to skip the tool call and use \`output\` as its result.
146
+
147
+ **afterToolCall** (`(context: WorkspaceToolAfterHookContext) => void | Promise<void>`): Runs after a workspace tool executes. Receives \`{ toolName, workspaceToolName, input, context, output, error }\`. \`output\` is undefined when the tool throws, and \`error\` is set instead.
148
+
149
+ If the owning agent also defines [tool hooks](https://mastra.ai/reference/agents/agent), workspace hooks run inside the agent hook wrapper: agent `beforeToolCall` runs first, then workspace `beforeToolCall`, then the tool, then workspace `afterToolCall`, then agent `afterToolCall`.
150
+
121
151
  ## Properties
122
152
 
123
153
  **id** (`string`): Workspace identifier
@@ -170,6 +200,12 @@ Destroy the workspace and clean up resources.
170
200
  await workspace.destroy()
171
201
  ```
172
202
 
203
+ `destroy()` closes workspace-owned resources in order: language servers, browsers, sandbox providers, and filesystem providers. It also clears cached sandbox references.
204
+
205
+ Call `destroy()` when your application is done with a workspace. `mastra.shutdown()` calls it for registered workspaces during shutdown. To remove a workspace from the Mastra registry, use [`mastra.removeWorkspace()`](https://mastra.ai/reference/core/removeWorkspace).
206
+
207
+ `LocalFilesystem.destroy()` doesn't delete files on disk. Resolver-backed filesystem and sandbox providers are owned by your application and must be cleaned up by your application.
208
+
173
209
  ### Search operations
174
210
 
175
211
  #### `index(path, content, options?)`
@@ -349,9 +385,9 @@ const sandbox = await workspace.resolveSandbox({ requestContext: ctx })
349
385
 
350
386
  Clear resolver-backed sandboxes cached by `sandboxCacheKey`. Pass a cache key to clear one entry, or omit it to clear all keyed sandbox entries.
351
387
 
352
- This method does not clear the per-`RequestContext` weak cache. Those entries are garbage-collection managed.
388
+ This method doesn't clear the per-`RequestContext` weak cache. Those entries are garbage-collection managed.
353
389
 
354
- The workspace does not own resolver-returned sandboxes. This method only drops workspace references. Destroy the sandbox in your own lifecycle code.
390
+ The workspace doesn't own resolver-returned sandboxes. This method only drops workspace references. Destroy the sandbox in your own lifecycle code.
355
391
 
356
392
  ```typescript
357
393
  workspace.clearSandboxCache('thread-123')
@@ -415,7 +451,7 @@ Added when a sandbox is configured:
415
451
  | `mastra_workspace_get_process_output` | Get stdout, stderr, and status of a background process by PID. Accepts `tail` to limit output lines and `wait: true` to block until exit. Only available when the sandbox has a process manager. |
416
452
  | `mastra_workspace_kill_process` | Kill a background process by PID. Returns the last 50 lines of output. Only available when the sandbox has a process manager. |
417
453
 
418
- With a static sandbox, capability checks (`executeCommand`, `processes`) decide which tool variants are exposed. With a [dynamic sandbox](https://mastra.ai/docs/workspace/sandbox), all sandbox tools are registered and the runtime throws a clear error if the resolved sandbox does not implement a requested capability.
454
+ With a static sandbox, capability checks (`executeCommand`, `processes`) decide which tool variants are exposed. With a [dynamic sandbox](https://mastra.ai/docs/workspace/sandbox), all sandbox tools are registered and the runtime throws a clear error if the resolved sandbox doesn't implement a requested capability.
419
455
 
420
456
  The `execute_command` tool accepts a `backgroundProcesses` option for lifecycle callbacks on background processes:
421
457
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.1.46-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed the MCP docs server package root export so importing @mastra/mcp-docs-server loads a published runtime file. Fixes #17700. ([#17709](https://github.com/mastra-ai/mastra/pull/17709))
8
+
9
+ - Updated dependencies [[`575f815`](https://github.com/mastra-ai/mastra/commit/575f815c5c3567b71c0b83cbb7fa98c8253a9d9c), [`306909a`](https://github.com/mastra-ai/mastra/commit/306909a693de77d709b38706e2673c9547d24a28), [`5191af8`](https://github.com/mastra-ai/mastra/commit/5191af80c799eea25357c545fc05d91b3883531d), [`43bd3d4`](https://github.com/mastra-ai/mastra/commit/43bd3d421987463fdf35386a45199c49499ed069), [`e6fa79e`](https://github.com/mastra-ai/mastra/commit/e6fa79ec72a2ddffdd25e85270398951e9d552a4), [`904bcdf`](https://github.com/mastra-ai/mastra/commit/904bcdf7b8004aa7be823f9f70ca63580e47e470), [`7f5ee1d`](https://github.com/mastra-ai/mastra/commit/7f5ee1dca46daee8d2817f2ebe49e6335da81956), [`1e9aab5`](https://github.com/mastra-ai/mastra/commit/1e9aab50ff11e6e88fde4d7cbf512c44a9fe8d61), [`bf8eb6d`](https://github.com/mastra-ai/mastra/commit/bf8eb6d0ec213a403eb9265a594ad283c44ab3dc), [`493a328`](https://github.com/mastra-ai/mastra/commit/493a328f4346a1deeb9f1e2e44c8f2a3a4d7591b), [`029a414`](https://github.com/mastra-ai/mastra/commit/029a4141719793bd3e898a39eb5a0466a55f5f3a), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`d371ac1`](https://github.com/mastra-ai/mastra/commit/d371ac1d9820afaaf7cfdbc380a475946a994d8f), [`cf182b7`](https://github.com/mastra-ai/mastra/commit/cf182b7fb495767946d9840ef29f19cfa906f31f), [`a049c2a`](https://github.com/mastra-ai/mastra/commit/a049c2a9dfb41d0ee2e7a28874a88cd64fd5669f), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`2a96528`](https://github.com/mastra-ai/mastra/commit/2a9652848dfa3c5a2426f952e9d93554c26fd90f), [`2656d9c`](https://github.com/mastra-ai/mastra/commit/2656d9c2976d4f3354253bfbbbf9b88a1b2bbf34), [`63e3fe1`](https://github.com/mastra-ai/mastra/commit/63e3fe13cc1ea96f91d7c68aea92f400faf9e4da), [`1d4ce8d`](https://github.com/mastra-ai/mastra/commit/1d4ce8daaa54511f325c1b609d31b8e54009d677), [`8c68372`](https://github.com/mastra-ai/mastra/commit/8c68372e85fe0b066ec12c58bd29ffb93e54c552)]:
10
+ - @mastra/core@1.42.0-alpha.4
11
+ - @mastra/mcp@1.10.0-alpha.1
12
+
3
13
  ## 1.1.46-alpha.3
4
14
 
5
15
  ### Patch Changes