@mastra/mcp-docs-server 1.2.7-alpha.12 → 1.2.7-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.
Files changed (166) hide show
  1. package/.docs/docs/agent-builder/integrations.md +2 -44
  2. package/.docs/docs/agent-builder/overview.md +3 -4
  3. package/.docs/docs/agent-builder/skill-registries.md +3 -1
  4. package/.docs/docs/agent-controller/overview.md +2 -3
  5. package/.docs/docs/agent-controller/session.md +3 -1
  6. package/.docs/docs/agents/a2a.md +1 -2
  7. package/.docs/docs/agents/channels.md +225 -0
  8. package/.docs/docs/agents/code-mode.md +1 -1
  9. package/.docs/docs/agents/file-based-agents.md +297 -0
  10. package/.docs/docs/agents/guardrails.md +9 -10
  11. package/.docs/docs/agents/overview.md +4 -4
  12. package/.docs/docs/agents/skills.md +5 -3
  13. package/.docs/docs/agents/structured-output.md +1 -1
  14. package/.docs/docs/agents/supervisor-agents.md +4 -3
  15. package/.docs/docs/agents/using-tools.md +4 -2
  16. package/.docs/docs/browser/agent-browser.md +3 -1
  17. package/.docs/docs/browser/browser-viewer.md +3 -1
  18. package/.docs/docs/browser/overview.md +1 -2
  19. package/.docs/docs/browser/stagehand.md +1 -1
  20. package/.docs/docs/deployment/mastra-server.md +4 -2
  21. package/.docs/docs/editor/overview.md +6 -2
  22. package/.docs/docs/editor/prompts.md +1 -1
  23. package/.docs/docs/editor/tools.md +5 -3
  24. package/.docs/docs/evals/custom-scorers.md +3 -1
  25. package/.docs/docs/evals/datasets/overview.md +5 -4
  26. package/.docs/docs/evals/datasets/running-experiments.md +2 -4
  27. package/.docs/docs/evals/evals-with-memory.md +3 -1
  28. package/.docs/docs/evals/gates-and-verdicts.md +3 -1
  29. package/.docs/docs/evals/overview.md +1 -4
  30. package/.docs/docs/evals/quick-checks.md +3 -1
  31. package/.docs/docs/long-running-agents/background-tasks.md +1 -1
  32. package/.docs/docs/long-running-agents/durable-agents.md +5 -3
  33. package/.docs/docs/long-running-agents/goals.md +3 -1
  34. package/.docs/docs/long-running-agents/signal-providers.md +3 -1
  35. package/.docs/docs/long-running-agents/signals.md +22 -11
  36. package/.docs/docs/mastra-platform/observability.md +1 -5
  37. package/.docs/docs/mcp/mcp-apps.md +3 -3
  38. package/.docs/docs/mcp/overview.md +10 -6
  39. package/.docs/docs/memory/observational-memory.md +1 -2
  40. package/.docs/docs/memory/overview.md +4 -6
  41. package/.docs/docs/memory/semantic-recall.md +1 -1
  42. package/.docs/docs/memory/working-memory.md +3 -3
  43. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +3 -1
  44. package/.docs/docs/observability/logging.md +1 -1
  45. package/.docs/docs/observability/tracing/overview.md +1 -1
  46. package/.docs/docs/server/auth/auth0.md +1 -1
  47. package/.docs/docs/server/auth/better-auth.md +2 -2
  48. package/.docs/docs/server/auth/clerk.md +1 -1
  49. package/.docs/docs/server/auth/firebase.md +1 -1
  50. package/.docs/docs/server/auth/google.md +2 -2
  51. package/.docs/docs/server/auth/jwt.md +2 -2
  52. package/.docs/docs/server/auth/okta.md +2 -2
  53. package/.docs/docs/server/auth/workos.md +1 -1
  54. package/.docs/docs/server/mastra-client.md +1 -1
  55. package/.docs/docs/server/mastra-server.md +1 -1
  56. package/.docs/docs/server/pubsub.md +1 -1
  57. package/.docs/docs/server/request-context.md +4 -4
  58. package/.docs/docs/server/server-adapters.md +8 -8
  59. package/.docs/docs/studio/auth.md +3 -1
  60. package/.docs/docs/studio/overview.md +1 -1
  61. package/.docs/docs/voice/livekit.md +3 -100
  62. package/.docs/docs/workflows/agents-and-tools.md +5 -3
  63. package/.docs/docs/workflows/control-flow.md +3 -1
  64. package/.docs/docs/workflows/overview.md +7 -6
  65. package/.docs/docs/workspace/overview.md +1 -2
  66. package/.docs/docs/workspace/sandbox.md +0 -2
  67. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  68. package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
  69. package/.docs/guides/concepts/streaming.md +3 -3
  70. package/.docs/guides/getting-started/quickstart.md +1 -3
  71. package/.docs/guides/guide/chef-michel.md +2 -0
  72. package/.docs/guides/guide/slack-assistant.md +2 -2
  73. package/.docs/guides/guide/stock-agent.md +2 -0
  74. package/.docs/models/environment-variables.md +0 -7
  75. package/.docs/models/gateways/netlify.md +1 -4
  76. package/.docs/models/gateways/openrouter.md +7 -10
  77. package/.docs/models/gateways/vercel.md +1 -8
  78. package/.docs/models/index.md +1 -1
  79. package/.docs/models/providers/abacus.md +14 -44
  80. package/.docs/models/providers/google.md +1 -2
  81. package/.docs/models/providers/llmgateway.md +181 -185
  82. package/.docs/models/providers/nano-gpt.md +2 -2
  83. package/.docs/models/providers/neon.md +29 -40
  84. package/.docs/models/providers/nvidia.md +3 -1
  85. package/.docs/models/providers/openai.md +1 -6
  86. package/.docs/models/providers/opencode.md +2 -6
  87. package/.docs/models/providers/poolside.md +5 -6
  88. package/.docs/models/providers/routing-run.md +34 -23
  89. package/.docs/models/providers/the-grid-ai.md +3 -3
  90. package/.docs/models/providers/wandb.md +14 -21
  91. package/.docs/models/providers/xai.md +1 -2
  92. package/.docs/models/providers.md +0 -7
  93. package/.docs/reference/agents/channels.md +2 -2
  94. package/.docs/reference/channels/channel-provider.md +1 -1
  95. package/.docs/reference/channels/slack-provider.md +2 -2
  96. package/.docs/reference/cli/mastra.md +10 -117
  97. package/.docs/reference/evals/create-scorer.md +0 -8
  98. package/.docs/reference/index.md +0 -17
  99. package/.docs/reference/memory/memory-class.md +1 -1
  100. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  101. package/.docs/reference/project-structure.md +1 -1
  102. package/.docs/reference/pubsub/lease-provider.md +1 -1
  103. package/.docs/reference/server/express-adapter.md +3 -1
  104. package/.docs/reference/server/fastify-adapter.md +3 -1
  105. package/.docs/reference/server/hono-adapter.md +3 -1
  106. package/.docs/reference/server/koa-adapter.md +3 -1
  107. package/.docs/reference/server/nestjs-adapter.md +3 -1
  108. package/.docs/reference/storage/clickhouse.md +0 -32
  109. package/.docs/reference/storage/composite.md +1 -27
  110. package/.docs/reference/storage/retention.md +0 -11
  111. package/.docs/reference/tools/mcp-client.md +0 -22
  112. package/.docs/reference/tools/mcp-server.md +4 -161
  113. package/.docs/reference/voice/livekit.md +8 -272
  114. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +3 -1
  115. package/.docs/reference/workspace/agentfs-filesystem.md +3 -1
  116. package/.docs/reference/workspace/apple-container-sandbox.md +3 -1
  117. package/.docs/reference/workspace/archil-filesystem.md +3 -1
  118. package/.docs/reference/workspace/azure-blob-filesystem.md +3 -1
  119. package/.docs/reference/workspace/blaxel-sandbox.md +3 -1
  120. package/.docs/reference/workspace/daytona-sandbox.md +3 -1
  121. package/.docs/reference/workspace/docker-sandbox.md +3 -1
  122. package/.docs/reference/workspace/e2b-sandbox.md +3 -1
  123. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -1
  124. package/.docs/reference/workspace/gcs-filesystem.md +3 -1
  125. package/.docs/reference/workspace/google-drive-filesystem.md +3 -1
  126. package/.docs/reference/workspace/local-filesystem.md +3 -1
  127. package/.docs/reference/workspace/local-sandbox.md +3 -1
  128. package/.docs/reference/workspace/modal-sandbox.md +3 -1
  129. package/.docs/reference/workspace/railway-sandbox.md +3 -1
  130. package/.docs/reference/workspace/s3-filesystem.md +3 -1
  131. package/.docs/reference/workspace/vercel-sandbox.md +7 -5
  132. package/.docs/reference/workspace/vercel-serverless.md +3 -1
  133. package/CHANGELOG.md +0 -29
  134. package/package.json +5 -5
  135. package/.docs/docs/capabilities/channels/discord.md +0 -98
  136. package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
  137. package/.docs/docs/capabilities/channels/overview.md +0 -255
  138. package/.docs/docs/capabilities/channels/slack.md +0 -225
  139. package/.docs/docs/capabilities/channels/teams.md +0 -100
  140. package/.docs/docs/capabilities/channels/telegram.md +0 -98
  141. package/.docs/docs/capabilities/channels/whatsapp.md +0 -99
  142. package/.docs/docs/getting-started/file-based-agents.md +0 -116
  143. package/.docs/models/providers/crossmodel.md +0 -109
  144. package/.docs/models/providers/empiriolabs.md +0 -106
  145. package/.docs/models/providers/meta.md +0 -101
  146. package/.docs/models/providers/model-oracle-ai.md +0 -87
  147. package/.docs/models/providers/pioneer.md +0 -148
  148. package/.docs/models/providers/unorouter.md +0 -95
  149. package/.docs/models/providers/zenifra.md +0 -73
  150. package/.docs/reference/file-based-agents/config.md +0 -97
  151. package/.docs/reference/file-based-agents/instructions.md +0 -54
  152. package/.docs/reference/file-based-agents/logger.md +0 -26
  153. package/.docs/reference/file-based-agents/memory.md +0 -58
  154. package/.docs/reference/file-based-agents/observability.md +0 -32
  155. package/.docs/reference/file-based-agents/processors.md +0 -56
  156. package/.docs/reference/file-based-agents/scorers.md +0 -54
  157. package/.docs/reference/file-based-agents/server.md +0 -37
  158. package/.docs/reference/file-based-agents/skills.md +0 -56
  159. package/.docs/reference/file-based-agents/storage.md +0 -30
  160. package/.docs/reference/file-based-agents/studio.md +0 -56
  161. package/.docs/reference/file-based-agents/subagents.md +0 -123
  162. package/.docs/reference/file-based-agents/tools.md +0 -63
  163. package/.docs/reference/file-based-agents/workflows.md +0 -52
  164. package/.docs/reference/file-based-agents/workspace.md +0 -74
  165. package/.docs/reference/memory/summarizeConversation.md +0 -99
  166. package/.docs/reference/memory/summarizeThread.md +0 -93
