@mastra/mcp-docs-server 1.2.19-alpha.4 → 1.2.19

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 (100) hide show
  1. package/.docs/docs/channels.md +28 -1
  2. package/.docs/docs/deployment/cloud-providers.md +1 -0
  3. package/.docs/docs/deployment/mastra-server.md +19 -0
  4. package/.docs/docs/deployment/overview.md +1 -0
  5. package/.docs/docs/deployment/workers.md +2 -2
  6. package/.docs/docs/harness/durable-agents.md +1 -1
  7. package/.docs/docs/mastra-platform/api.md +54 -0
  8. package/.docs/docs/mastra-platform/deploy.md +101 -0
  9. package/.docs/docs/mastra-platform/observability.md +3 -1
  10. package/.docs/docs/mastra-platform/server.md +6 -11
  11. package/.docs/docs/mastra-platform/studio.md +8 -10
  12. package/.docs/docs/memory/semantic-recall.md +19 -0
  13. package/.docs/docs/observability/feedback.md +14 -0
  14. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +19 -14
  15. package/.docs/docs/observability/metrics/overview.md +31 -44
  16. package/.docs/docs/sandbox/overview.md +43 -0
  17. package/.docs/docs/server/middleware.md +30 -0
  18. package/.docs/docs/server/server-adapters.md +109 -34
  19. package/.docs/docs/storage.md +2 -0
  20. package/.docs/docs/subagents.md +6 -6
  21. package/.docs/integrations/channels/github.md +56 -9
  22. package/.docs/integrations/channels/imessage.md +150 -8
  23. package/.docs/integrations/databases/elasticsearch.md +156 -0
  24. package/.docs/integrations/databases/libsql.md +16 -0
  25. package/.docs/integrations/databases/mongodb.md +1 -1
  26. package/.docs/integrations/databases/postgresql.md +26 -0
  27. package/.docs/integrations/databases/valkey.md +99 -0
  28. package/.docs/integrations/deploy/kubernetes-helm.md +332 -0
  29. package/.docs/integrations/deploy/kubernetes.md +1 -1
  30. package/.docs/integrations/deploy/render.md +47 -61
  31. package/.docs/integrations/sandboxes/daytona.md +52 -0
  32. package/.docs/integrations/sandboxes/e2b-desktop.md +128 -0
  33. package/.docs/integrations/sandboxes/e2b.md +6 -0
  34. package/.docs/integrations/sandboxes/vercel.md +2 -2
  35. package/.docs/integrations/tools/parallel.md +240 -0
  36. package/.docs/integrations.md +5 -0
  37. package/.docs/models/environment-variables.md +9 -0
  38. package/.docs/models/gateways/netlify.md +12 -5
  39. package/.docs/models/gateways/openrouter.md +5 -10
  40. package/.docs/models/gateways/vercel.md +5 -5
  41. package/.docs/models/index.md +1 -1
  42. package/.docs/models/providers/agentrouter.md +17 -34
  43. package/.docs/models/providers/agnes.md +75 -0
  44. package/.docs/models/providers/aixy.md +73 -0
  45. package/.docs/models/providers/aki-io.md +14 -13
  46. package/.docs/models/providers/chutes.md +2 -2
  47. package/.docs/models/providers/cline-pass.md +4 -2
  48. package/.docs/models/providers/crof.md +3 -8
  49. package/.docs/models/providers/deepseek.md +4 -6
  50. package/.docs/models/providers/edenai.md +14 -14
  51. package/.docs/models/providers/evroc.md +3 -2
  52. package/.docs/models/providers/gmicloud.md +6 -4
  53. package/.docs/models/providers/huggingface.md +2 -1
  54. package/.docs/models/providers/hyper.md +5 -5
  55. package/.docs/models/providers/inceptron.md +2 -2
  56. package/.docs/models/providers/iteracompute.md +73 -0
  57. package/.docs/models/providers/kilo.md +26 -27
  58. package/.docs/models/providers/llmgateway-providers.md +18 -9
  59. package/.docs/models/providers/llmgateway.md +3 -5
  60. package/.docs/models/providers/llmtech.md +73 -0
  61. package/.docs/models/providers/nano-gpt.md +22 -13
  62. package/.docs/models/providers/neosmith.md +104 -0
  63. package/.docs/models/providers/nvidia.md +3 -1
  64. package/.docs/models/providers/ofox.md +2 -1
  65. package/.docs/models/providers/openai.md +2 -2
  66. package/.docs/models/providers/opencode-go.md +3 -2
  67. package/.docs/models/providers/opper.md +112 -0
  68. package/.docs/models/providers/pendra.md +78 -0
  69. package/.docs/models/providers/requesty.md +1 -1
  70. package/.docs/models/providers/standardcompute.md +73 -0
  71. package/.docs/models/providers/vivgrid.md +2 -1
  72. package/.docs/models/providers/wandb.md +2 -1
  73. package/.docs/models/providers/zai.md +2 -1
  74. package/.docs/models/providers.md +9 -0
  75. package/.docs/reference/agents/channels.md +1 -1
  76. package/.docs/reference/ai-sdk/handle-chat-stream.md +11 -0
  77. package/.docs/reference/ai-sdk/with-sse-heartbeat.md +47 -0
  78. package/.docs/reference/cli/mastra.md +10 -4
  79. package/.docs/reference/client-js/observability.md +1 -1
  80. package/.docs/reference/index.md +5 -0
  81. package/.docs/reference/observability/feedback.md +4 -0
  82. package/.docs/reference/observability/metrics/automatic-metrics.md +1 -1
  83. package/.docs/reference/observability/metrics/queries.md +462 -0
  84. package/.docs/reference/pubsub/valkey-streams.md +84 -0
  85. package/.docs/reference/rag/vector-databases.md +4 -4
  86. package/.docs/reference/server/elysia-adapter.md +184 -0
  87. package/.docs/reference/server/express-adapter.md +6 -8
  88. package/.docs/reference/server/hono-adapter.md +19 -6
  89. package/.docs/reference/storage/turso.md +88 -0
  90. package/.docs/reference/streaming/ChunkType.md +29 -1
  91. package/.docs/reference/streaming/agents/stream.md +1 -3
  92. package/.docs/reference/tools/mcp-client.md +41 -9
  93. package/.docs/reference/vectors/mongodb.md +11 -11
  94. package/.docs/reference/vectors/pg.md +2 -0
  95. package/.docs/reference/workspace/local-sandbox.md +2 -0
  96. package/.docs/reference/workspace/platform-sandbox.md +3 -1
  97. package/.docs/reference/workspace/sandbox.md +143 -3
  98. package/CHANGELOG.md +81 -0
  99. package/package.json +6 -6
  100. package/.docs/docs/observability/metrics/querying.md +0 -314
