@mastra/mcp-docs-server 1.1.26-alpha.2 → 1.1.26-alpha.22
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/agents/supervisor-agents.md +18 -0
- package/.docs/docs/editor/overview.md +69 -0
- package/.docs/docs/mastra-platform/overview.md +3 -1
- package/.docs/docs/memory/observational-memory.md +27 -7
- package/.docs/docs/observability/tracing/exporters/cloud.md +34 -41
- package/.docs/docs/observability/tracing/exporters/langfuse.md +31 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +19 -6
- package/.docs/guides/deployment/netlify.md +16 -1
- package/.docs/guides/getting-started/next-js.md +0 -4
- package/.docs/guides/migrations/mastra-cloud.md +128 -3
- package/.docs/models/gateways/netlify.md +2 -2
- package/.docs/models/gateways/openrouter.md +3 -1
- package/.docs/models/gateways/vercel.md +4 -1
- package/.docs/models/index.md +36 -1
- package/.docs/models/providers/302ai.md +32 -1
- package/.docs/models/providers/alibaba-cn.md +2 -1
- package/.docs/models/providers/anthropic.md +2 -1
- package/.docs/models/providers/berget.md +9 -12
- package/.docs/models/providers/cloudflare-workers-ai.md +2 -1
- package/.docs/models/providers/cortecs.md +4 -1
- package/.docs/models/providers/digitalocean.md +116 -0
- package/.docs/models/providers/firmware.md +2 -3
- package/.docs/models/providers/helicone.md +1 -2
- package/.docs/models/providers/hpc-ai.md +73 -0
- package/.docs/models/providers/huggingface.md +2 -1
- package/.docs/models/providers/kimi-for-coding.md +2 -1
- package/.docs/models/providers/llmgateway.md +59 -77
- package/.docs/models/providers/moonshotai.md +3 -2
- package/.docs/models/providers/nvidia.md +3 -2
- package/.docs/models/providers/ollama-cloud.md +2 -1
- package/.docs/models/providers/openai.md +1 -2
- package/.docs/models/providers/opencode-go.md +2 -1
- package/.docs/models/providers/opencode.md +4 -1
- package/.docs/models/providers/ovhcloud.md +4 -7
- package/.docs/models/providers/poe.md +2 -1
- package/.docs/models/providers/tencent-token-plan.md +71 -0
- package/.docs/models/providers/tencent-tokenhub.md +71 -0
- package/.docs/models/providers/wafer.ai.md +72 -0
- package/.docs/models/providers/zenmux.md +2 -1
- package/.docs/models/providers.md +5 -0
- package/.docs/reference/agents/generate.md +8 -0
- package/.docs/reference/client-js/mastra-client.md +23 -0
- package/.docs/reference/client-js/workflows.md +12 -0
- package/.docs/reference/core/mastra-class.md +9 -1
- package/.docs/reference/deployer/cloudflare.md +14 -1
- package/.docs/reference/deployer/netlify.md +50 -2
- package/.docs/reference/harness/harness-class.md +72 -49
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/memory/observational-memory.md +2 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +4 -2
- package/.docs/reference/observability/tracing/exporters/langfuse.md +2 -0
- package/.docs/reference/processors/prefill-error-handler.md +5 -5
- package/.docs/reference/storage/cloudflare-d1.md +42 -42
- package/.docs/reference/streaming/agents/stream.md +8 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
- package/.docs/reference/workflows/run-methods/resume.md +24 -0
- package/.docs/reference/workflows/workflow-methods/foreach.md +14 -1
- package/.docs/reference/workspace/docker-sandbox.md +196 -0
- package/CHANGELOG.md +72 -0
- package/package.json +9 -9
|
@@ -34,59 +34,59 @@ bun add @mastra/cloudflare-d1@latest
|
|
|
34
34
|
|
|
35
35
|
## Usage
|
|
36
36
|
|
|
37
|
-
### Using with
|
|
37
|
+
### Using with Mastra CloudflareDeployer
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
The standard way to use D1Store with Mastra on Cloudflare is with `CloudflareDeployer`. Import `env` from `cloudflare:workers` and initialize `D1Store` inline inside `new Mastra({...})`.
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
+
import { env } from 'cloudflare:workers'
|
|
42
43
|
import { D1Store } from '@mastra/cloudflare-d1'
|
|
43
44
|
import { Mastra } from '@mastra/core'
|
|
44
45
|
import { CloudflareDeployer } from '@mastra/deployer-cloudflare'
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
export const mastra = new Mastra({
|
|
48
|
+
storage: new D1Store({ binding: env.DB }),
|
|
49
|
+
deployer: new CloudflareDeployer({
|
|
50
|
+
name: 'my-worker',
|
|
51
|
+
d1_databases: [
|
|
52
|
+
{
|
|
53
|
+
binding: 'DB',
|
|
54
|
+
database_name: 'your-database-name',
|
|
55
|
+
database_id: 'your-database-id',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
}),
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> **Note:** When using `import { env } from 'cloudflare:workers'`, `D1Store` must be initialized inline inside `new Mastra({...})` — not extracted to a module-level variable. Alternatively, initialize `D1Store` inside the `fetch` handler after `env` is available. See [CloudflareDeployer reference](https://mastra.ai/reference/deployer/cloudflare) for details.
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
name: 'my-worker',
|
|
61
|
-
d1_databases: [
|
|
62
|
-
{
|
|
63
|
-
binding: 'D1Database', // Must match the property name in Env type
|
|
64
|
-
database_name: 'your-database-name',
|
|
65
|
-
database_id: 'your-database-id',
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
}),
|
|
69
|
-
})
|
|
64
|
+
### Using in a Cloudflare Worker without HTTP routes
|
|
65
|
+
|
|
66
|
+
If you want to call Mastra directly in a Worker — for example, to run an agent or trigger a workflow — without serving HTTP routes, you don't need `CloudflareDeployer`. Access the D1 binding from the worker's `env` parameter and call Mastra programmatically.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { D1Store } from '@mastra/cloudflare-d1'
|
|
70
|
+
import { Mastra } from '@mastra/core'
|
|
71
|
+
|
|
72
|
+
type Env = {
|
|
73
|
+
DB: D1Database
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
// Cloudflare Worker export
|
|
73
76
|
export default {
|
|
74
77
|
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
|
|
75
|
-
const mastra =
|
|
78
|
+
const mastra = new Mastra({
|
|
79
|
+
storage: new D1Store({ binding: env.DB }),
|
|
80
|
+
})
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
const agent = mastra.getAgent('my-agent')
|
|
83
|
+
const result = await agent.generate('Hello')
|
|
84
|
+
|
|
85
|
+
return Response.json({ text: result.text })
|
|
79
86
|
},
|
|
80
87
|
}
|
|
81
88
|
```
|
|
82
89
|
|
|
83
|
-
> **Important: Understanding D1 Bindings:** In the `Env` type definition, `D1Database: D1Database` serves two purposes:
|
|
84
|
-
>
|
|
85
|
-
> - The **property name** (`D1Database`) must match the `binding` name in your `wrangler.toml`
|
|
86
|
-
> - The **type** (`: D1Database`) is from `@cloudflare/workers-types` for TypeScript type checking
|
|
87
|
-
>
|
|
88
|
-
> At runtime, Cloudflare Workers provides the actual D1 database instance via `env.D1Database`. You can't use `D1Database` directly outside of the worker's context.
|
|
89
|
-
|
|
90
90
|
### Using with REST API
|
|
91
91
|
|
|
92
92
|
For non-Workers environments (Node.js, serverless functions, etc.), use the REST API approach:
|
|
@@ -108,7 +108,7 @@ Add the D1 database binding to your `wrangler.toml`:
|
|
|
108
108
|
|
|
109
109
|
```toml
|
|
110
110
|
[[d1_databases]]
|
|
111
|
-
binding = "
|
|
111
|
+
binding = "DB"
|
|
112
112
|
database_name = "your-database-name"
|
|
113
113
|
database_id = "your-database-id"
|
|
114
114
|
```
|
|
@@ -119,7 +119,7 @@ Or in `wrangler.jsonc`:
|
|
|
119
119
|
{
|
|
120
120
|
"d1_databases": [
|
|
121
121
|
{
|
|
122
|
-
"binding": "
|
|
122
|
+
"binding": "DB",
|
|
123
123
|
"database_name": "your-database-name",
|
|
124
124
|
"database_id": "your-database-id",
|
|
125
125
|
},
|
|
@@ -158,14 +158,14 @@ import { Mastra } from '@mastra/core'
|
|
|
158
158
|
import { D1Store } from '@mastra/cloudflare-d1'
|
|
159
159
|
|
|
160
160
|
type Env = {
|
|
161
|
-
|
|
161
|
+
DB: D1Database
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// In a Cloudflare Worker
|
|
165
165
|
export default {
|
|
166
166
|
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
|
|
167
167
|
const storage = new D1Store({
|
|
168
|
-
binding: env.
|
|
168
|
+
binding: env.DB,
|
|
169
169
|
})
|
|
170
170
|
|
|
171
171
|
const mastra = new Mastra({
|
|
@@ -184,7 +184,7 @@ If you're using storage directly without Mastra, you must call `init()` explicit
|
|
|
184
184
|
import { D1Store } from '@mastra/cloudflare-d1'
|
|
185
185
|
|
|
186
186
|
type Env = {
|
|
187
|
-
|
|
187
|
+
DB: D1Database
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// In a Cloudflare Worker
|
|
@@ -192,7 +192,7 @@ export default {
|
|
|
192
192
|
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
|
|
193
193
|
const storage = new D1Store({
|
|
194
194
|
id: 'd1-storage',
|
|
195
|
-
binding: env.
|
|
195
|
+
binding: env.DB,
|
|
196
196
|
})
|
|
197
197
|
|
|
198
198
|
// Required when using storage directly
|
|
@@ -206,6 +206,14 @@ const stream = await agent.stream('message for agent')
|
|
|
206
206
|
|
|
207
207
|
**options.tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
208
208
|
|
|
209
|
+
**options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See \[Sub-agent versioning]\(/docs/editor/overview#sub-agent-versioning).
|
|
210
|
+
|
|
211
|
+
**options.versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors.
|
|
212
|
+
|
|
213
|
+
**options.versions.agents.versionId** (`string`): Target a specific version by ID.
|
|
214
|
+
|
|
215
|
+
**options.versions.agents.status** (`'draft' | 'published'`): Target the latest version with this publication status.
|
|
216
|
+
|
|
209
217
|
## Returns
|
|
210
218
|
|
|
211
219
|
**stream** (`MastraModelOutput<Output>`): Returns a MastraModelOutput instance that provides access to the streaming output.
|
|
@@ -32,6 +32,8 @@ if (result!.status === 'suspended') {
|
|
|
32
32
|
|
|
33
33
|
**step** (`Step<string, any, any, any, any, TEngineType>`): The step to resume execution from
|
|
34
34
|
|
|
35
|
+
**forEachIndex** (`number`): Target a specific iteration of a suspended \`.foreach()\` step. Pass the zero-based index of the iteration to resume; other iterations remain suspended. Omit to resume all suspended iterations of the step with the same \`resumeData\`.
|
|
36
|
+
|
|
35
37
|
**tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
36
38
|
|
|
37
39
|
**tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
@@ -26,6 +26,8 @@ if (result.status === 'suspended') {
|
|
|
26
26
|
|
|
27
27
|
**retryCount** (`number`): Optional retry count for nested workflow execution
|
|
28
28
|
|
|
29
|
+
**forEachIndex** (`number`): Target a specific iteration of a suspended \`.foreach()\` step. Pass the zero-based index of the iteration you want to resume; other iterations remain suspended. Omit this field to resume all suspended iterations of the step with the same \`resumeData\`.
|
|
30
|
+
|
|
29
31
|
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
30
32
|
|
|
31
33
|
**tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
@@ -67,6 +69,28 @@ if (result.status === 'suspended') {
|
|
|
67
69
|
|
|
68
70
|
> **Note:** When exactly one step is suspended, you can omit the `step` parameter and the workflow will automatically resume that step. For workflows with multiple suspended steps, you must explicitly specify which step to resume.
|
|
69
71
|
|
|
72
|
+
### Resuming a single [`.foreach()`](https://mastra.ai/reference/workflows/workflow-methods/foreach) iteration
|
|
73
|
+
|
|
74
|
+
When a [`.foreach()`](https://mastra.ai/reference/workflows/workflow-methods/foreach) step suspends across multiple iterations, use `forEachIndex` (zero-based) to resume one iteration at a time with different `resumeData`. Iterations not targeted by `forEachIndex` remain suspended until resumed.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// Resume only the second iteration (index 1) with its own data
|
|
78
|
+
await run.resume({
|
|
79
|
+
step: 'approve',
|
|
80
|
+
resumeData: { ok: true },
|
|
81
|
+
forEachIndex: 1,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Later, resume the first iteration with different data
|
|
85
|
+
await run.resume({
|
|
86
|
+
step: 'approve',
|
|
87
|
+
resumeData: { ok: false },
|
|
88
|
+
forEachIndex: 0,
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If `forEachIndex` is omitted, every suspended iteration of the step is resumed with the same `resumeData`.
|
|
93
|
+
|
|
70
94
|
## Related
|
|
71
95
|
|
|
72
96
|
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
@@ -113,6 +113,19 @@ Each progress event payload contains:
|
|
|
113
113
|
|
|
114
114
|
**iterationOutput** (`Record<string, any>`): Output of the iteration (present when iterationStatus is 'success')
|
|
115
115
|
|
|
116
|
+
### Resuming a single iteration
|
|
117
|
+
|
|
118
|
+
When a step inside `.foreach()` suspends, each iteration suspends independently. Pass `forEachIndex` to [`run.resume()`](https://mastra.ai/reference/workflows/run-methods/resume) to resume one iteration at a time with its own `resumeData`. Omitting `forEachIndex` resumes every suspended iteration with the same data.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
await run.resume({
|
|
122
|
+
step: 'approve',
|
|
123
|
+
resumeData: { ok: true },
|
|
124
|
+
forEachIndex: 1,
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
116
128
|
## Related
|
|
117
129
|
|
|
118
|
-
- [Looping with foreach](https://mastra.ai/docs/workflows/control-flow)
|
|
130
|
+
- [Looping with foreach](https://mastra.ai/docs/workflows/control-flow)
|
|
131
|
+
- [run.resume()](https://mastra.ai/reference/workflows/run-methods/resume)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# DockerSandbox
|
|
2
|
+
|
|
3
|
+
Executes commands inside Docker containers on the local machine. Uses long-lived containers with `docker exec` for command execution. Targets local development, CI/CD, air-gapped deployments, and cost-sensitive scenarios where cloud sandboxes are unnecessary.
|
|
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/docker
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**pnpm**:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @mastra/docker
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Yarn**:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @mastra/docker
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Bun**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bun add @mastra/docker
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Requires [Docker Engine](https://docs.docker.com/engine/install/) running on the host machine.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
Add a `DockerSandbox` to a workspace and assign it to an agent:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { Agent } from '@mastra/core/agent'
|
|
41
|
+
import { Workspace } from '@mastra/core/workspace'
|
|
42
|
+
import { DockerSandbox } from '@mastra/docker'
|
|
43
|
+
|
|
44
|
+
const workspace = new Workspace({
|
|
45
|
+
sandbox: new DockerSandbox({
|
|
46
|
+
image: 'node:22-slim',
|
|
47
|
+
}),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const agent = new Agent({
|
|
51
|
+
name: 'dev-agent',
|
|
52
|
+
model: 'anthropic/claude-opus-4-6',
|
|
53
|
+
workspace,
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Constructor parameters
|
|
58
|
+
|
|
59
|
+
**id** (`string`): Unique identifier for this sandbox instance. Used for container naming and reconnection via labels. (Default: `Auto-generated`)
|
|
60
|
+
|
|
61
|
+
**image** (`string`): Docker image to use for the container. (Default: `'node:22-slim'`)
|
|
62
|
+
|
|
63
|
+
**command** (`string[]`): Container entrypoint command. Must keep the container alive for exec-based command execution. (Default: `['sleep', 'infinity']`)
|
|
64
|
+
|
|
65
|
+
**env** (`Record<string, string>`): Environment variables to set in the container.
|
|
66
|
+
|
|
67
|
+
**volumes** (`Record<string, string>`): Host-to-container bind mounts. Keys are host paths, values are container paths.
|
|
68
|
+
|
|
69
|
+
**network** (`string`): Docker network to join.
|
|
70
|
+
|
|
71
|
+
**privileged** (`boolean`): Run in privileged mode. (Default: `false`)
|
|
72
|
+
|
|
73
|
+
**workingDir** (`string`): Working directory inside the container. (Default: `'/workspace'`)
|
|
74
|
+
|
|
75
|
+
**labels** (`Record<string, string>`): Additional container labels. Mastra labels (mastra.sandbox, mastra.sandbox.id) are always included.
|
|
76
|
+
|
|
77
|
+
**timeout** (`number`): Default command timeout in milliseconds. (Default: `300000 (5 minutes)`)
|
|
78
|
+
|
|
79
|
+
**dockerOptions** (`Docker.DockerOptions`): Pass-through dockerode connection options for custom socket paths, remote hosts, or TLS certificates.
|
|
80
|
+
|
|
81
|
+
**instructions** (`string | function`): Custom instructions that override the default instructions returned by getInstructions(). Pass an empty string to suppress instructions.
|
|
82
|
+
|
|
83
|
+
## Properties
|
|
84
|
+
|
|
85
|
+
**id** (`string`): Sandbox instance identifier.
|
|
86
|
+
|
|
87
|
+
**name** (`string`): Provider name ('DockerSandbox').
|
|
88
|
+
|
|
89
|
+
**provider** (`string`): Provider identifier ('docker').
|
|
90
|
+
|
|
91
|
+
**status** (`ProviderStatus`): 'pending' | 'starting' | 'running' | 'stopping' | 'stopped' | 'destroying' | 'destroyed' | 'error'
|
|
92
|
+
|
|
93
|
+
**container** (`Container`): The underlying dockerode Container instance. Throws SandboxNotReadyError if the sandbox has not been started.
|
|
94
|
+
|
|
95
|
+
**processes** (`DockerProcessManager`): Background process manager. See \[SandboxProcessManager reference]\(/reference/workspace/process-manager).
|
|
96
|
+
|
|
97
|
+
## Background processes
|
|
98
|
+
|
|
99
|
+
`DockerSandbox` includes a built-in process manager for spawning and managing background processes. Processes run inside the container using `docker exec`.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const sandbox = new DockerSandbox({ id: 'dev-sandbox' })
|
|
103
|
+
await sandbox._start()
|
|
104
|
+
|
|
105
|
+
// Spawn a background process
|
|
106
|
+
const handle = await sandbox.processes.spawn('node server.js', {
|
|
107
|
+
env: { PORT: '3000' },
|
|
108
|
+
onStdout: data => console.log(data),
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
// Interact with the process
|
|
112
|
+
console.log(handle.stdout)
|
|
113
|
+
await handle.sendStdin('input\n')
|
|
114
|
+
await handle.kill()
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
See [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager) for the full API.
|
|
118
|
+
|
|
119
|
+
## Environment variables
|
|
120
|
+
|
|
121
|
+
Set environment variables at the container level with `env`. Per-command environment variables can also be passed when spawning processes:
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
const sandbox = new DockerSandbox({
|
|
125
|
+
image: 'node:22-slim',
|
|
126
|
+
env: {
|
|
127
|
+
NODE_ENV: 'production',
|
|
128
|
+
DATABASE_URL: 'postgres://localhost:5432/mydb',
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Bind mounts
|
|
134
|
+
|
|
135
|
+
Mount host directories into the container using the `volumes` option:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const sandbox = new DockerSandbox({
|
|
139
|
+
image: 'node:22-slim',
|
|
140
|
+
volumes: {
|
|
141
|
+
'/my/project': '/workspace/project',
|
|
142
|
+
'/shared/data': '/data',
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Bind mounts are applied at container creation time. The host paths must exist before the sandbox starts.
|
|
148
|
+
|
|
149
|
+
## Reconnection
|
|
150
|
+
|
|
151
|
+
`DockerSandbox` can reconnect to existing containers by matching labels. When `start()` is called, it checks for a container with the `mastra.sandbox.id` label matching the sandbox ID. If found:
|
|
152
|
+
|
|
153
|
+
- A running container is reused directly.
|
|
154
|
+
- A stopped container is restarted.
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// First run — creates a new container
|
|
158
|
+
const sandbox = new DockerSandbox({ id: 'persistent-sandbox' })
|
|
159
|
+
await sandbox._start()
|
|
160
|
+
|
|
161
|
+
// Later — reconnects to the existing container
|
|
162
|
+
const sandbox2 = new DockerSandbox({ id: 'persistent-sandbox' })
|
|
163
|
+
await sandbox2._start()
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Docker connection options
|
|
167
|
+
|
|
168
|
+
Connect to remote Docker hosts or use custom socket paths via `dockerOptions`:
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
// Remote Docker host
|
|
172
|
+
const sandbox = new DockerSandbox({
|
|
173
|
+
dockerOptions: {
|
|
174
|
+
host: '192.168.1.100',
|
|
175
|
+
port: 2376,
|
|
176
|
+
ca: fs.readFileSync('ca.pem'),
|
|
177
|
+
cert: fs.readFileSync('cert.pem'),
|
|
178
|
+
key: fs.readFileSync('key.pem'),
|
|
179
|
+
},
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
// Custom socket path
|
|
183
|
+
const sandbox = new DockerSandbox({
|
|
184
|
+
dockerOptions: {
|
|
185
|
+
socketPath: '/var/run/docker.sock',
|
|
186
|
+
},
|
|
187
|
+
})
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Related
|
|
191
|
+
|
|
192
|
+
- [SandboxProcessManager reference](https://mastra.ai/reference/workspace/process-manager)
|
|
193
|
+
- [WorkspaceSandbox interface](https://mastra.ai/reference/workspace/sandbox)
|
|
194
|
+
- [LocalSandbox reference](https://mastra.ai/reference/workspace/local-sandbox)
|
|
195
|
+
- [E2BSandbox reference](https://mastra.ai/reference/workspace/e2b-sandbox)
|
|
196
|
+
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,77 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.26-alpha.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`20f59b8`](https://github.com/mastra-ai/mastra/commit/20f59b876cf91199efbc49a0e36b391240708f08), [`e2687a7`](https://github.com/mastra-ai/mastra/commit/e2687a7408790c384563816a9a28ed06735684c9), [`8f1b280`](https://github.com/mastra-ai/mastra/commit/8f1b280b7fe6999ec654f160cb69c1a8719e7a57), [`12df98c`](https://github.com/mastra-ai/mastra/commit/12df98c4904643d9481f5c78f3bed443725b4c96)]:
|
|
8
|
+
- @mastra/core@1.26.0-alpha.11
|
|
9
|
+
|
|
10
|
+
## 1.1.26-alpha.19
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`aba393e`](https://github.com/mastra-ai/mastra/commit/aba393e2da7390c69b80e516a4f153cda6f09376), [`0a5fa1d`](https://github.com/mastra-ai/mastra/commit/0a5fa1d3cb0583889d06687155f26fd7d2edc76c), [`ea43e64`](https://github.com/mastra-ai/mastra/commit/ea43e646dd95d507694b6112b0bf1df22ad552b2), [`00d1b16`](https://github.com/mastra-ai/mastra/commit/00d1b16b401199cb294fa23f43336547db4dca9b), [`af8a57e`](https://github.com/mastra-ai/mastra/commit/af8a57ed9ba9685ad8601d5b71ae3706da6222f9)]:
|
|
15
|
+
- @mastra/core@1.26.0-alpha.10
|
|
16
|
+
|
|
17
|
+
## 1.1.26-alpha.17
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`16e34ca`](https://github.com/mastra-ai/mastra/commit/16e34caa98b9a114b17a6125e4e3fd87f169d0d0)]:
|
|
22
|
+
- @mastra/core@1.26.0-alpha.9
|
|
23
|
+
|
|
24
|
+
## 1.1.26-alpha.16
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`1bd5104`](https://github.com/mastra-ai/mastra/commit/1bd51048b6da93507276d6623e3fd96a9e1a8944)]:
|
|
29
|
+
- @mastra/core@1.26.0-alpha.8
|
|
30
|
+
|
|
31
|
+
## 1.1.26-alpha.14
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [[`8786a61`](https://github.com/mastra-ai/mastra/commit/8786a61fa54ba265f85eeff9985ca39863d18bb6), [`8fb2405`](https://github.com/mastra-ai/mastra/commit/8fb2405138f2d208b7962ad03f121ca25bcc28c5)]:
|
|
36
|
+
- @mastra/core@1.26.0-alpha.7
|
|
37
|
+
|
|
38
|
+
## 1.1.26-alpha.12
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`6315317`](https://github.com/mastra-ai/mastra/commit/63153175fe9a7b224e5be7c209bbebc01dd9b0d5), [`9d3b24b`](https://github.com/mastra-ai/mastra/commit/9d3b24b19407ae9c09586cf7766d38dc4dff4a69)]:
|
|
43
|
+
- @mastra/core@1.26.0-alpha.6
|
|
44
|
+
|
|
45
|
+
## 1.1.26-alpha.9
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`92dcf02`](https://github.com/mastra-ai/mastra/commit/92dcf029294210ac91b090900c1a0555a425c57a)]:
|
|
50
|
+
- @mastra/core@1.26.0-alpha.5
|
|
51
|
+
|
|
52
|
+
## 1.1.26-alpha.7
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [[`0474c2b`](https://github.com/mastra-ai/mastra/commit/0474c2b2e7c7e1ad8691dca031284841391ff1ef), [`f607106`](https://github.com/mastra-ai/mastra/commit/f607106854c6416c4a07d4082604b9f66d047221), [`62919a6`](https://github.com/mastra-ai/mastra/commit/62919a6ee0fbf3779ad21a97b1ec6696515d5104), [`0fd90a2`](https://github.com/mastra-ai/mastra/commit/0fd90a215caf5fca8099c15a67ca03e4427747a3)]:
|
|
57
|
+
- @mastra/core@1.26.0-alpha.4
|
|
58
|
+
|
|
59
|
+
## 1.1.26-alpha.5
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`fdd54cf`](https://github.com/mastra-ai/mastra/commit/fdd54cf612a9af876e9fdd85e534454f6e7dd518), [`30456b6`](https://github.com/mastra-ai/mastra/commit/30456b6b08c8fd17e109dd093b73d93b65e83bc5), [`9d11a8c`](https://github.com/mastra-ai/mastra/commit/9d11a8c1c8924eb975a245a5884d40ca1b7e0491), [`d246696`](https://github.com/mastra-ai/mastra/commit/d246696139a3144a5b21b042d41c532688e957e1), [`354f9ce`](https://github.com/mastra-ai/mastra/commit/354f9ce1ca6af2074b6a196a23f8ec30012dccca), [`e9837b5`](https://github.com/mastra-ai/mastra/commit/e9837b53699e18711b09e0ca010a4106376f2653)]:
|
|
64
|
+
- @mastra/core@1.26.0-alpha.3
|
|
65
|
+
- @mastra/mcp@1.5.1-alpha.1
|
|
66
|
+
|
|
67
|
+
## 1.1.26-alpha.3
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [[`3d83d06`](https://github.com/mastra-ai/mastra/commit/3d83d06f776f00fb5f4163dddd32a030c5c20844), [`7e0e63e`](https://github.com/mastra-ai/mastra/commit/7e0e63e2e485e84442351f4c7a79a424c83539dc), [`9467ea8`](https://github.com/mastra-ai/mastra/commit/9467ea87695749a53dfc041576410ebf9ee7bb67), [`7338d94`](https://github.com/mastra-ai/mastra/commit/7338d949380cf68b095342e8e42610dc51d557c1), [`c65aec3`](https://github.com/mastra-ai/mastra/commit/c65aec356cc037ee7c4b30ccea946807d4c4f443)]:
|
|
72
|
+
- @mastra/core@1.26.0-alpha.2
|
|
73
|
+
- @mastra/mcp@1.5.1-alpha.1
|
|
74
|
+
|
|
3
75
|
## 1.1.26-alpha.2
|
|
4
76
|
|
|
5
77
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.26-alpha.
|
|
3
|
+
"version": "1.1.26-alpha.22",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,26 +29,26 @@
|
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@mastra/core": "1.
|
|
33
|
-
"@mastra/mcp": "^1.5.1-alpha.
|
|
32
|
+
"@mastra/core": "1.26.0-alpha.11",
|
|
33
|
+
"@mastra/mcp": "^1.5.1-alpha.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@hono/node-server": "^1.19.11",
|
|
37
37
|
"@types/jsdom": "^21.1.7",
|
|
38
38
|
"@types/node": "22.19.15",
|
|
39
|
-
"@vitest/coverage-v8": "4.
|
|
40
|
-
"@vitest/ui": "4.
|
|
39
|
+
"@vitest/coverage-v8": "4.1.4",
|
|
40
|
+
"@vitest/ui": "4.1.4",
|
|
41
41
|
"@wong2/mcp-cli": "^1.13.0",
|
|
42
42
|
"cross-env": "^10.1.0",
|
|
43
|
-
"eslint": "^
|
|
43
|
+
"eslint": "^10.2.1",
|
|
44
44
|
"hono": "^4.12.8",
|
|
45
45
|
"tsup": "^8.5.1",
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
|
-
"vitest": "4.
|
|
49
|
-
"@internal/lint": "0.0.83",
|
|
48
|
+
"vitest": "4.1.4",
|
|
50
49
|
"@internal/types-builder": "0.0.58",
|
|
51
|
-
"@
|
|
50
|
+
"@internal/lint": "0.0.83",
|
|
51
|
+
"@mastra/core": "1.26.0-alpha.11"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|