@mastra/mcp-docs-server 1.3.14-alpha.1 → 1.3.14-alpha.3

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.
@@ -403,7 +403,7 @@ A lease only coordinates the processes that share it. `EventEmitterPubSub`, the
403
403
 
404
404
  ### Stop work after ownership loss
405
405
 
406
- Durable and evented agents request cancellation of in-flight tool and model calls when their step detects that it no longer owns the run. Evented workers in another process check ownership at the claim renewal interval without renewing the original execution's claim. By default that's every 5 seconds, a third of `MASTRA_AGENT_THREAD_LEASE_TTL_MS`. Detection depends on backend response time. If ownership checks keep failing or stop responding, the step stops trusting its claim after one lease TTL, 15 seconds by default.
406
+ Durable and evented agents request cancellation of in-flight tool and model calls when their step detects that it no longer owns the run. Evented workers in another process check ownership at the claim renewal interval without renewing the original execution's claim. By default that's every 5 seconds, a third of `MASTRA_AGENT_THREAD_LEASE_TTL_MS`. Detection depends on backend response time. A step in the process that holds the claim stops when an ownership check fails, or when the claim can't be renewed before it expires. A step that only observes another process's claim also stops when no check succeeds within one lease TTL (15 seconds by default).
407
407
 
408
408
  Cancellation is cooperative. Use the tool execution context's `abortSignal` for cancellable operations, and check it before starting another side effect. A tool that ignores the signal can keep running. Work already completed outside Mastra isn't rolled back.
409
409
 
@@ -146,6 +146,14 @@ Token counts are local `tokenx` estimates. The provider's own count is often hig
146
146
 
147
147
  A provider can reject a request for exceeding its context window before OM's estimate reaches the threshold. When that happens, OM activates any prepared observations, observes everything still pending, and retries the request once with the smaller context. This is on by default; set `observation.observeOnContextOverflow: false` to let the error reach your code instead.
148
148
 