@@ -0,0 +1,184 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Elysia adapter
4
+
5
+ The `@mastra/elysia` package provides a server adapter for running Mastra with [Elysia](https://elysiajs.com).
6
+
7
+ > **Note:** For general adapter concepts, constructor options, and initialization flow, see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
8
+
9
+ ## Installation
10
+
11
+ Install the Elysia adapter and Elysia framework:
12
+
13
+ **npm**:
14
+
15
+ ```bash
16
+ npm install @mastra/elysia@latest elysia
17
+ ```
18
+
19
+ **pnpm**:
20
+
21
+ ```bash
22
+ pnpm add @mastra/elysia@latest elysia
23
+ ```
24
+
25
+ **Yarn**:
26
+
27
+ ```bash
28
+ yarn add @mastra/elysia@latest elysia
29
+ ```
30
+
31
+ **Bun**:
32
+
33
+ ```bash
34
+ bun add @mastra/elysia@latest elysia
35
+ ```
36
+
37
+ ## Usage example
38
+
39
+ ```typescript
40
+ import { Elysia } from 'elysia'
41
+ import { MastraServer } from '@mastra/elysia'
42
+ import { mastra } from './mastra'
43
+
44
+ const app = new Elysia()
45
+ const server = new MastraServer({ app, mastra })
46
+
47
+ await server.init()
48
+
49
+ app.listen(3000)
50
+
51
+ console.log('Server running on http://localhost:3000')
52
+ ```
53
+
54
+ ## Constructor parameters
55
+
56
+ **app** (`Elysia`): Elysia app instance
57
+
58
+ **mastra** (`Mastra`): Mastra instance
59
+
60
+ **prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
61
+
62
+ **openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
63
+
64
+ **bodyLimitOptions** (`BodyLimitOptions`): Request body size limits
65
+
66
+ **streamOptions** (`StreamOptions`): Stream redaction config. When true (default), redacts sensitive data from stream chunks before sending to clients. (Default: `{ redact: true }`)
67
+
68
+ **customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH (e.g., GET:/api/health). Value false makes route public, true requires auth.
69
+
70
+ **tools** (`ToolsInput`): Available tools for the server
71
+
72
+ **taskStore** (`InMemoryTaskStore`): Task store for A2A (Agent-to-Agent) operations
73
+
74
+ **mcpOptions** (`MCPOptions`): MCP transport options. Set serverless: true for stateless environments like Vercel Edge.
75
+
76
+ ## Adding custom routes
77
+
78
+ Add routes directly to the Elysia app:
79
+
80
+ ```typescript
81
+ import { Elysia } from 'elysia'
82
+ import { MastraServer } from '@mastra/elysia'
83
+ import { mastra } from './mastra'
84
+
85
+ const app = new Elysia()
86
+ const server = new MastraServer({ app, mastra })
87
+
88
+ // Before init - runs before Mastra middleware
89
+ app.get('/early-health', () => ({ status: 'ok' }))
90
+
91
+ await server.init()
92
+
93
+ // After init - has access to Mastra context
94
+ app.get('/custom', ({ mastra }) => {
95
+ return { agents: Object.keys(mastra.listAgents()) }
96
+ })
97
+ ```
98
+
99
+ > **Tip:** Routes added before `init()` run without Mastra context. Add routes after `init()` to access the Mastra instance and request context.
100
+
101
+ When you want Mastra-managed auth and route metadata such as `requiresAuth`, prefer [`registerApiRoute()`](https://mastra.ai/reference/server/register-api-route). For raw Elysia routes mounted directly on `app`, use `createAuthMiddleware()`:
102
+
103
+ ```typescript
104
+ import { Elysia } from 'elysia'
105
+ import { createAuthMiddleware, MastraServer } from '@mastra/elysia'
106
+ import { mastra } from './mastra'
107
+
108
+ const app = new Elysia()
109
+ const server = new MastraServer({ app, mastra })
110
+
111
+ await server.init()
112
+
113
+ app.get('/custom/protected', async ctx => {
114
+ const authResponse = await createAuthMiddleware({ mastra })(ctx)
115
+ if (authResponse) return authResponse
116
+
117
+ const user = ctx.requestContext.get('user')
118
+ return { user }
119
+ })
120
+
121
+ app.get('/custom/public', async ctx => {
122
+ const authResponse = await createAuthMiddleware({ mastra, requiresAuth: false })(ctx)
123
+ if (authResponse) return authResponse
124
+
125
+ return { ok: true }
126
+ })
127
+ ```
128
+
129
+ ## Accessing context
130
+
131
+ In Elysia handlers registered after `init()`, access Mastra context from the handler context:
132
+
133
+ ```typescript
134
+ app.get('/custom', ({ mastra, requestContext, abortSignal }) => {
135
+ const agent = mastra.getAgent('myAgent')
136
+ const user = requestContext.get('user')
137
+
138
+ return { agent: agent.name, user, aborted: abortSignal.aborted }
139
+ })
140
+ ```
141
+
142
+ Available context keys:
143
+
144
+ | Key | Description |
145
+ | ----------------------- | -------------------------------------------------------------- |
146
+ | `mastra` | Mastra instance |
147
+ | `requestContext` | Request context map |
148
+ | `abortSignal` | Request cancellation signal |
149
+ | `registeredTools` | Available tools |
150
+ | `taskStore` | Task store for A2A operations |
151
+ | `customRouteAuthConfig` | Per-route auth overrides |
152
+ | `user` | Authenticated user in `requestContext` when auth is configured |
153
+
154
+ ## OpenAPI helpers
155
+
156
+ Use `getMastraOpenAPIDoc()` when you need to pass Mastra's generated OpenAPI document to Elysia tooling such as `@elysiajs/openapi`:
157
+
158
+ ```typescript
159
+ import { openapi } from '@elysiajs/openapi'
160
+ import { Elysia } from 'elysia'
161
+ import { getMastraOpenAPIDoc, MastraServer } from '@mastra/elysia'
162
+ import { mastra } from './mastra'
163
+
164
+ const app = new Elysia()
165
+ const server = new MastraServer({ app, mastra })
166
+
167
+ await server.init()
168
+
169
+ app.use(
170
+ openapi({
171
+ documentation: getMastraOpenAPIDoc(server),
172
+ }),
173
+ )
174
+ ```
175
+
176
+ Call `clearMastraOpenAPICache(server)` if you need to regenerate the cached document for the same server instance.
177
+
178
+ ## MCP support
179
+
180
+ The Elysia adapter supports both MCP HTTP and MCP SSE transports.
181
+
182
+ ## Manual initialization
183
+
184
+ For custom middleware ordering, call each method separately instead of `init()`. See [manual initialization](https://mastra.ai/docs/server/server-adapters) for details.
@@ -162,13 +162,13 @@ Available properties on `res.locals`:
162
162
 
163
163
  ## Adding middleware
164
164
 
165
- Add Express middleware before or after `init()`:
165
+ Add Express middleware before `init()` to run it on every request. Mastra context isn't available at that point:
166
166
 
167
167
  ```typescript
168
168
  const app = express()
169
169
  app.use(express.json())
170
170
 
171
- // Middleware before init
171
+ // Runs on every request, before Mastra context exists
172
172
  app.use((req, res, next) => {
173
173
  console.log(`${req.method} ${req.url}`)
174
174
  next()
@@ -176,14 +176,12 @@ app.use((req, res, next) => {
176
176
 
177
177
  const server = new MastraServer({ app, mastra })
178
178
  await server.init()
179
-
180
- // Middleware after init has access to Mastra context
181
- app.use((req, res, next) => {
182
- const mastra = res.locals.mastra
183
- next()
184
- })
185
179
  ```
186
180
 
181
+ Middleware added after `init()` never runs for Mastra's routes. Express dispatches handlers in registration order, so middleware registered after the routes only applies to routes added later.
182
+
183
+ This adapter can't run [`server.middleware`](https://mastra.ai/docs/server/middleware) handlers because they use Hono's signature, and it logs a warning when that option is set. If you need Express middleware between Mastra's context step and its routes, use the manual initialization flow below.
184
+
187
185
  ## Manual initialization
188
186
 
189
187
  For custom middleware ordering, call each method separately instead of `init()`. See [manual initialization](https://mastra.ai/docs/server/server-adapters) for details.
@@ -145,7 +145,7 @@ Available context keys:
145
145
 
146
146
  ## Adding middleware
147
147
 
148
- Add Hono middleware before or after `init()`:
148
+ Add Hono middleware with `app.use()` before `init()` to run it on every request. Mastra context isn't available at that point:
149
149
 
150
150
  ```typescript
151
151
  import { Hono } from 'hono'
@@ -153,7 +153,7 @@ import { HonoBindings, HonoVariables, MastraServer } from '@mastra/hono'
153
153
 
154
154
  const app = new Hono<{ Bindings: HonoBindings; Variables: HonoVariables }>()
155
155
 
156
- // Middleware before init
156
+ // Runs on every request, before Mastra context exists
157
157
  app.use('*', async (c, next) => {
158
158
  console.log(`${c.req.method} ${c.req.url}`)
159
159
  await next()
@@ -161,11 +161,24 @@ app.use('*', async (c, next) => {
161
161
 
162
162
  const server = new MastraServer({ app, mastra })
163
163
  await server.init()
164
+ ```
164
165
 
165
- // Middleware after init has access to Mastra context
166
- app.use('*', async (c, next) => {
167
- const mastra = c.get('mastra')
168
- await next()
166
+ Middleware added after `init()` never runs for Mastra's routes. Hono dispatches handlers in registration order, so middleware registered after the routes only applies to routes added later.
167
+
168
+ To run middleware with Mastra context on Mastra's routes, use [`server.middleware`](https://mastra.ai/docs/server/middleware) in the Mastra config. The adapter registers it during `init()`, after the context step and before any route. These handlers are skipped for routes declared public with `requiresAuth: false`, so they can't block endpoints such as the Studio sign-in routes:
169
+
170
+ ```typescript
171
+ import { Mastra } from '@mastra/core'
172
+
173
+ export const mastra = new Mastra({
174
+ server: {
175
+ middleware: [
176
+ async (c, next) => {
177
+ c.get('requestContext').set('locale', c.req.header('accept-language') ?? 'en')
178
+ await next()
179
+ },
180
+ ],
181
+ },
169
182
  })
170
183
  ```
171
184
 
@@ -0,0 +1,88 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Turso Storage
4
+
5
+ Use `@mastra/turso` to store Mastra agents, workflows, memory, and other storage domains in a local [Turso Database](https://github.com/tursodatabase/turso) file.
6
+
7
+ ## Installation
8
+
9
+ **npm**:
10
+
11
+ ```bash
12
+ npm install @mastra/turso
13
+ ```
14
+
15
+ **pnpm**:
16
+
17
+ ```bash
18
+ pnpm add @mastra/turso
19
+ ```
20
+
21
+ **Yarn**:
22
+
23
+ ```bash
24
+ yarn add @mastra/turso
25
+ ```
26
+
27
+ **Bun**:
28
+
29
+ ```bash
30
+ bun add @mastra/turso
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```typescript
36
+ import { Mastra } from '@mastra/core/mastra'
37
+ import { TursoStore } from '@mastra/turso'
38
+
39
+ export const mastra = new Mastra({
40
+ storage: new TursoStore({
41
+ id: 'local-storage',
42
+ path: './mastra.db',
43
+ }),
44
+ })
45
+ ```
46
+
47
+ ## Constructor options
48
+
49
+ - `id` (required): Unique identifier for the storage instance.
50
+ - `path` (required unless `client` is provided): Path to the local database file.
51
+ - `client`: A compatible SQLite client to use instead of creating a native Turso client.
52
+ - `readonly`: Opens the database in read-only mode.
53
+ - `fileMustExist`: Requires the database file to exist before opening it.
54
+ - `timeout`: Connection timeout in milliseconds.
55
+ - `defaultQueryTimeout`: Default query timeout in milliseconds.
56
+ - `tracing`: Native driver tracing level: `info`, `debug`, or `trace`.
57
+ - `experimental`: Native Turso Database experimental features to enable.
58
+ - `maxRetries`: Maximum number of retries for retryable writes.
59
+ - `initialBackoffMs`: Initial retry delay in milliseconds.
60
+ - `disableInit`: Disables automatic storage initialization.
61
+ - `retention`: Retention policies for supported storage domains.
62
+
63
+ ## Platform support
64
+
65
+ The native driver supports macOS on arm64, Windows on x64, and glibc-based Linux on x64 and arm64. Use `getTursoDatabaseSupport()` when your application needs to choose a fallback on unsupported systems.
66
+
67
+ ```typescript
68
+ import { getTursoDatabaseSupport } from '@mastra/turso'
69
+
70
+ const support = getTursoDatabaseSupport()
71
+ if (!support.supported) {
72
+ console.warn(support.reason)
73
+ }
74
+ ```
75
+
76
+ ## Experimental features
77
+
78
+ Experimental Turso Database features are disabled by default. Enable only the features your application requires.
79
+
80
+ ```typescript
81
+ const storage = new TursoStore({
82
+ id: 'multiprocess-storage',
83
+ path: './mastra.db',
84
+ experimental: ['multiprocess_wal'],
85
+ })
86
+ ```
87
+
88
+ `@mastra/turso` provides local-file Mastra storage. It doesn't connect to remote libSQL databases and doesn't include a vector store.
@@ -272,8 +272,36 @@ Contains file data.
272
272
 
273
273
  **payload.providerMetadata** (`SharedV2ProviderMetadata`): Provider-specific metadata
274
274
 
275
+ ### reasoning-file
276
+
277
+ Contains a file generated by the model as part of its reasoning. Emitted by providers on the AI SDK v7 specification.
278
+
279
+ **type** (`"reasoning-file"`): Chunk type identifier
280
+
281
+ **payload** (`ReasoningFilePayload`): Reasoning file data
282
+
283
+ **payload.data** (`string | Uint8Array`): The file data
284
+
285
+ **payload.base64** (`string`): Base64 encoded data if applicable
286
+
287
+ **payload.mimeType** (`string`): MIME type of the file
288
+
289
+ **payload.providerMetadata** (`SharedV2ProviderMetadata`): Provider-specific metadata
290
+
275
291
  ## Control chunks
276
292
 
293
+ ### custom
294
+
295
+ Contains a provider-specific content block that doesn't map to any other standardized chunk type. Emitted by providers on the AI SDK v7 specification.
296
+
297
+ **type** (`"custom"`): Chunk type identifier
298
+
299
+ **payload** (`CustomPayload`): Custom provider content
300
+
301
+ **payload.kind** (`string`): The kind of custom content, in the format {provider}.{provider-type}
302
+
303
+ **payload.providerMetadata** (`SharedV2ProviderMetadata`): Provider-specific metadata
304
+
277
305
  ### start
278
306
 
279
307
  Signals the start of streaming.
@@ -324,7 +352,7 @@ Signals the completion of a processing step.
324
352
 
325
353
  ### raw
326
354
 
327
- Contains raw data from the provider.
355
+ Contains raw data from the provider. Content types Mastra doesn't recognize are also emitted as `raw` chunks rather than being discarded. Raw chunks only appear when `includeRawChunks` is enabled.
328
356
 
329
357
  **type** (`"raw"`): Chunk type identifier
330
358
 
@@ -82,7 +82,7 @@ const stream = await agent.stream('message for agent')
82
82
 
83
83
  **options.onAbort** (`(event: { steps: any[]; text?: string }) => Promise<void> | void`): Callback function called when the stream is aborted. steps contains the steps that completed before the abort, and text contains the assistant text streamed so far for the step that was in flight.
84
84
 
85
- **options.abortSignal** (`AbortSignal`): Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated, including any in-flight subagent runs the agent delegated to.
85
+ **options.abortSignal** (`AbortSignal`): Signal object that allows you to abort the agent's execution, including in-flight subagent runs. Canceled runs continue through output processors. When writable memory is configured, built-in memory processors persist submitted messages, completed tool results, and assistant output available when terminal processing runs. Output that doesn't reach terminal processing isn't persisted. Custom output processors can transform or interrupt this behavior before memory processors run.
86
86
 
87
87
  **options.activeTools** (`Array<keyof ToolSet> | undefined`): Array of active tool names that can be used during execution.
88
88
 
@@ -180,8 +180,6 @@ const stream = await agent.stream('message for agent')
180
180
 
181
181
  **options.savePerStep** (`boolean`): Save messages incrementally after each stream step completes (default: false).
182
182
 
183
- **options.persistPartialOnAbort** (`boolean`): Save the assistant text that was streamed before an abort to memory (default: false). Only text emitted before the abort is persisted; output a provider keeps producing after cancellation is discarded, and nothing is saved when no text was streamed.
184
-
185
183
  **options.requireToolApproval** (`boolean`): When true, all tool calls require explicit approval before execution. The stream will emit tool-call-approval chunks and pause until approveToolCall() or declineToolCall() is called.
186
184
 
187
185
  **options.autoResumeSuspendedTools** (`boolean`): When true, automatically resumes suspended tools when the user sends a new message on the same thread. The agent extracts resumeData from the user's message based on the tool's resumeSchema. Requires memory to be configured.
@@ -232,15 +232,17 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
232
232
  Set `perServerTimeoutMs` to limit how long discovery waits for each server. Servers that finish within the limit remain in `tools`. Timed-out servers appear in `errors`, and `durations` reports each server's discovery time in milliseconds.
233
233
 
234
234
  ```typescript
235
- const { tools, errors, durations } = await mcp.listToolsWithErrors({
235
+ const { tools, errors, errorDetails, durations } = await mcp.listToolsWithErrors({
236
236
  perServerTimeoutMs: 3_000,
237
237
  })
238
238
 
239
239
  new Agent({ id: 'agent', tools })
240
- console.log(errors, durations)
240
+ console.log(errors, errorDetails, durations)
241
241
  ```
242
242
 
243
- When called without options, the method returns only `tools` and `errors`.
243
+ `errors` remains a string map for backward compatibility. `errorDetails` provides the same message plus machine-readable `httpStatus` and transport `code` fields when the underlying error exposes them. When an HTTP status is available, the legacy message also includes an `(HTTP nnn)` suffix.
244
+
245
+ When called without options, the method omits only `durations`; `tools`, `errors`, and `errorDetails` are always returned.
244
246
 
245
247
  ### `listToolsets()`
246
248
 
@@ -257,15 +259,15 @@ const res = await agent.stream(prompt, {
257
259
  Returns toolsets grouped by server name, along with per-server discovery errors. Set `perServerTimeoutMs` to limit each server independently and include per-server `durations` in milliseconds.
258
260
 
259
261
  ```typescript
260
- const { toolsets, errors, durations } = await mcp.listToolsetsWithErrors({
262
+ const { toolsets, errors, errorDetails, durations } = await mcp.listToolsetsWithErrors({
261
263
  perServerTimeoutMs: 3_000,
262
264
  })
263
265
 
264
266
  const res = await agent.stream(prompt, { toolsets })
265
- console.log(errors, durations)
267
+ console.log(errors, errorDetails, durations)
266
268
  ```
267
269
 
268
- When called without options, the method returns only `toolsets` and `errors`.
270
+ When called without options, the method omits only `durations`; `toolsets`, `errors`, and `errorDetails` are always returned.
269
271
 
270
272
  ### `listToolDefinitions()`
271
273
 
@@ -286,7 +288,7 @@ Like `listToolDefinitions()`, but also returns per-server errors for servers tha
286
288
  Set `perServerTimeoutMs` to limit each server independently. When options are provided, `durations` reports each server's discovery time in milliseconds.
287
289
 
288
290
  ```typescript
289
- const { definitions, errors, durations } = await mcp.listToolDefinitionsWithErrors({
291
+ const { definitions, errors, errorDetails, durations } = await mcp.listToolDefinitionsWithErrors({
290
292
  perServerTimeoutMs: 3_000,
291
293
  })
292
294
 
@@ -294,10 +296,10 @@ if (Object.keys(errors).length === 0) {
294
296
  await cache.set('mcp-tools', JSON.stringify(definitions))
295
297
  }
296
298
 
297
- console.log(durations)
299
+ console.log(errorDetails, durations)
298
300
  ```
299
301
 
300
- When called without options, the method returns only `definitions` and `errors`.
302
+ When called without options, the method omits only `durations`; `definitions`, `errors`, and `errorDetails` are always returned.
301
303
 
302
304
  ### `toolFromDefinition()`
303
305
 
@@ -441,6 +443,18 @@ for (const serverName in resourcesByServer) {
441
443
  }
442
444
  ```
443
445
 
446
+ #### `resources.listWithErrors(options?)`
447
+
448
+ Preserves successful resources while reporting failed servers through legacy string `errors` and structured `errorDetails`. Pass `perServerTimeoutMs` to bound each server independently and include `durations`.
449
+
450
+ ```typescript
451
+ const { resources, errors, errorDetails, durations } = await mcpClient.resources.listWithErrors({
452
+ perServerTimeoutMs: 3_000,
453
+ })
454
+
455
+ console.log(resources, errors, errorDetails, durations)
456
+ ```
457
+
444
458
  #### `resources.templates()`
445
459
 
446
460
  Retrieves all available resource templates from all connected MCP servers, grouped by server name.
@@ -458,6 +472,15 @@ for (const serverName in templatesByServer) {
458
472
  }
459
473
  ```
460
474
 
475
+ #### `resources.templatesWithErrors(options?)`
476
+
477
+ Returns successful resource templates together with per-server string `errors`, structured `errorDetails`, and optional `durations`.
478
+
479
+ ```typescript
480
+ const { templates, errors, errorDetails } = await mcpClient.resources.templatesWithErrors()
481
+ console.log(templates, errors, errorDetails)
482
+ ```
483
+
461
484
  #### `resources.read(serverName: string, uri: string)`
462
485
 
463
486
  Reads the content of a specific resource from a server.
@@ -711,6 +734,15 @@ for (const serverName in promptsByServer) {
711
734
  }
712
735
  ```
713
736
 
737
+ #### `prompts.listWithErrors(options?)`
738
+
739
+ Returns successful prompts together with per-server string `errors`, structured `errorDetails`, and optional `durations`.
740
+
741
+ ```typescript
742
+ const { prompts, errors, errorDetails } = await mcpClient.prompts.listWithErrors()
743
+ console.log(prompts, errors, errorDetails)
744
+ ```
745
+
714
746
  #### `prompts.get({ serverName, name, args?, version? })`
715
747
 
716
748
  Retrieves a specific prompt and its messages from a server.
@@ -2,7 +2,7 @@
2
2
 
3
3
  # MongoDB vector store
4
4
 
5
- The `MongoDBVector` class provides vector search using [MongoDB Atlas Vector Search](https://www.mongodb.com/docs/atlas/atlas-vector-search/). It enables efficient similarity search and metadata filtering within your MongoDB collections.
5
+ The `MongoDBVector` class provides vector search using [MongoDB Vector Search](https://www.mongodb.com/docs/atlas/atlas-vector-search/). It enables efficient similarity search and metadata filtering within your MongoDB collections.
6
6
 
7
7
  ## Installation
8
8
 
@@ -89,11 +89,11 @@ Creates a new vector index (collection) in MongoDB.
89
89
 
90
90
  **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
91
91
 
92
- **filterFields** (`string[]`): Metadata field names to declare as filter fields in the Atlas vectorSearch index (registered as metadata.\<field>). Queries that filter only on declared fields are pushed directly into $vectorSearch instead of pre-filtering candidate \_ids, avoiding the 16 MB BSON limit on large result sets. Filters that reference an undeclared field, or use an operator $vectorSearch does not support, fall back to the pre-filter automatically.
92
+ **filterFields** (`string[]`): Metadata field names to declare as filter fields in the MongoDB vectorSearch index (registered as metadata.\<field>). Queries that filter only on declared fields are pushed directly into $vectorSearch instead of pre-filtering candidate \_ids, avoiding the 16 MB BSON limit on large result sets. Filters that reference an undeclared field, or use an operator $vectorSearch does not support, fall back to the pre-filter automatically.
93
93
 
94
94
  **collectionName** (`string`): Store the vectors on an existing (operational) collection instead of a managed collection named after the index. The collection is never created or dropped by this store when set. Defaults to indexName.
95
95
 
96
- **searchIndexName** (`string`): Name for the Atlas vectorSearch index created on the collection. Defaults to ${indexName}\_vector\_index.
96
+ **searchIndexName** (`string`): Name for the MongoDB vectorSearch index created on the collection. Defaults to ${indexName}\_vector\_index.
97
97
 
98
98
  **allowWrites** (`boolean`): Opt-in to write operations (upsert, updateVector, deleteVector, deleteVectors) on a bring-your-own collection. By default a BYO index is read-only: the store never modifies or deletes caller-owned operational documents. Ignored for managed collections, which are always writable. The policy is persisted with the index registration and survives restarts. (Default: `false`)
99
99
 
@@ -143,7 +143,7 @@ Searches for similar vectors with optional metadata filtering.
143
143
 
144
144
  ### `createSearchIndex()`
145
145
 
146
- Provisions an Atlas Search (BM25/full-text) index on the collection backing an index and records it as the text-search index that `textQuery()` and `hybridQuery()` will target.
146
+ Provisions a MongoDB Search (BM25/full-text) index on the collection backing an index and records it as the text-search index that `textQuery()` and `hybridQuery()` will target.
147
147
 
148
148
  **Managed vs. bring-your-own collections:**
149
149
 
@@ -159,7 +159,7 @@ Naming:
159
159
 
160
160
  **fields** (`string[]`): Field names to index for full-text search. Omit for dynamic mapping (all string fields).
161
161
 
162
- **searchIndexName** (`string`): Name for the Atlas Search index. When fields is provided and this is omitted, a distinct default name that is unique per logical index is used, so the field mapping is not shadowed by the auto-created dynamic index and two logical indexes on the same collection do not collide. (Default: ``${collectionName}_search_index (or ${collectionName}_${indexName}_search_fields_index when `fields` is given)``)
162
+ **searchIndexName** (`string`): Name for the MongoDB Search index. When fields is provided and this is omitted, a distinct default name that is unique per logical index is used, so the field mapping is not shadowed by the auto-created dynamic index and two logical indexes on the same collection do not collide. (Default: ``${collectionName}_search_index (or ${collectionName}_${indexName}_search_fields_index when `fields` is given)``)
163
163
 
164
164
  **waitUntilReady** (`boolean`): When true, block until the provisioned full-text index reports READY before resolving. Defaults to false to avoid surprising latency; call waitForSearchIndexReady() explicitly if you prefer to await separately. (Default: `false`)
165
165
 
@@ -174,7 +174,7 @@ The field-mapped index name includes the logical `indexName`, so two logical ind
174
174
 
175
175
  ### `waitForSearchIndexReady()`
176
176
 
177
- Waits for the full-text (BM25) search index of an index to become READY. `waitForIndexReady()` polls only the vectorSearch index; `createSearchIndex()` returns while the Atlas Search full-text index is still building, so an immediate `textQuery()`/`hybridQuery()` can intermittently fail. Call this (or pass `waitUntilReady: true` to `createSearchIndex()`) to block until the resolved text index reports READY.
177
+ Waits for the full-text (BM25) search index of an index to become READY. `waitForIndexReady()` polls only the vectorSearch index; `createSearchIndex()` returns while the MongoDB Search full-text index is still building, so an immediate `textQuery()`/`hybridQuery()` can intermittently fail. Call this (or pass `waitUntilReady: true` to `createSearchIndex()`) to block until the resolved text index reports READY.
178
178
 
179
179
  **indexName** (`string`): Logical name of the index whose text index to wait for
180
180
 
@@ -191,7 +191,7 @@ await store.waitForSearchIndexReady({ indexName: 'precedents' })
191
191
 
192
192
  ### `textQuery()`
193
193
 
194
- Runs a full-text (BM25) search against an Atlas Search index. By default it targets the text-search index recorded for this index (set by `createSearchIndex()`, or the dynamic `${collectionName}_search_index` auto-created by `createIndex()`). Pass `searchIndexName` to target a specific index for this call.
194
+ Runs a full-text (BM25) search against a MongoDB Search index. By default it targets the text-search index recorded for this index (set by `createSearchIndex()`, or the dynamic `${collectionName}_search_index` auto-created by `createIndex()`). Pass `searchIndexName` to target a specific index for this call.
195
195
 
196
196
  Metadata filters here (like `hybridQuery()`) are applied via a `$match` stage. For the vector branch of `hybridQuery()`, filters on fields not declared via `filterFields` at index creation are transparently materialised as candidate `_id`s (the same fallback `query()` uses), so undeclared-field filters don't error.
197
197
 
@@ -220,7 +220,7 @@ const results = await store.textQuery({
220
220
 
221
221
  ### `hybridQuery()`
222
222
 
223
- Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion`. It requires MongoDB >= 8.0 and is generally available from 8.1. On 8.0.x, it may require a MongoDB support case for enablement. It runs where enabled, including Atlas 8.0.x. A full-text search index must exist: it's auto-created for managed indexes, but for a bring-your-own collection you must call `createSearchIndex()` first (opt-in).
223
+ Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion`. It requires MongoDB >= 8.0 and is generally available from 8.1. On 8.0.x, it may require a MongoDB support case for enablement. It runs where enabled, including MongoDB Atlas 8.0.x. A full-text search index must exist: it's auto-created for managed indexes, but for a bring-your-own collection you must call `createSearchIndex()` first (opt-in).
224
224
 
225
225
  **indexName** (`string`): Name of the Mastra index to search
226
226
 
@@ -253,7 +253,7 @@ const results = await store.hybridQuery({
253
253
  })
254
254
  ```
255
255
 
256
- `hybridQuery()` requires MongoDB >= 8.0 for the `$rankFusion` stage. The stage is generally available from 8.1. On 8.0.x, it may need a MongoDB support case to enable and runs where enabled, such as Atlas 8.0.x. If you're running an older version, or `$rankFusion` isn't enabled on your 8.0.x deployment, use `query()` and `textQuery()` separately and merge the results client-side.
256
+ `hybridQuery()` requires MongoDB >= 8.0 for the `$rankFusion` stage. The stage is generally available from 8.1. On 8.0.x, it may need a MongoDB support case to enable and runs where enabled, such as MongoDB Atlas 8.0.x. If you're running an older version, or `$rankFusion` isn't enabled on your 8.0.x deployment, use `query()` and `textQuery()` separately and merge the results client-side.
257
257
 
258
258
  ### `describeIndex()`
259
259
 
@@ -276,7 +276,7 @@ interface IndexStats {
276
276
  Deletes a vector index. Behavior depends on how the index was created:
277
277
 
278
278
  - **Managed index** (created without `collectionName`): drops the entire collection and all its data.
279
- - **Bring-your-own index** (created with `collectionName`): drops the Atlas vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
279
+ - **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
280
280
 
281
281
  The BYO classification is recorded durably when the index is created, so it's applied correctly even by a different process (e.g. an index created by a setup job and later deleted by a long-lived service). Always pass the **logical index name** (the `indexName` used at `createIndex`), not the physical collection name.
282
282
 
@@ -429,7 +429,7 @@ await store.createSearchIndex({ indexName: 'precedents', fields: ['note'] })
429
429
 
430
430
  Embeddings are numeric vectors used by memory's `semanticRecall` to retrieve related messages by meaning (not keywords).
431
431
 
432
- > **Note:** MongoDB Atlas Vector Search is recommended for production use. For self-hosted deployments, Vector Search is available with [local Atlas deployments via the Atlas CLI](https://www.mongodb.com/docs/atlas/cli/current/atlas-cli-deploy-local/).
432
+ > **Note:** MongoDB Vector Search is recommended for production use. For self-hosted deployments, Vector Search is available with [local Atlas deployments via the Atlas CLI](https://www.mongodb.com/docs/atlas/cli/current/atlas-cli-deploy-local/).
433
433
 
434
434
  This setup uses FastEmbed, a local embedding model, to generate vector embeddings. To use this, install `@mastra/fastembed`:
435
435
 
@@ -173,6 +173,8 @@ interface PGIndexStats {
173
173
  }
174
174
  ```
175
175
 
176
+ `count` is an exact `SELECT COUNT(*)`, which scans the whole table, so avoid calling `describeIndex()` on a hot path for a large index. Reads and writes never pay for it: they only use the index metadata, which comes from the Postgres catalog.
177
+
176
178
  ### `deleteIndex()`
177
179
 
178
180
  **indexName** (`string`): Name of the index to delete
@@ -54,6 +54,8 @@ const response = await agent.generate('Run npm install')
54
54
 
55
55
  **nativeSandbox** (`NativeSandboxConfig`): Configuration for native sandboxing (see NativeSandboxConfig below).
56
56
 
57
+ `start()` reports `{ outcome: 'created' }` when the working directory didn't exist yet and `{ outcome: 'connected' }` when it reattaches to an existing directory. See [`start()`](https://mastra.ai/reference/workspace/sandbox) for the shared contract.
58
+
57
59
  ## `NativeSandboxConfig`
58
60
 
59
61
  Configuration options for native OS sandboxing (used with `isolation: 'seatbelt'` or `'bwrap'`).
@@ -118,6 +118,8 @@ const result = await sandbox.executeCommand('cat', ['/workspace/state.json'])
118
118
 
119
119
  When `sandboxId` is set, `environmentId` isn't required because the sandbox already exists.
120
120
 
121
+ `start()` reports `{ outcome: 'connected' }` on reattach and `{ outcome: 'created' }` on a fresh provision (including a checkpoint-recovered boot, which is a new VM even when its filesystem was restored). See [`start()`](https://mastra.ai/reference/workspace/sandbox) for the shared contract.
122
+
121
123
  ### Checkpoint recovery
122
124
 
123
125
  The constructor `id` (explicit or auto-generated) is sent to the platform on `POST /sandbox` as an advisory recovery key:
@@ -226,7 +228,7 @@ console.log(result.exitCode)
226
228
 
227
229
  ## Methods
228
230
 
229
- **start** (`() => Promise<void>`): Provision the remote sandbox, or reattach when sandboxId was passed to the constructor. Idempotent once the sandbox is running. A destroyed reattach target falls through to a fresh provision.
231
+ **start** (`() => Promise<SandboxStartResult>`): Provision the remote sandbox, or reattach when sandboxId was passed to the constructor. Idempotent once the sandbox is running. A destroyed reattach target falls through to a fresh provision.
230
232
 
231
233
  **destroy** (`() => Promise<void>`): Tear down the remote sandbox and clear the cached exec lease. A subsequent start() provisions a fresh sandbox (or restores from checkpoint when a stable id is set).
232
234