@mastra/mcp-docs-server 1.0.0-beta.5 → 1.0.0-beta.6

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 (132) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +9 -9
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +67 -67
  3. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +26 -26
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +53 -53
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +26 -26
  6. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +27 -27
  7. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +29 -0
  8. package/.docs/organized/changelogs/%40mastra%2Fcore.md +274 -274
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +15 -15
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +12 -12
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +65 -65
  12. package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
  13. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +26 -26
  14. package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +52 -0
  15. package/.docs/organized/changelogs/%40mastra%2Fevals.md +12 -12
  16. package/.docs/organized/changelogs/%40mastra%2Flance.md +26 -26
  17. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +24 -24
  18. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +9 -9
  19. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +84 -84
  20. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +36 -36
  21. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +26 -26
  22. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +27 -27
  23. package/.docs/organized/changelogs/%40mastra%2Fpg.md +28 -28
  24. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +47 -47
  25. package/.docs/organized/changelogs/%40mastra%2Frag.md +43 -43
  26. package/.docs/organized/changelogs/%40mastra%2Freact.md +9 -0
  27. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  28. package/.docs/organized/changelogs/%40mastra%2Fserver.md +56 -56
  29. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +26 -26
  30. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +19 -19
  31. package/.docs/organized/changelogs/create-mastra.md +9 -9
  32. package/.docs/organized/changelogs/mastra.md +17 -17
  33. package/.docs/organized/code-examples/agui.md +1 -0
  34. package/.docs/organized/code-examples/ai-sdk-v5.md +1 -0
  35. package/.docs/organized/code-examples/mcp-server-adapters.md +721 -0
  36. package/.docs/organized/code-examples/server-app-access.md +342 -0
  37. package/.docs/raw/agents/agent-approval.mdx +189 -0
  38. package/.docs/raw/agents/guardrails.mdx +13 -9
  39. package/.docs/raw/agents/networks.mdx +1 -0
  40. package/.docs/raw/agents/overview.mdx +23 -58
  41. package/.docs/raw/agents/processors.mdx +279 -0
  42. package/.docs/raw/deployment/cloud-providers/index.mdx +19 -26
  43. package/.docs/raw/deployment/cloud-providers/netlify-deployer.mdx +44 -13
  44. package/.docs/raw/evals/running-in-ci.mdx +0 -2
  45. package/.docs/raw/{guides/getting-started → getting-started}/manual-install.mdx +2 -2
  46. package/.docs/raw/getting-started/start.mdx +1 -1
  47. package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +8 -0
  48. package/.docs/raw/guides/getting-started/quickstart.mdx +1 -1
  49. package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
  50. package/.docs/raw/guides/index.mdx +3 -35
  51. package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +11 -0
  52. package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +29 -0
  53. package/.docs/raw/index.mdx +1 -1
  54. package/.docs/raw/memory/memory-processors.mdx +265 -79
  55. package/.docs/raw/memory/working-memory.mdx +10 -2
  56. package/.docs/raw/observability/overview.mdx +0 -1
  57. package/.docs/raw/observability/tracing/bridges/otel.mdx +176 -0
  58. package/.docs/raw/observability/tracing/exporters/arize.mdx +17 -0
  59. package/.docs/raw/observability/tracing/exporters/braintrust.mdx +19 -0
  60. package/.docs/raw/observability/tracing/exporters/langfuse.mdx +20 -0
  61. package/.docs/raw/observability/tracing/exporters/langsmith.mdx +12 -0
  62. package/.docs/raw/observability/tracing/exporters/otel.mdx +5 -4
  63. package/.docs/raw/observability/tracing/overview.mdx +71 -6
  64. package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +0 -1
  65. package/.docs/raw/rag/retrieval.mdx +23 -6
  66. package/.docs/raw/rag/vector-databases.mdx +93 -2
  67. package/.docs/raw/reference/agents/generate.mdx +55 -6
  68. package/.docs/raw/reference/agents/network.mdx +44 -0
  69. package/.docs/raw/reference/client-js/memory.mdx +43 -0
  70. package/.docs/raw/reference/client-js/workflows.mdx +92 -63
  71. package/.docs/raw/reference/deployer/netlify.mdx +1 -2
  72. package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
  73. package/.docs/raw/reference/index.mdx +1 -0
  74. package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +150 -0
  75. package/.docs/raw/reference/observability/tracing/configuration.mdx +0 -4
  76. package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +4 -0
  77. package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +17 -1
  78. package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +6 -0
  79. package/.docs/raw/reference/observability/tracing/instances.mdx +0 -4
  80. package/.docs/raw/reference/observability/tracing/interfaces.mdx +29 -4
  81. package/.docs/raw/reference/observability/tracing/spans.mdx +0 -4
  82. package/.docs/raw/reference/processors/language-detector.mdx +9 -2
  83. package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
  84. package/.docs/raw/reference/processors/moderation-processor.mdx +10 -3
  85. package/.docs/raw/reference/processors/pii-detector.mdx +10 -3
  86. package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
  87. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +9 -2
  88. package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
  89. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
  90. package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
  91. package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
  92. package/.docs/raw/reference/storage/cloudflare-d1.mdx +37 -0
  93. package/.docs/raw/reference/storage/convex.mdx +164 -0
  94. package/.docs/raw/reference/storage/lance.mdx +33 -0
  95. package/.docs/raw/reference/storage/libsql.mdx +37 -0
  96. package/.docs/raw/reference/storage/mongodb.mdx +39 -0
  97. package/.docs/raw/reference/storage/mssql.mdx +37 -0
  98. package/.docs/raw/reference/storage/postgresql.mdx +37 -0
  99. package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
  100. package/.docs/raw/reference/streaming/agents/stream.mdx +56 -1
  101. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +7 -9
  102. package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
  103. package/.docs/raw/reference/streaming/workflows/stream.mdx +83 -24
  104. package/.docs/raw/reference/tools/mcp-client.mdx +74 -17
  105. package/.docs/raw/reference/vectors/convex.mdx +429 -0
  106. package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
  107. package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
  108. package/.docs/raw/reference/voice/google.mdx +159 -20
  109. package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
  110. package/.docs/raw/reference/workflows/run-methods/resume.mdx +44 -0
  111. package/.docs/raw/reference/workflows/run-methods/start.mdx +44 -0
  112. package/.docs/raw/reference/workflows/run.mdx +13 -5
  113. package/.docs/raw/reference/workflows/step.mdx +13 -0
  114. package/.docs/raw/reference/workflows/workflow.mdx +19 -0
  115. package/.docs/raw/server-db/mastra-server.mdx +30 -1
  116. package/.docs/raw/server-db/request-context.mdx +0 -1
  117. package/.docs/raw/server-db/storage.mdx +11 -0
  118. package/.docs/raw/streaming/overview.mdx +6 -6
  119. package/.docs/raw/streaming/tool-streaming.mdx +2 -2
  120. package/.docs/raw/streaming/workflow-streaming.mdx +5 -11
  121. package/.docs/raw/workflows/error-handling.mdx +1 -0
  122. package/.docs/raw/workflows/human-in-the-loop.mdx +4 -4
  123. package/.docs/raw/workflows/overview.mdx +56 -44
  124. package/.docs/raw/workflows/snapshots.mdx +1 -0
  125. package/.docs/raw/workflows/suspend-and-resume.mdx +85 -16
  126. package/.docs/raw/workflows/time-travel.mdx +313 -0
  127. package/.docs/raw/workflows/workflow-state.mdx +191 -0
  128. package/CHANGELOG.md +8 -0
  129. package/package.json +4 -4
  130. package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +0 -91
  131. package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
  132. package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  title: "Reference: Run.stream() | Streaming"
