@mastra/mcp-docs-server 0.13.12 → 0.13.13-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +24 -24
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +48 -48
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +63 -63
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Flance.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +42 -42
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +44 -44
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +33 -0
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +47 -47
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Frag.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +47 -47
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +24 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +25 -25
- package/.docs/organized/changelogs/create-mastra.md +13 -13
- package/.docs/organized/changelogs/mastra.md +58 -58
- package/.docs/organized/code-examples/a2a.md +1 -1
- package/.docs/organized/code-examples/agent-network.md +1 -1
- package/.docs/organized/code-examples/agent.md +4 -4
- package/.docs/organized/code-examples/agui.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-v5.md +2 -2
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -1
- package/.docs/organized/code-examples/fireworks-r1.md +1 -1
- package/.docs/organized/code-examples/mcp-registry-registry.md +1 -1
- package/.docs/organized/code-examples/memory-per-resource-example.md +1 -1
- package/.docs/organized/code-examples/memory-with-context.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/openapi-spec-writer.md +1 -1
- package/.docs/organized/code-examples/weather-agent.md +1 -1
- package/.docs/raw/agents/output-processors.mdx +20 -68
- package/.docs/raw/agents/streaming.mdx +50 -20
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +41 -59
- package/.docs/raw/reference/agents/streamVNext.mdx +147 -70
- package/.docs/raw/server-db/storage.mdx +8 -0
- package/package.json +4 -4
|
@@ -8,15 +8,21 @@ import { Callout } from "nextra/components";
|
|
|
8
8
|
# Agent.streamVNext() (Experimental)
|
|
9
9
|
|
|
10
10
|
<Callout type="warning">
|
|
11
|
-
**Experimental Feature**: This is a new streaming implementation
|
|
11
|
+
**Experimental Feature**: This is a new streaming implementation with support for multiple output formats, including AI SDK v5 compatibility. It will replace the existing `stream()` method once battle-tested. The API may change as we refine the feature based on feedback.
|
|
12
12
|
</Callout>
|
|
13
13
|
|
|
14
|
-
The `.streamVNext()` method enables real-time streaming of responses from an agent with enhanced capabilities. This method accepts messages and optional streaming options, providing a next-generation streaming experience
|
|
14
|
+
The `.streamVNext()` method enables real-time streaming of responses from an agent with enhanced capabilities and format flexibility. This method accepts messages and optional streaming options, providing a next-generation streaming experience with support for both Mastra's native format and AI SDK v5 compatibility.
|
|
15
15
|
|
|
16
16
|
## Usage example
|
|
17
17
|
|
|
18
18
|
```typescript copy
|
|
19
|
-
|
|
19
|
+
// Default Mastra format
|
|
20
|
+
const mastraStream = await agent.streamVNext("message for agent");
|
|
21
|
+
|
|
22
|
+
// AI SDK v5 compatible format
|
|
23
|
+
const aiSdkStream = await agent.streamVNext("message for agent", {
|
|
24
|
+
format: 'aisdk'
|
|
25
|
+
});
|
|
20
26
|
```
|
|
21
27
|
|
|
22
28
|
## Parameters
|
|
@@ -30,7 +36,7 @@ await agent.streamVNext("message for agent");
|
|
|
30
36
|
},
|
|
31
37
|
{
|
|
32
38
|
name: "options",
|
|
33
|
-
type: "AgentExecutionOptions<Output, StructuredOutput>",
|
|
39
|
+
type: "AgentExecutionOptions<Output, StructuredOutput, Format>",
|
|
34
40
|
isOptional: true,
|
|
35
41
|
description: "Optional configuration for the streaming process.",
|
|
36
42
|
},
|
|
@@ -41,6 +47,13 @@ await agent.streamVNext("message for agent");
|
|
|
41
47
|
|
|
42
48
|
<PropertiesTable
|
|
43
49
|
content={[
|
|
50
|
+
{
|
|
51
|
+
name: "format",
|
|
52
|
+
type: "'mastra' | 'aisdk'",
|
|
53
|
+
isOptional: true,
|
|
54
|
+
defaultValue: "'mastra'",
|
|
55
|
+
description: "Determines the output stream format. Use 'mastra' for Mastra's native format (default) or 'aisdk' for AI SDK v5 compatibility.",
|
|
56
|
+
},
|
|
44
57
|
{
|
|
45
58
|
name: "abortSignal",
|
|
46
59
|
type: "AbortSignal",
|
|
@@ -167,13 +180,6 @@ await agent.streamVNext("message for agent");
|
|
|
167
180
|
}
|
|
168
181
|
]
|
|
169
182
|
},
|
|
170
|
-
{
|
|
171
|
-
name: "maxSteps",
|
|
172
|
-
type: "number",
|
|
173
|
-
isOptional: true,
|
|
174
|
-
defaultValue: "5",
|
|
175
|
-
description: "Maximum number of execution steps allowed.",
|
|
176
|
-
},
|
|
177
183
|
{
|
|
178
184
|
name: "maxRetries",
|
|
179
185
|
type: "number",
|
|
@@ -251,11 +257,77 @@ await agent.streamVNext("message for agent");
|
|
|
251
257
|
]
|
|
252
258
|
},
|
|
253
259
|
{
|
|
254
|
-
name: "
|
|
255
|
-
type: "
|
|
260
|
+
name: "modelSettings",
|
|
261
|
+
type: "CallSettings",
|
|
256
262
|
isOptional: true,
|
|
257
263
|
description:
|
|
258
|
-
"
|
|
264
|
+
"Model-specific settings like temperature, maxTokens, topP, etc. These are passed to the underlying language model.",
|
|
265
|
+
properties: [
|
|
266
|
+
{
|
|
267
|
+
parameters: [{
|
|
268
|
+
name: "temperature",
|
|
269
|
+
type: "number",
|
|
270
|
+
isOptional: true,
|
|
271
|
+
description: "Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic."
|
|
272
|
+
}]
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
parameters: [{
|
|
276
|
+
name: "maxTokens",
|
|
277
|
+
type: "number",
|
|
278
|
+
isOptional: true,
|
|
279
|
+
description: "Maximum number of tokens to generate."
|
|
280
|
+
}]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
parameters: [{
|
|
284
|
+
name: "topP",
|
|
285
|
+
type: "number",
|
|
286
|
+
isOptional: true,
|
|
287
|
+
description: "Nucleus sampling. This is a number between 0 and 1. It is recommended to set either temperature or topP, but not both."
|
|
288
|
+
}]
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
parameters: [{
|
|
292
|
+
name: "topK",
|
|
293
|
+
type: "number",
|
|
294
|
+
isOptional: true,
|
|
295
|
+
description: "Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses."
|
|
296
|
+
}]
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
parameters: [{
|
|
300
|
+
name: "presencePenalty",
|
|
301
|
+
type: "number",
|
|
302
|
+
isOptional: true,
|
|
303
|
+
description: "Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition)."
|
|
304
|
+
}]
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
parameters: [{
|
|
308
|
+
name: "frequencyPenalty",
|
|
309
|
+
type: "number",
|
|
310
|
+
isOptional: true,
|
|
311
|
+
description: "Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition)."
|
|
312
|
+
}]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
parameters: [{
|
|
316
|
+
name: "stopSequences",
|
|
317
|
+
type: "string[]",
|
|
318
|
+
isOptional: true,
|
|
319
|
+
description: "Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated."
|
|
320
|
+
}]
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
parameters: [{
|
|
324
|
+
name: "seed",
|
|
325
|
+
type: "number",
|
|
326
|
+
isOptional: true,
|
|
327
|
+
description: "The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results."
|
|
328
|
+
}]
|
|
329
|
+
}
|
|
330
|
+
]
|
|
259
331
|
},
|
|
260
332
|
{
|
|
261
333
|
name: "threadId",
|
|
@@ -380,64 +452,16 @@ await agent.streamVNext("message for agent");
|
|
|
380
452
|
description: "Generate a unique ID for each message.",
|
|
381
453
|
},
|
|
382
454
|
{
|
|
383
|
-
name: "
|
|
384
|
-
type: "
|
|
455
|
+
name: "stopWhen",
|
|
456
|
+
type: "StopCondition | StopCondition[]",
|
|
385
457
|
isOptional: true,
|
|
386
|
-
description: "
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
name: "topP",
|
|
390
|
-
type: "number",
|
|
391
|
-
isOptional: true,
|
|
392
|
-
description: "Nucleus sampling. This is a number between 0 and 1. It is recommended to set either `temperature` or `topP`, but not both.",
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
name: "topK",
|
|
396
|
-
type: "number",
|
|
397
|
-
isOptional: true,
|
|
398
|
-
description: "Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses.",
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
name: "presencePenalty",
|
|
402
|
-
type: "number",
|
|
403
|
-
isOptional: true,
|
|
404
|
-
description: "Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).",
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
name: "frequencyPenalty",
|
|
408
|
-
type: "number",
|
|
409
|
-
isOptional: true,
|
|
410
|
-
description: "Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).",
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
name: "stopSequences",
|
|
414
|
-
type: "string[]",
|
|
415
|
-
isOptional: true,
|
|
416
|
-
description: "Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated.",
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
name: "seed",
|
|
420
|
-
type: "number",
|
|
421
|
-
isOptional: true,
|
|
422
|
-
description: "The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results.",
|
|
458
|
+
description: "Condition(s) that determine when to stop the agent's execution. Can be a single condition or array of conditions.",
|
|
423
459
|
},
|
|
424
460
|
{
|
|
425
461
|
name: "headers",
|
|
426
462
|
type: "Record<string, string | undefined>",
|
|
427
463
|
isOptional: true,
|
|
428
464
|
description: "Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.",
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
name: "system",
|
|
432
|
-
type: "string",
|
|
433
|
-
isOptional: true,
|
|
434
|
-
description: "System message to include in the prompt. Can be used with `prompt` or `messages`.",
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
name: "prompt",
|
|
438
|
-
type: "string",
|
|
439
|
-
isOptional: true,
|
|
440
|
-
description: "A simple text prompt. You can either use `prompt` or `messages` but not both.",
|
|
441
465
|
}
|
|
442
466
|
]}
|
|
443
467
|
/>
|
|
@@ -448,25 +472,78 @@ await agent.streamVNext("message for agent");
|
|
|
448
472
|
content={[
|
|
449
473
|
{
|
|
450
474
|
name: "stream",
|
|
451
|
-
type: "
|
|
452
|
-
description: "
|
|
475
|
+
type: "MastraModelOutput<Output> | AISDKV5OutputStream<Output>",
|
|
476
|
+
description: "Returns a streaming interface based on the format parameter. When format is 'mastra' (default), returns MastraModelOutput. When format is 'aisdk', returns AISDKV5OutputStream for AI SDK v5 compatibility.",
|
|
453
477
|
},
|
|
454
478
|
]}
|
|
455
479
|
/>
|
|
456
480
|
|
|
457
481
|
## Extended usage example
|
|
458
482
|
|
|
483
|
+
### Mastra Format (Default)
|
|
484
|
+
|
|
485
|
+
```typescript showLineNumbers copy
|
|
486
|
+
import { stepCountIs } from 'ai-v5';
|
|
487
|
+
|
|
488
|
+
const stream = await agent.streamVNext("Tell me a story", {
|
|
489
|
+
stopWhen: stepCountIs(3), // Stop after 3 steps
|
|
490
|
+
modelSettings: {
|
|
491
|
+
temperature: 0.7,
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// Access text stream
|
|
496
|
+
for await (const chunk of stream.textStream) {
|
|
497
|
+
console.log(chunk);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// Get full text after streaming
|
|
501
|
+
const fullText = await stream.text;
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### AI SDK v5 Format
|
|
505
|
+
|
|
506
|
+
```typescript showLineNumbers copy
|
|
507
|
+
import { stepCountIs } from 'ai-v5';
|
|
508
|
+
|
|
509
|
+
const stream = await agent.streamVNext("Tell me a story", {
|
|
510
|
+
format: 'aisdk',
|
|
511
|
+
stopWhen: stepCountIs(3), // Stop after 3 steps
|
|
512
|
+
modelSettings: {
|
|
513
|
+
temperature: 0.7,
|
|
514
|
+
},
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// Use with AI SDK v5 compatible interfaces
|
|
518
|
+
for await (const part of stream.fullStream) {
|
|
519
|
+
if (part.type === 'text-delta') {
|
|
520
|
+
console.log(part.text);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// In an API route for frontend integration
|
|
525
|
+
return stream.toUIMessageStreamResponse();
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### Advanced Example with Options
|
|
529
|
+
|
|
459
530
|
```typescript showLineNumbers copy
|
|
460
531
|
import { z } from "zod";
|
|
461
|
-
import {
|
|
532
|
+
import { stepCountIs } from 'ai-v5';
|
|
462
533
|
|
|
463
534
|
await agent.streamVNext("message for agent", {
|
|
464
|
-
|
|
465
|
-
|
|
535
|
+
format: 'aisdk', // Enable AI SDK v5 compatibility
|
|
536
|
+
stopWhen: stepCountIs(3), // Stop after 3 steps
|
|
537
|
+
modelSettings: {
|
|
538
|
+
temperature: 0.7,
|
|
539
|
+
modelSettings: {
|
|
540
|
+
temperature: 0.7,
|
|
541
|
+
},
|
|
466
542
|
memory: {
|
|
467
543
|
thread: "user-123",
|
|
468
544
|
resource: "test-app"
|
|
469
545
|
},
|
|
546
|
+
},
|
|
470
547
|
toolChoice: "auto",
|
|
471
548
|
// Structured output with better DX
|
|
472
549
|
structuredOutput: {
|
|
@@ -497,6 +497,14 @@ const messagesV1 = await mastra.getStorage().getMessages({ threadId: 'your-threa
|
|
|
497
497
|
const messagesV2 = await mastra.getStorage().getMessages({ threadId: 'your-thread-id', format: 'v2' });
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
+
You can also retrieve messages using an array of message IDs. Note that unlike `getMessages`, this defaults to the V2 format:
|
|
501
|
+
|
|
502
|
+
```typescript copy
|
|
503
|
+
const messagesV1 = await mastra.getStorage().getMessagesById({ messageIds: messageIdArr, format: 'v1' });
|
|
504
|
+
|
|
505
|
+
const messagesV2 = await mastra.getStorage().getMessagesById({ messageIds: messageIdArr });
|
|
506
|
+
```
|
|
507
|
+
|
|
500
508
|
## Storage Providers
|
|
501
509
|
|
|
502
510
|
Mastra supports the following providers:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.13-alpha.1",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
33
|
"zod": "^3.25.67",
|
|
34
34
|
"zod-to-json-schema": "^3.24.5",
|
|
35
|
-
"@mastra/core": "0.14.
|
|
35
|
+
"@mastra/core": "0.14.1-alpha.1",
|
|
36
36
|
"@mastra/mcp": "^0.10.12"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"tsx": "^4.19.4",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
51
|
+
"@internal/lint": "0.0.30",
|
|
52
|
+
"@mastra/core": "0.14.1-alpha.1"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",
|