149
+ ### Gateway models
150
+
151
+ A [Mastra Gateway](https://mastra.ai/models/gateways/mastra) model can keep a thread's observations on the gateway instead of your storage adapter. The gateway only does that for a Gateway project key (`msk_...`) that it serves with its own provider keys and with memory enabled for the project. An organization key (`msk-gateway-...` or `mskv2_...`) is served by a gateway without the memory API, so OM keeps running locally against the `Memory` you configured.
152
+
153
+ Keep `Memory` configured with `observationalMemory: true` in both cases. With a project key the gateway owns the thread, which means your storage adapter stays empty and `memory.recall()` doesn't return those messages.
154
+
155
+ > **Warning:** A project key alone doesn't mean the gateway stores the thread. When the request is routed with your own provider key, or memory is disabled for the project, the gateway proxies it without storing observations, while Mastra still skips local OM for a `mastra/` model on a project key. Neither the gateway nor your storage adapter keeps the conversation in that case. Use gateway-managed provider keys with project memory enabled, or a directly configured provider model, when the thread has to be stored.
156
+
149
157
  ## Choosing models
150
158
 
151
159
  The Observer and Reflector are model calls that run beside your agent. By default both use `model: 'auto'`, which resolves each time a role runs:
@@ -281,6 +281,8 @@ const workspace = new Workspace({
281
281
 
282
282
  These callbacks fire for all background processes started by the agent through `execute_command`.
283
283
 
284
+ Each callback receives the process `pid` and, when available, the `toolCallId`, `agentId`, `threadId`, `resourceId`, and `runId` of the call that started it, so you can route an exit notice back to the right conversation. `onExit` also gets `killedByAbort`, which is `true` when the abort signal fired (the run's signal by default) and stopped the process, and `false` when it exited on its own or was stopped with `kill_process`.
285
+
284
286
  By default, background processes inherit the agent's abort signal and stop when the agent disconnects. Set `abortSignal` to a custom signal, or use `null` or `false` when the process should continue after the request ends.
285
287
 
286
288
  For the full `SandboxProcessManager` API, including programmatic process spawning, output, and standard input, see the [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager).
@@ -183,6 +183,8 @@ const testAgent = async () => {
183
183
 
184
184
  `MastraClient` accepts optional parameters like `retries`, `backoffMs`, and `headers` to control request behavior. These parameters are useful for controlling retry behavior and including diagnostic metadata.
185
185
 
186
+ By default, retries apply to read requests only. `GET`, `HEAD`, and `OPTIONS` are retried on failure, while `POST`, `PUT`, `PATCH`, and `DELETE` are sent once unless you set `retries` explicitly, so a failed write can't repeat a state-changing request such as an agent generation or workflow start. The observability queries that travel as `POST` only read server state, so `aggregateTraces()`, `aggregateSpans()`, `queryTraceThreads()`, and `querySpans()` keep the read default.
187
+
186
188
  ```typescript
187
189
  import { MastraClient } from '@mastra/client-js'
188
190
 
@@ -210,6 +210,8 @@ Tigris uses virtual-hosted-style addressing, so `forcePathStyle` must be set to
210
210
 
211
211
  **readOnly** (`boolean`): When true, all write operations are blocked (Default: `false`)
212
212
 
213
+ **owner** (`{ uid: number; gid: number }`): Owner of the files inside a FUSE mount when this filesystem is mounted in a sandbox, as numeric uid and gid. Set it when sandbox commands run as a user other than the one that mounts, so that user can read and write the mounted files. When unset, the sandbox probes the default user's uid and gid.
214
+
213
215
  ## Properties
214
216
 
215
217
  **id** (`string`): Filesystem instance identifier
@@ -110,6 +110,8 @@ const filesystem = new GCSFilesystem({
110
110
 
111
111
  **readOnly** (`boolean`): When true, all write operations are blocked (Default: `false`)
112
112
 
113
+ **owner** (`{ uid: number; gid: number }`): Owner of the files inside a FUSE mount when this filesystem is mounted in a sandbox, as numeric uid and gid. Set it when sandbox commands run as a user other than the one that mounts, so that user can read and write the mounted files. When unset, the sandbox probes the default user's uid and gid.
114
+
113
115
  **endpoint** (`string`): Custom API endpoint URL. Used for local development with emulators.
114
116
 
115
117
  ## Properties
@@ -8,13 +8,13 @@ Mastra supports OpenTelemetry (OTEL) through an exporter for sending traces and
8
8
 
9
9
  ## Exporter
10
10
 
11
- The OpenTelemetry exporter sends your traces and logs using standardized [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/). This ensures broad compatibility with platforms like Datadog, New Relic, Sentry, SigNoz, MLflow, Latitude, Dash0, Traceloop, Laminar, telemetry.dev, Sazabi, and more.
11
+ The OpenTelemetry exporter sends your traces and logs using standardized [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/). This ensures broad compatibility with platforms like Datadog, New Relic, Sentry, SigNoz, MLflow, Latitude, Dash0, Traceloop, Laminar, telemetry.dev, Sazabi, Agnost AI, and more.
12
12
 
13
13
  ### Installation
14
14
 
15
15
  Each provider requires specific protocol packages. Install the base exporter plus the protocol package for your provider:
16
16
 
17
- #### For HTTP/Protobuf providers (SigNoz, New Relic, Sentry, Laminar, MLflow, Latitude, telemetry.dev)
17
+ #### For HTTP/Protobuf providers (SigNoz, New Relic, Sentry, Laminar, MLflow, Latitude, telemetry.dev, Agnost AI)
18
18
 
19
19
  **npm**:
20
20
 
@@ -222,6 +222,31 @@ new OtelExporter({
222
222
 
223
223
  See [Sazabi's Mastra guide](https://docs.sazabi.com/catalogs/log-sources/send-to-an-endpoint/mastra) for the full setup.
224
224
 
225
+ #### Agnost AI
226
+
227
+ [Agnost AI](https://agnost.ai) ingests OTLP/HTTP protobuf traces and groups them into conversations and users for production agent monitoring. Use the `custom` provider with your organization ID:
228
+
229
+ ```bash
230
+ AGNOST_ORG_ID=your-org-id
231
+ ```
232
+
233
+ ```typescript
234
+ new OtelExporter({
235
+ provider: {
236
+ custom: {
237
+ endpoint: 'https://otel.agnost.ai/v1/traces',
238
+ protocol: 'http/protobuf',
239
+ headers: {
240
+ 'X-Agnost-Org-ID': process.env.AGNOST_ORG_ID!,
241
+ },
242
+ },
243
+ },
244
+ signals: { logs: false },
245
+ })
246
+ ```
247
+
248
+ Agnost AI reads `userId` and `conversationId` (or `threadId`) from `tracingOptions.metadata` to group traces by user and conversation. It stores traces only, so `signals: { logs: false }` skips the log export. See [Agnost AI's Mastra guide](https://docs.agnost.ai/mastra) for the full setup.
249
+
225
250
  #### Dash0
226
251
 
227
252
  [Dash0](https://www.dash0.com/) provides real-time observability with automatic insights.
@@ -68,6 +68,8 @@ const agent = new Agent({
68
68
 
69
69
  **env** (`Record<string, string>`): Environment variables to set in the sandbox
70
70
 
71
+ **user** (`string`): OS user to run sandbox commands as, by name. Defaults to the template's own user. Use it to run agent commands as a second, unprivileged user: mounting still runs as the default user, which needs sudo. Set owner on a mount to give the command user read and write access to it. The user must already exist in the template.
72
+
71
73
  **workingDirectory** (`string`): Default directory for command execution when no per-command cwd is given. A per-command cwd always wins; when neither is set, commands run from the sandbox home directory. Use an absolute path.
72
74
 
73
75
  **id** (`string`): Unique identifier for this sandbox instance (Default: `Auto-generated`)
@@ -197,6 +199,27 @@ E2B sandboxes use FUSE (Filesystem in Userspace) to mount cloud storage:
197
199
 
198
200
  The E2B sandbox automatically installs the required FUSE tools when mounting is used. For best performance, pre-build a custom template with the tools installed.
199
201
 
202
+ ### Running commands as another user
203
+
204
+ Mounting needs `sudo`, so the template's default user is privileged: any command it runs can read the credentials staged for a mount and become root. To give agent commands less privilege, run them as a second user and set the owner of each mount to that user's uid and gid:
205
+
206
+ ```typescript
207
+ const workspace = new Workspace({
208
+ mounts: {
209
+ '/s3-data': new S3Filesystem({
210
+ bucket: 'my-s3-bucket',
211
+ region: 'us-east-1',
212
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
213
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
214
+ owner: { uid: 1001, gid: 1001 },
215
+ }),
216
+ },
217
+ sandbox: new E2BSandbox({ id: 'dev-sandbox', user: 'agent' }),
218
+ })
219
+ ```
220
+
221
+ `owner` sets the uid and gid of the files inside the mount, so the `user` running commands can read and write them. Without it, the mount is owned by the user that mounted it. Create the user in the template first; E2B runs a command as that user but doesn't create it.
222
+
200
223
  ## Custom templates
201
224
 
202
225
  By default, when no template is specified, E2BSandbox automatically builds a template with `s3fs` installed for S3 mounting support, a current Node.js LTS installed over the base image's older runtime, and corepack enabled so `pnpm` and `yarn` resolve to whatever a repository's `packageManager` field pins. This template is cached and reused across sandbox instances.
@@ -101,7 +101,7 @@ Adds or updates vectors and their metadata in the collection.
101
101
 
102
102
  Searches for similar vectors.
103
103
 
104
- > **Warning:** The `filter` and `includeVector` parameters aren't currently supported. Filtering must be performed client-side after retrieving results or through the Couchbase SDK's Search capabilities. Retrieve the vector embedding by fetching the full document by ID with the Couchbase SDK.
104
+ > **Warning:** The `filter` and `includeVector` parameters aren't currently supported. A `filter` is ignored, and the store logs a warning the first time one is passed. Passing `includeVector: true` throws a `MastraError`. Filter results client-side after retrieving them, or use the Couchbase SDK's Search capabilities. Retrieve the vector embedding by fetching the full document by ID with the Couchbase SDK.
105
105
 
106
106
  **indexName** (`string`): Name of the index to search in
107
107
 
@@ -109,7 +109,7 @@ Searches for similar vectors.
109
109
 
110
110
  **topK** (`number`): Number of results to return (Default: `10`)
111
111
 
112
- **filter** (`Record<string, any>`): Not supported. Filters passed here are ignored.
112
+ **filter** (`Record<string, any>`): Not supported. Filters passed here are ignored, and a warning is logged the first time one is passed.
113
113
 
114
114
  **includeVector** (`boolean`): Not supported. Setting this to true throws an error. (Default: `false`)
115
115
 
@@ -225,6 +225,7 @@ try {
225
225
  - Index creation delays may impact immediate querying after creation.
226
226
  - Vector dimension is enforced at ingest only after `createIndex()` creates a new index on the same `CouchbaseVector` instance. Calling `createIndex()` for an index that already exists doesn't turn on the ingest check. When the check is on, `upsert()` and `updateVector()` throw on a dimension mismatch. `query()` always checks the query vector against the index dimension.
227
227
  - `deleteVectors()` supports deletion by ID only. Metadata-filter deletion isn't supported.
228
+ - `query()` can't filter by metadata. When Couchbase is Mastra memory's vector store, semantic recall still stays within the current thread or resource, because Memory checks each result itself. Results from other threads or resources still count toward `topK`, so recall may return fewer messages than `topK`.
228
229
  - Vector insertion and index updates are eventually consistent. Strong consistency isn't guaranteed immediately after writes.
229
230
 
230
231
  ## Related
@@ -60,6 +60,10 @@ for await (const chunk of result.textStream) {
60
60
  }
61
61
  ```
62
62
 
63
+ A gateway with a Gateway project key (`msk_...`) stores each thread's observations when it serves the request with its own provider keys and memory is enabled for the project. A gateway with an organization key (`msk-gateway-...` or `mskv2_...`) is served without the memory API, so it doesn't. Configure [`Memory`](https://mastra.ai/docs/memory/observational-memory) with `observationalMemory: true` in that case: Observational Memory then runs against your storage adapter instead of the gateway.
64
+
65
+ When a request is routed with your own provider key, or memory is disabled for the project, the gateway proxies it without storing observations while Mastra skips local Observational Memory for a `mastra/` model on a project key. Use gateway-managed provider keys with project memory enabled when the thread has to be stored.
66
+
63
67
  ## Configuration
64
68
 
65
69
  ```bash
@@ -43,7 +43,7 @@ You can also pass `requestContext` as a `Record<string, any>`.
43
43
 
44
44
  **baseUrl** (`string`): The base URL for the Mastra API. All requests will be sent relative to this URL.
45
45
 
46
- **retries** (`number`): The number of times a request will be retried on failure before throwing an error. (Default: `3`)
46
+ **retries** (`number`): The number of times a request will be retried on failure before throwing an error. Retries apply to read requests (GET, HEAD, OPTIONS) by default, and to the observability queries that read server state even though they are sent as POST (aggregateTraces, aggregateSpans, queryTraceThreads, querySpans). Write requests (POST, PUT, PATCH, DELETE) are sent once unless you set this explicitly, so a server error can't repeat a state-changing request. (Default: `3 for read requests, 0 for write requests`)
47
47
 
48
48
  **backoffMs** (`number`): The initial delay in milliseconds before retrying a failed request. This value is doubled with each retry (exponential backoff). (Default: `300`)
49
49
 
@@ -200,7 +200,7 @@ When using the `headers` option, the markdown strategy ignores all general optio
200
200
 
201
201
  ### JSON
202
202
 
203
- **maxSize** (`number`): Target maximum size of each JSON chunk. Must be at least 21. Long values nested in objects can produce larger chunks.
203
+ **maxSize** (`number`): Target maximum size of each JSON chunk. Must be at least 21. Long string values are split so chunks stay within this limit, and no content is discarded. A chunk can exceed the limit when a field path leaves no room for a single character, when ensureAscii escaping expands a value (the default), or when a long value is nested in an object.
204
204
 
205
205
  **minSize** (`number`): Accepted for compatibility. Has no effect on JSON chunking: chunks smaller than this are kept, so no data is discarded.
206
206
 
@@ -97,6 +97,8 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
97
97
 
98
98
  **legacy** (`'reject' | 'stateless'`): How HTTP requests from 2025-era clients (those that open with initialize, such as VS Code and Cursor) are served. 'reject' (default) answers them with an unsupported-protocol-version error. 'stateless' answers each request without a session: listing and calling tools, reading resources and getting prompts work, GET and DELETE session requests get 405, and features that need 2026-07-28 (suspend/resume, subscriptions/listen, events) aren't available to these clients.
99
99
 
100
+ **maxRequestBodySize** (`number`): Upper bound, in bytes, on the HTTP request body the server reads from the request stream. A larger body is answered with a 413 JSON-RPC error before it is parsed, so no tool runs. It bounds only the body the server reads itself: when body-parsing middleware supplies the parsed body, this bound does not apply, so set the size limit on that parser as well. Defaults to 4194304 (4 MiB). Raise it on servers that receive large tools/call payloads, such as base64-encoded documents. Must be a positive number. Not applied to stdio, which has no request bodies.
101
+
100
102
  **toolResult** (`MCPServerToolResultOptions`): Controls how completed tool calls become MCP results. modelOutput: true builds the result content from each tool's toModelOutput, so tools can return images, audio, and files. transform rewrites a result before it's sent. See Tool results for details.
101
103
 
102
104
  **jsonSchemaValidator** (`jsonSchemaValidator`): Custom JSON Schema validator used for tool input, output and continuation answers, for runtimes where the SDK default is unavailable.
@@ -521,11 +521,11 @@ The `execute_command` tool accepts these options:
521
521
 
522
522
  **backgroundProcesses** (`BackgroundProcessesConfig`): Configuration for handling background processes. Only applicable if the sandbox supports background execution.
523
523
 
524
- **backgroundProcesses.onStdout** (`(data: string, meta: BackgroundProcessMeta) => void`): Callback for stdout chunks from background processes.
524
+ **backgroundProcesses.onStdout** (`(data: string, meta: BackgroundProcessMeta) => void`): Callback for stdout chunks from background processes. Meta includes pid, toolCallId, agentId, threadId, resourceId, and runId of the call that started the process.
525
525
 
526
- **backgroundProcesses.onStderr** (`(data: string, meta: BackgroundProcessMeta) => void`): Callback for stderr chunks from background processes.
526
+ **backgroundProcesses.onStderr** (`(data: string, meta: BackgroundProcessMeta) => void`): Callback for stderr chunks from background processes. Meta matches onStdout.
527
527
 
528
- **backgroundProcesses.onExit** (`(meta: BackgroundProcessExitMeta) => void`): Callback when a background process exits. Meta includes pid, exitCode, stdout, and stderr.
528
+ **backgroundProcesses.onExit** (`(meta: BackgroundProcessExitMeta) => void`): Callback when a background process exits. Meta includes the onStdout fields plus exitCode, stdout, stderr, and killedByAbort (true when the abort signal killed the process, false for a normal exit or kill_process).
529
529
 
530
530
  **backgroundProcesses.abortSignal** (`AbortSignal | null | false`): Abort signal for background processes. undefined (default) uses the agent's signal. null or false disables abort — processes persist after agent shutdown.
531
531
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.3.14-alpha.1",
3
+ "version": "1.3.14-alpha.3",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,8 +26,8 @@
26
26
  "@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
27
27
  "local-pkg": "^1.2.1",
28
28
  "zod": "^4.6.7",
29
- "@mastra/core": "1.84.0-alpha.1",
30
- "@mastra/mcp": "^2.9.0"
29
+ "@mastra/core": "1.84.0-alpha.3",
30
+ "@mastra/mcp": "^2.10.0-alpha.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hono/node-server": "^2.1.3",
@@ -42,8 +42,8 @@
42
42
  "tsx": "^4.23.15",
43
43
  "typescript": "^7.0.2",
44
44
  "vitest": "5.1.0",
45
- "@internal/types-builder": "0.0.124",
46
- "@internal/lint": "0.0.149"
45
+ "@internal/lint": "0.0.149",
46
+ "@internal/types-builder": "0.0.124"
47
47
  },
48
48
  "homepage": "https://mastra.ai",
49
49
  "repository": {