3
- description: Documentation for the `Run.stream()` method in workflows, which allows you to monitor the execution of a workflow run as a stream.
3
+ description: Documentation for the `Run.stream()` method in workflows, which enables real-time streaming of responses.
4
4
  ---
5
5
 
6
6
  # Run.stream()
7
7
 
8
- The `.stream()` method allows you to monitor the execution of a workflow run, providing real-time updates on the status of steps.
8
+ The `.stream()` method enables real-time streaming of responses from a workflow.
9
9
 
10
10
  ## Usage example
11
11
 
12
12
  ```typescript showLineNumbers copy
13
13
  const run = await workflow.createRun();
14
14
 
15
- const { stream } = await run.stream({
15
+ const stream = run.stream({
16
16
  inputData: {
17
17
  value: "initial data",
18
18
  },
@@ -40,7 +40,7 @@ const { stream } = await run.stream({
40
40
  type: "TracingContext",
41
41
  isOptional: true,
42
42
  description:
43
- "Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.",
43
+ "Tracing context for creating child spans and adding metadata.",
44
44
  properties: [
45
45
  {
46
46
  parameters: [
@@ -49,7 +49,7 @@ const { stream } = await run.stream({
49
49
  type: "Span",
50
50
  isOptional: true,
51
51
  description:
52
- "Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.",
52
+ "Current span for creating child spans and adding metadata.",
53
53
  },
54
54
  ],
55
55
  },
@@ -67,13 +67,63 @@ const { stream } = await run.stream({
67
67
  name: "metadata",
68
68
  type: "Record<string, any>",
69
69
  isOptional: true,
70
+ description: "Metadata to add to the root trace span.",
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ parameters: [
76
+ {
77
+ name: "requestContextKeys",
78
+ type: "string[]",
79
+ isOptional: true,
80
+ description:
81
+ "Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').",
82
+ },
83
+ ],
84
+ },
85
+ {
86
+ parameters: [
87
+ {
88
+ name: "traceId",
89
+ type: "string",
90
+ isOptional: true,
91
+ description:
92
+ "Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.",
93
+ },
94
+ ],
95
+ },
96
+ {
97
+ parameters: [
98
+ {
99
+ name: "parentSpanId",
100
+ type: "string",
101
+ isOptional: true,
70
102
  description:
71
- "Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.",
103
+ "Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.",
104
+ },
105
+ ],
106
+ },
107
+ {
108
+ parameters: [
109
+ {
110
+ name: "tags",
111
+ type: "string[]",
112
+ isOptional: true,
113
+ description:
114
+ "Tags to apply to this trace. String labels for categorizing and filtering traces.",
72
115
  },
73
116
  ],
74
117
  },
75
118
  ],
76
119
  },
120
+ {
121
+ name: "closeOnSuspend",
122
+ type: "boolean",
123
+ description:
124
+ "Whether to close the stream when the workflow is suspended, or to keep the stream open until the workflow is finished (by success or error). Default value is true.",
125
+ isOptional: true,
126
+ },
77
127
  ]}
78
128
  />
79
129
 
@@ -83,22 +133,31 @@ const { stream } = await run.stream({
83
133
  content={[
84
134
  {
85
135
  name: "stream",
86
- type: "ReadableStream<StreamEvent>",
136
+ type: "MastraWorkflowStream<ChunkType>",
87
137
  description:
88
- "A readable stream that emits workflow execution events in real-time",
138
+ "A custom stream that extends ReadableStream<ChunkType> with additional workflow-specific properties",
89
139
  },
90
140
  {
91
- name: "getWorkflowState",
92
- type: "() => Promise<WorkflowResult<TState, TOutput, TSteps>>",
93
- description:
94
- "A function that returns a promise resolving to the final workflow result",
141
+ name: "stream.status",
142
+ type: "Promise<RunStatus>",
143
+ description: "A promise that resolves to the current workflow run status",
144
+ },
145
+ {
146
+ name: "stream.result",
147
+ type: "Promise<WorkflowResult<TState, TOutput, TSteps>>",
148
+ description: "A promise that resolves to the final workflow result",
149
+ },
150
+ {
151
+ name: "stream.usage",
152
+ type: "Promise<{ inputTokens: number; outputTokens: number; totalTokens: number, reasoningTokens?: number, cacheInputTokens?: number }>",
153
+ description: "A promise that resolves to token usage statistics",
95
154
  },
96
155
  {
97
- name: "traceId",
156
+ name: "stream.traceId",
98
157
  type: "string",
99
158
  isOptional: true,
100
159
  description:
101
- "The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.",
160
+ "The trace ID associated with this execution when Tracing is enabled.",
102
161
  },
103
162
  ]}
104
163
  />
@@ -106,29 +165,29 @@ const { stream } = await run.stream({
106
165
  ## Extended usage example
107
166
 
108
167
  ```typescript showLineNumbers copy