@@ -37,7 +37,7 @@ export const agent = new Agent({
37
37
 
38
38
  **options** (`MemoryConfig`): Memory configuration options.
39
39
 
40
- **options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable the message history feature entirely (messages are not loaded into context or saved). Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To load messages without saving new ones, use the readOnly option.
40
+ **options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable loading conversation history into context. Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To prevent saving new messages, use the readOnly option instead.
41
41
 
42
42
  **options.readOnly** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory.
43
43
 
@@ -38,7 +38,7 @@ new MastraEditor({
38
38
 
39
39
  **options.readOnly** (`boolean`): Treat memory as read-only — no new messages are stored.
40
40
 
41
- **options.lastMessages** (`number | false`): Number of recent messages to include in context, or false to disable message history entirely (messages are not loaded or saved).
41
+ **options.lastMessages** (`number | false`): Number of recent messages to include in context, or false to disable.
42
42
 
43
43
  **options.semanticRecall** (`boolean | SemanticRecall`): Semantic recall configuration. See the Memory class reference for the full shape.
44
44
 
@@ -44,7 +44,7 @@ Mastra recommends organizing your code into the following folders:
44
44
 
45
45
  Mastra has two special folder conventions:
46
46
 
47
- - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/getting-started/file-based-agents) docs.
47
+ - `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [file-based agents](https://mastra.ai/docs/agents/file-based-agents) guide.
48
48
  - `src/mastra/public`: Contents are copied into the `.build/output` directory during the build process, making them available for serving at runtime.
49
49
 
50
50
  ### Top-level files
@@ -130,4 +130,4 @@ When the configured pub/sub backend doesn't implement `LeaseProvider`, the runti
130
130
  - [PubSub](https://mastra.ai/reference/pubsub/base): The event delivery contract, separate from leasing
131
131
  - [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams): The built-in backend that implements `LeaseProvider`
132
132
  - [Signals](https://mastra.ai/docs/long-running-agents/signals): The runtime that uses leasing to coordinate thread runs across processes
133
- - [Channels](https://mastra.ai/docs/capabilities/channels/overview): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
133
+ - [Channels](https://mastra.ai/docs/agents/channels): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Express adapter
4
4
 
5
- The `@mastra/express` package provides a server adapter for running Mastra with [Express](https://expressjs.com). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/express` package provides a server adapter for running Mastra with [Express](https://expressjs.com).
6
+
7
+ > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
6
8
 
7
9
  ## Installation
8
10
 
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Fastify adapter
4
4
 
5
- The `@mastra/fastify` package provides a server adapter for running Mastra with [Fastify](https://fastify.dev). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/fastify` package provides a server adapter for running Mastra with [Fastify](https://fastify.dev).
6
+
7
+ > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
6
8
 
7
9
  ## Installation
8
10
 
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Hono adapter
4
4
 
5
- The `@mastra/hono` package provides a server adapter for running Mastra with [Hono](https://hono.dev). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/hono` package provides a server adapter for running Mastra with [Hono](https://hono.dev).
6
+
7
+ > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
6
8
 
7
9
  ## Installation
8
10
 
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Koa adapter
4
4
 
5
- The `@mastra/koa` package provides a server adapter for running Mastra with [Koa](https://koajs.com). For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
5
+ The `@mastra/koa` package provides a server adapter for running Mastra with [Koa](https://koajs.com).
6
+
7
+ > **Info:** For general adapter concepts (constructor options, initialization flow, etc.), see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
6
8
 
7
9
  ## Installation
8
10
 
@@ -4,7 +4,9 @@
4
4
 
5
5
  The `@mastra/nestjs` package provides a NestJS module for running Mastra with the Express-based NestJS platform.
6
6
 
7
- It's intentionally Express-only for v1. If Nest is bootstrapped with a different HTTP adapter, `MastraModule` throws during startup instead of attempting a partial integration. For general adapter concepts, see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
7
+ It's intentionally Express-only for v1. If Nest is bootstrapped with a different HTTP adapter, `MastraModule` throws during startup instead of attempting a partial integration.
8
+
9
+ > **Info:** For general adapter concepts, see [Server Adapters](https://mastra.ai/docs/server/server-adapters).
8
10
 
9
11
  ## Installation
10
12
 
@@ -101,38 +101,6 @@ const observabilityStore = new ObservabilityStorageClickhouse({
101
101
 
102
102
  New projects should use `ObservabilityStorageClickhouseVNext` instead.
103
103
 
104
- ### Migrating from legacy to vNext
105
-
106
- To migrate historical spans from the legacy `mastra_ai_spans` table to the vNext schema, run:
107
-
108
- **npm**:
109
-
110
- ```bash
111
- npx mastra migrate
112
- ```
113
-
114
- **pnpm**:
115
-
116
- ```bash
117
- pnpm dlx mastra migrate
118
- ```
119
-
120
- **Yarn**:
121
-
122
- ```bash
123
- yarn dlx mastra migrate
124
- ```
125
-
126
- **Bun**:
127
-
128
- ```bash
129
- bun x mastra migrate
130
- ```
131
-
132
- The migration copies span data from `mastra_ai_spans` into `mastra_span_events` in day-sized batches. It handles column mapping, deduplicates legacy rows, and preserves the original table as a backup. After migration, traces appear in Studio through the vNext adapter.
133
-
134
- > **Note:** The legacy table is not deleted. Drop it manually after verifying the migration.
135
-
136
104
  ### ClickHouse for every domain
137
105
 
138
106
  `ClickhouseStoreVNext` backs the `memory`, `workflows`, and `observability` domains with ClickHouse and uses the vNext observability adapter automatically. Use it when you want ClickHouse to back the entire application without wiring a composite store manually.
@@ -156,32 +156,6 @@ export const mastra = new Mastra({
156
156
  })
157
157
  ```
158
158
 
159
- ### Disabling a domain
160
-
161
- Set a domain to `false` to disable it. A disabled domain doesn't fall back to `default`, so data for that domain isn't persisted:
162
-
163
- ```typescript
164
- import { MastraCompositeStore } from '@mastra/core/storage'
165
- import { PostgresStore } from '@mastra/pg'
166
- import { Mastra } from '@mastra/core'
167
-
168
- const pgStore = new PostgresStore({
169
- id: 'pg',
170
- connectionString: process.env.DATABASE_URL,
171
- })
172
-
173
- export const mastra = new Mastra({
174
- storage: new MastraCompositeStore({
175
- id: 'composite',
176
- default: pgStore,
177
- domains: {
178
- // don't persist traces and spans
179
- observability: false,
180
- },
181
- }),
182
- })
183
- ```
184
-
185
159
  ## Options
186
160
 
187
161
  **id** (`string`): Unique identifier for this storage instance.
@@ -190,7 +164,7 @@ export const mastra = new Mastra({
190
164
 
191
165
  **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
192
166
 
193
- **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage. Set a domain to false to disable it entirely; a disabled domain does not fall back to editor or default.
167
+ **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage.
194
168
 
195
169
  **domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
196
170
 
@@ -105,8 +105,6 @@ Deletes rows older than their configured `maxAge` across every domain that has a
105
105
 
106
106
  `prune()` is designed to be safe on tables with millions of rows. It deletes in bounded, batched chunks — each batch is its own transaction — so it never takes a long lock or bloats the transaction log. It never runs a `VACUUM`.
107
107
 
108
- Pass `options.retention` to replace the configured policies for that call only — for example to skip a domain (keep chat history) or prune more aggressively than the standing config. The store's configured `retention` is unchanged.
109
-
110
108
  Anchor-column indexes are created lazily on the first `prune()` call for each table with a policy — never at `init()` — so deployments that don't configure retention pay no extra index write or disk overhead. The first prune of an existing large table pays a one-time index build; subsequent prunes reuse the index.
111
109
 
112
110
  ```typescript
@@ -118,13 +116,6 @@ const results = await storage.prune({
118
116
  for (const r of results) {
119
117
  console.log(`${r.domain}.${r.table}: deleted ${r.deleted}, done=${r.done}`)
120
118
  }
121
-
122
- // One-off pass with different policies (configured retention untouched):
123
- await storage.prune({
124
- retention: {
125
- observability: { spans: { maxAge: '1d' } },
126
- },
127
- })
128
119
  ```
129
120
 
130
121
  Returns: `Promise<PruneResult[]>`
@@ -139,8 +130,6 @@ Returns: `Promise<PruneResult[]>`
139
130
 
140
131
  **signal** (`AbortSignal`): Cooperative cancellation. The batch loop checks it between batches and stops cleanly, returning partial results with done: false.
141
132
 
142
- **retention** (`RetentionConfig`): Replaces the store's configured retention policies for this call only — e.g. to skip a domain or prune more aggressively. The configured retention is unchanged.
143
-
144
133
  ##### PruneResult
145
134
 
146
135
  Each result describes one table's progress:
@@ -601,28 +601,6 @@ mcpClient.prompts.onListChanged('myWeatherServer', () => {
601
601
  })
602
602
  ```
603
603
 
604
- ### `tools` Property
605
-
606
- The `MCPClient` instance has a `tools` property for subscribing to tool list change notifications. To fetch tools, use `listTools()` or `listToolsets()`.
607
-
608
- #### `tools.onListChanged(serverName: string, handler: () => void)`
609
-
610
- Sets a notification handler that will be called when the list of available tools changes on a specific server (for example, when the server adds or removes tools at runtime).
611
-
612
- ```typescript
613
- async onListChanged(serverName: string, handler: () => void): Promise<void>
614
- ```
615
-
616
- Example:
617
-
618
- ```typescript
619
- await mcpClient.tools.onListChanged('myWeatherServer', async () => {
620
- console.log('Tool list changed on myWeatherServer.')
621
- // You should re-fetch the tools
622
- // const tools = await mcpClient.listTools();
623
- })
624
- ```
625
-
626
604
  ### `progress` Property
627
605
 
628
606
  The `MCPClient` instance has a `progress` property for subscribing to progress notifications emitted by MCP servers while tools execute.
@@ -399,31 +399,12 @@ serve(async req => {
399
399
  >
400
400
  > The serverless mode disables session management and creates fresh server instances per request, which is necessary for stateless environments where memory doesn't persist between invocations.
401
401
  >
402
- > By default, serverless mode buffers each request into a single JSON response, so `notifications/progress` sent by a tool never reach the client. Set `serverlessStreaming: true` to handle the request with request-scoped SSE streaming instead, which delivers progress notifications before the final result:
403
- >
404
- > ```typescript
405
- > await server.startHTTP({
406
- > url,
407
- > httpPath: '/mcp',
408
- > req: nodeReq,
409
- > res: nodeRes,
410
- > options: {
411
- > serverless: true,
412
- > serverlessStreaming: true, // ← Stream request-scoped notifications/progress
413
- > },
414
- > })
415
- > ```
416
- >
417
- > This is still stateless: no `mcp-session-id` is required or persisted. It only enables notifications scoped to the current request (such as progress). The session-dependent features below remain unavailable.
418
- >
419
- > **Note:** The following MCP features require session state or persistent connections and **won't work** in serverless mode (including with `serverlessStreaming: true`):
402
+ > **Note:** The following MCP features require session state or persistent connections and **won't work** in serverless mode:
420
403
  >
421
404
  > - **Elicitation** - Interactive user input requests during tool execution require session management to route responses back to the correct client
422
405
  > - **Resource subscriptions** - `resources/subscribe` and `resources/unsubscribe` need persistent connections to maintain subscription state
423
406
  > - **Resource update notifications** - `resources.notifyUpdated()` requires active subscriptions and persistent connections to notify clients
424
407
  > - **Prompt list change notifications** - `prompts.notifyListChanged()` requires persistent connections to push updates to clients
425
- > - **Tool list change notifications** - `toolActions.notifyListChanged()` requires persistent connections to push updates to clients
426
- > - **Server log notifications** - `sendLoggingMessage()` requires persistent connections to push log messages to clients
427
408
  >
428
409
  > These features work normally in long-lived server environments (Node.js servers, Docker containers, etc.).
429
410
 
@@ -443,8 +424,6 @@ The `StreamableHTTPServerTransportOptions` object allows you to customize the be
443
424
 
444
425
  **serverless** (`boolean`): If true, runs in stateless mode without session management. Each request is handled independently with a fresh server instance. Essential for serverless environments (Cloudflare Workers, Supabase Edge Functions, Vercel Edge, etc.) where sessions cannot persist between invocations. Defaults to false.
445
426
 
446
- **serverlessStreaming** (`boolean`): If true, serverless requests use request-scoped SSE streaming instead of a buffered JSON response, allowing in-request notifications/progress to reach the client before the final result. Only takes effect together with serverless: true. Defaults to false (buffered JSON responses), which preserves backward-compatible behavior. This enables only request-scoped notifications such as progress; elicitation, subscriptions, and out-of-request notifications still require session state.
447
-
448
427
  **sessionIdGenerator** (`(() => string) | undefined`): A function that generates a unique session ID. This should be a cryptographically secure, globally unique string. Return undefined to disable session management.
449
428
 
450
429
  **onsessioninitialized** (`(sessionId: string) => void`): A callback that is invoked when a new session is initialized. This is useful for tracking active MCP sessions.
@@ -797,144 +776,6 @@ await serverWithPrompts.prompts.notifyListChanged()
797
776
  - Handle errors with informative messages.
798
777
  - Document argument expectations and available versions.
799
778
 
800
- ## Dynamic tool management
801
-
802
- Tools are usually provided when constructing the `MCPServer`, but you can also add or remove tools while the server is running. The server exposes these operations through the `toolActions` property. When the tool list changes, connected clients receive a `notifications/tools/list_changed` message prompting them to re-fetch the tool list.
803
-
804
- The property is named `toolActions` because `tools()` is the method that returns the registered tool registry.
805
-
806
- ### `toolActions.add(tools)`
807
-
808
- Registers new tools on the running server and notifies connected clients. Tools are keyed by their record key, the same as tools passed to the constructor. Adding a tool under an existing key replaces it.
809
-
810
- ```typescript
811
- async server.toolActions.add(tools: ToolsInput): Promise<void>
812
- ```
813
-
814
- Example:
815
-
816
- ```typescript
817
- import { createTool } from '@mastra/core/tools'
818
- import { z } from 'zod'
819
-
820
- const searchTool = createTool({
821
- id: 'search',
822
- description: 'Searches the knowledge base.',
823
- inputSchema: z.object({ query: z.string() }),
824
- execute: async ({ query }) => ({ results: [] }),
825
- })
826
-
827
- await server.toolActions.add({ searchTool })
828
- ```
829
-
830
- ### `toolActions.remove(toolIds)`
831
-
832
- Removes tools from the running server by tool ID and notifies connected clients. Unknown tool IDs are ignored. If no tools were removed, no notification is sent.
833
-
834
- ```typescript
835
- async server.toolActions.remove(toolIds: string[]): Promise<void>
836
- ```
837
-
838
- Example:
839
-
840
- ```typescript
841
- await server.toolActions.remove(['searchTool'])
842
- ```
843
-
844
- ### `toolActions.notifyListChanged()`
845
-
846
- Sends a `notifications/tools/list_changed` message to connected clients without modifying the tool registry. Call this when tool availability changes through other means (for example, authorization changes).
847
-
848
- ```typescript
849
- async server.toolActions.notifyListChanged(): Promise<void>
850
- ```
851
-
852
- ### Mastra registry synchronization
853
-
854
- When the server is registered with a Mastra instance, `toolActions.add()` and `toolActions.remove()` also update the Mastra instance's tool registry, matching the automatic tool registration that happens at startup. Added tools become available through `mastra.listTools()` (keyed by the tool's intrinsic `id` when present), and removed tools are deleted from the registry.
855
-
856
- ## Logging
857
-
858
- MCP servers can send structured log messages to clients using `notifications/message`. Clients control verbosity by sending a `logging/setLevel` request; the server drops messages below the requested minimum level (following RFC 5424 severity ordering). The level is tracked per session, so different clients can request different verbosity.
859
-
860
- ### `sendLoggingMessage()`
861
-
862
- Sends a log notification to all connected clients, honoring each client's minimum logging level.
863
-
864
- ```typescript
865
- async server.sendLoggingMessage(params: {
866
- level: LoggingLevel;
867
- data: unknown;
868
- logger?: string;
869
- }): Promise<void>
870
- ```
871
-
872
- Example:
873
-
874
- ```typescript
875
- await server.sendLoggingMessage({
876
- level: 'info',
877
- data: { message: 'Sync completed', itemsProcessed: 42 },
878
- })
879
- ```
880
-
881
- ### `context.mcp.log()`
882
-
883
- Inside a tool's `execute` function, use `context.mcp.log()` to send a log message to the client that called the tool.
884
-
885
- ```typescript
886
- async context.mcp.log(
887
- level: LoggingLevel,
888
- message: string,
889
- data?: Record<string, unknown>
890
- ): Promise<void>
891
- ```
892
-
893
- Example:
894
-
895
- ```typescript
896
- execute: async ({ location }, context) => {
897
- await context.mcp.log('debug', 'Fetching weather', { location })
898
- const weather = await fetchWeather(location)
899
- await context.mcp.log('info', 'Weather fetched')
900
- return weather
901
- }
902
- ```
903
-
904
- ## Progress notifications
905
-
906
- Long-running tools can report progress to the calling client with `notifications/progress`. Progress is only sent when the caller requested progress tracking by including a `progressToken` in the request (the Mastra `MCPClient` does this when `enableProgressTracking` is set). When no token was sent, `context.mcp.progress()` is a no-op.
907
-
908
- ### `context.mcp.progress()`
909
-
910
- ```typescript
911
- async context.mcp.progress(params: {
912
- progress: number;
913
- total?: number;
914
- message?: string;
915
- }): Promise<void>
916
- ```
917
-
918
- Example:
919
-
920
- ```typescript
921
- execute: async ({ items }, context) => {
922
- for (const [index, item] of items.entries()) {
923
- await processItem(item)
924
- await context.mcp.progress({
925
- progress: index + 1,
926
- total: items.length,
927
- message: `Processed ${item.name}`,
928
- })
929
- }
930
- return { done: true }
931
- }
932
- ```
933
-
934
- ## Notification delivery
935
-
936
- Notification methods (`resources.notifyListChanged()`, `prompts.notifyListChanged()`, `toolActions.notifyListChanged()`, and `sendLoggingMessage()`) broadcast to every connected client across all transports: the stdio/SSE connection and each streamable HTTP session. `resources.notifyUpdated()` is the exception: it only notifies clients that subscribed to the resource URI via `resources/subscribe`. Subscriptions are tracked per session for streamable HTTP clients; legacy SSE clients share the main server instance and therefore share one subscription set. Clients using the stateless serverless mode can't receive notifications because each request uses a transient server instance.
937
-
938
779
  ## Examples
939
780
 
940
781
  For practical examples of setting up and deploying an MCPServer, see the [Publishing an MCP Server guide](https://mastra.ai/guides/guide/publishing-mcp-server).
@@ -1561,7 +1402,9 @@ const server = new MCPServer({
1561
1402
  })
1562
1403
  ```
1563
1404
 
1564
- Link a tool to its app resource by setting `_meta.ui.resourceUri` on the tool to the matching `ui://` URI. The server auto-normalizes this metadata when registering tools. Visit [MCP Apps](https://mastra.ai/docs/mcp/mcp-apps) for the full app bridge API and usage patterns.
1405
+ Link a tool to its app resource by setting `_meta.ui.resourceUri` on the tool to the matching `ui://` URI. The server auto-normalizes this metadata when registering tools.
1406
+
1407
+ > **Note:** Visit [MCP Apps](https://mastra.ai/docs/mcp/mcp-apps) for the full app bridge API and usage patterns.
1565
1408
 
1566
1409
  ## Related information
1567
1410