109
- const { getWorkflowState } = await run.stream({
168
+ const run = await workflow.createRun();
169
+
170
+ const stream = run.stream({
110
171
  inputData: {
111
172
  value: "initial data",
112
173
  },
113
174
  });
114
175
 
115
- const result = await getWorkflowState();
176
+ const result = await stream.result;
116
177
  ```
117
178
 
118
179
  ## Stream Events
119
180
 
120
181
  The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
121
182
 
122
- - **`start`**: Workflow execution begins
123
- - **`step-start`**: A step begins execution
124
- - **`tool-call`**: A tool call is initiated
125
- - **`tool-call-streaming-start`**: Tool call streaming begins
126
- - **`tool-call-delta`**: Incremental tool output updates
127
- - **`step-result`**: A step completes with results
128
- - **`step-finish`**: A step finishes execution
129
- - **`finish`**: Workflow execution completes
183
+ - **`workflow-start`**: Workflow execution begins
184
+ - **`workflow-step-start`**: A step begins execution
185
+ - **`workflow-step-output`**: Custom output from a step
186
+ - **`workflow-step-result`**: A step completes with results
187
+ - **`workflow-finish`**: Workflow execution completes with usage statistics
130
188
 
131
189
  ## Related
132
190
 
133
191
  - [Workflows overview](/docs/v1/workflows/overview#running-workflows)
134
192
  - [Workflow.createRun()](/reference/v1/workflows/workflow-methods/create-run)
193
+ - [Run.resumeStream()](./resumeStream)
@@ -291,23 +291,6 @@ mcpClient.resources.onListChanged("myWeatherServer", () => {
291
291
  });
292
292
  ```
293
293
 
294
- ### `prompts` Property
295
-
296
- The `MCPClient` instance has a `prompts` property that provides access to prompt-related operations.
297
-
298
- ```typescript
299
- const mcpClient = new MCPClient({
300
- /* ...servers configuration... */
301
- });
302
-
303
- // Access prompt methods via mcpClient.prompts
304
- const allPromptsByServer = await mcpClient.prompts.list();
305
- const { prompt, messages } = await mcpClient.prompts.get({
306
- serverName: "myWeatherServer",
307
- name: "current",
308
- });
309
- ```
310
-
311
294
  ### `elicitation` Property
312
295
 
313
296
  The `MCPClient` instance has an `elicitation` property that provides access to elicitation-related operations. Elicitation allows MCP servers to request structured information from users.
@@ -451,6 +434,23 @@ await mcpClient.elicitation.onRequest("interactiveServer", async (request) => {
451
434
  });
452
435
  ```
453
436
 
437
+ ### `prompts` Property
438
+
439
+ The `MCPClient` instance has a `prompts` property that provides access to prompt-related operations.
440
+
441
+ ```typescript
442
+ const mcpClient = new MCPClient({
443
+ /* ...servers configuration... */
444
+ });
445
+
446
+ // Access prompt methods via mcpClient.prompts
447
+ const allPromptsByServer = await mcpClient.prompts.list();
448
+ const { prompt, messages } = await mcpClient.prompts.get({
449
+ serverName: "myWeatherServer",
450
+ name: "current",
451
+ });
452
+ ```
453
+
454
454
  #### `prompts.list()`
455
455
 
456
456
  Retrieves all available prompts from all connected MCP servers, grouped by server name.
@@ -516,6 +516,63 @@ mcpClient.prompts.onListChanged("myWeatherServer", () => {
516
516
  });
517
517
  ```
518
518
 
519
+ ### `progress` Property
520
+
521
+ The `MCPClient` instance has a `progress` property for subscribing to progress notifications emitted by MCP servers while tools execute.
522
+
523
+ ```typescript
524
+ const mcpClient = new MCPClient({
525
+ servers: {
526
+ myServer: {
527
+ url: new URL('http://localhost:4111/api/mcp/myServer/mcp'),
528
+ // Enabled by default; set to false to disable
529
+ enableProgressTracking: true,
530
+ },
531
+ },
532
+ });
533
+
534
+ // Subscribe to progress updates for a specific server
535
+ await mcpClient.progress.onUpdate('myServer', (params) => {
536
+ console.log('📊 Progress:', params.progress, '/', params.total);
537
+ if (params.message) console.log('Message:', params.message);
538
+ if (params.progressToken) console.log('Token:', params.progressToken);
539
+ });
540
+ ```
541
+
542
+ #### `progress.onUpdate(serverName: string, handler)`
543
+
544
+ Registers a handler function to receive progress updates from the specified server.
545
+
546
+ ```typescript
547
+ async onUpdate(
548
+ serverName: string,
549
+ handler: (params: {
550
+ progressToken: string;
551
+ progress: number;
552
+ total?: number;
553
+ message?: string;
554
+ }) => void,
555
+ ): Promise<void>
556
+ ```
557
+
558
+ Notes:
559
+
560
+ - When `enableProgressTracking` is true (default), tool calls include a `progressToken` so you can correlate updates to a specific run.
561
+ - If you pass a `runId` when executing a tool, it will be used as the `progressToken`.
562
+
563
+ To disable progress tracking for a server:
564
+
565
+ ```typescript
566
+ const mcpClient = new MCPClient({
567
+ servers: {
568
+ myServer: {
569
+ url: new URL('http://localhost:4111/api/mcp/myServer/mcp'),
570
+ enableProgressTracking: false,
571
+ },
572
+ },
573
+ });
574
+ ```
575
+
519
576
  ## Elicitation
520
577
 
521
578
  Elicitation is a feature that allows MCP servers to request structured information from users. When a server needs additional data, it can send an elicitation request that the client handles by prompting the user. A common example is during a tool call.