@mastra/mcp-docs-server 1.2.2-alpha.4 → 1.2.2-alpha.5
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.
|
@@ -49,7 +49,7 @@ Once a tool has opted in, the LLM can optionally include a `_background` field i
|
|
|
49
49
|
|
|
50
50
|
### Tool-level
|
|
51
51
|
|
|
52
|
-
Set `
|
|
52
|
+
Set `background.enabled: true` on the tool definition. Tools opted in at this layer run in the background whenever called by an agent that has the manager enabled.
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
import { createTool } from '@mastra/core/tools'
|
|
@@ -59,7 +59,7 @@ export const researchTool = createTool({
|
|
|
59
59
|
id: 'research',
|
|
60
60
|
description: 'Run a long research job',
|
|
61
61
|
inputSchema: z.object({ topic: z.string() }),
|
|
62
|
-
|
|
62
|
+
background: {
|
|
63
63
|
enabled: true,
|
|
64
64
|
timeoutMs: 600_000,
|
|
65
65
|
maxRetries: 1,
|
|
@@ -111,7 +111,7 @@ The `_background` override is a _modifier_ on tools the developer has already op
|
|
|
111
111
|
When a tool call is dispatched, the resolved background config is computed in this priority order:
|
|
112
112
|
|
|
113
113
|
1. Agent-level `backgroundTasks.tools` entry for the tool.
|
|
114
|
-
2. Tool-level `
|
|
114
|
+
2. Tool-level `background` config.
|
|
115
115
|
3. LLM `_background.enabled` override (only used to enable background dispatch when the tool was opted in at one of the layers above).
|
|
116
116
|
4. Manager defaults (`defaultTimeoutMs`, `defaultRetries`).
|
|
117
117
|
|
|
@@ -200,7 +200,7 @@ const stream = await supervisor.stream('Research AI in education and write an ar
|
|
|
200
200
|
|
|
201
201
|
### Inheriting from the subagent
|
|
202
202
|
|
|
203
|
-
If a subagent isn't listed under the supervisor's `backgroundTasks.tools` but has background-eligible tools of its own (either via tool-level `
|
|
203
|
+
If a subagent isn't listed under the supervisor's `backgroundTasks.tools` but has background-eligible tools of its own (either via tool-level `background.enabled: true` or its own `backgroundTasks.tools` entry) the framework still dispatches the entire subagent invocation as a background task. The supervisor inherits the subagent's intent: the subagent itself becomes the background task, and its inner tools run in the foreground inside the subagent's loop.
|
|
204
204
|
|
|
205
205
|
The background config used for the inherited dispatch (for example `waitTimeoutMs`) is derived from the subagent's own `backgroundTasks` config.
|
|
206
206
|
|
|
@@ -285,7 +285,7 @@ The manager keeps tool executors in process memory. If the process restarts whil
|
|
|
285
285
|
|
|
286
286
|
Each layer can register terminal-state callbacks. They don't replace one another, and success/failure hooks fire for their respective outcomes:
|
|
287
287
|
|
|
288
|
-
- Tool-level `
|
|
288
|
+
- Tool-level `background.onComplete` / `onFailed`: scoped to one tool.
|
|
289
289
|
- Agent-level `backgroundTasks.onTaskComplete` / `onTaskFailed`: scoped to all tasks dispatched by this agent.
|
|
290
290
|
- Manager-level `onTaskComplete` / `onTaskFailed`: scoped globally.
|
|
291
291
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# workflowSnapshotToStream()
|
|
2
|
+
|
|
3
|
+
Converts a `WorkflowState` object (as returned by `workflow.getWorkflowRunById()`) into a `ReadableStream` of AI SDK UIMessage data parts. The stream contains the same `WorkflowDataPart` and `WorkflowStepDataPart` chunks that the live [`workflowRoute()`](https://mastra.ai/reference/ai-sdk/workflow-route) produces.
|
|
4
|
+
|
|
5
|
+
Use this when you want to display a completed or suspended workflow run using the same UI components that render live workflow streams.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
Next.js App Router endpoint that replays a past workflow run as a stream:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { workflowSnapshotToStream } from '@mastra/ai-sdk'
|
|
13
|
+
import { createUIMessageStreamResponse } from 'ai'
|
|
14
|
+
import { mastra } from '@/src/mastra'
|
|
15
|
+
|
|
16
|
+
export async function GET(req: Request) {
|
|
17
|
+
const { searchParams } = new URL(req.url)
|
|
18
|
+
const runId = searchParams.get('runId')!
|
|
19
|
+
|
|
20
|
+
const workflowRun = await mastra.getWorkflow('myWorkflow').getWorkflowRunById(runId)
|
|
21
|
+
|
|
22
|
+
if (!workflowRun) {
|
|
23
|
+
return new Response('Not found', { status: 404 })
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const stream = workflowSnapshotToStream(workflowRun)
|
|
27
|
+
return createUIMessageStreamResponse({ stream })
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Parameters
|
|
32
|
+
|
|
33
|
+
**workflowRun** (`WorkflowState`): The workflow run state object, as returned by \`getWorkflowRunById()\` or the workflow runs API. Contains \`runId\`, \`workflowName\`, \`status\`, and \`steps\`.
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`ReadableStream` — A stream of AI SDK UIMessage data parts containing:
|
|
38
|
+
|
|
39
|
+
- A `start` marker
|
|
40
|
+
- A `WorkflowDataPart` with the overall workflow status and all step summaries
|
|
41
|
+
- A `WorkflowStepDataPart` for each step with its full output
|
|
42
|
+
- A `finish` marker
|
|
43
|
+
|
|
44
|
+
Pass this stream to [`createUIMessageStreamResponse()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/create-ui-message-stream-response) or `createUIMessageStream()` from the AI SDK.
|
|
45
|
+
|
|
46
|
+
## Related
|
|
47
|
+
|
|
48
|
+
- [`workflowRoute()`](https://mastra.ai/reference/ai-sdk/workflow-route): Stream live workflow runs
|
|
49
|
+
- [`handleWorkflowStream()`](https://mastra.ai/reference/ai-sdk/handle-workflow-stream): Framework-agnostic handler for live workflow streaming
|
|
50
|
+
- [`toAISdkStream()`](https://mastra.ai/reference/ai-sdk/to-ai-sdk-stream): Convert live Mastra streams to AI SDK format
|
|
51
|
+
- [`toAISdkMessages()`](https://mastra.ai/reference/ai-sdk/to-ai-sdk-messages): Convert stored agent messages to AI SDK format
|
|
@@ -666,6 +666,14 @@ Target a specific Mastra server URL.
|
|
|
666
666
|
mastra api --url https://example.com agent list
|
|
667
667
|
```
|
|
668
668
|
|
|
669
|
+
#### `--server-api-prefix <prefix>`
|
|
670
|
+
|
|
671
|
+
Set the API route prefix of the target server. Defaults to `/api`. Use this when the server is mounted under a custom prefix (for example a `@mastra/fastify` `MastraServer` with `prefix: "/api/mastra-studio"`), the same way `mastra studio` accepts `--server-api-prefix`. You can also set the `MASTRA_API_PREFIX` environment variable instead of passing the flag.
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
mastra api --url https://example.com --server-api-prefix /api/mastra-studio agent list
|
|
675
|
+
```
|
|
676
|
+
|
|
669
677
|
#### `--header <"Key: Value">`
|
|
670
678
|
|
|
671
679
|
Send a custom HTTP header. Repeat the flag to send multiple headers.
|
package/.docs/reference/index.md
CHANGED
|
@@ -40,6 +40,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
40
40
|
- [toAISdkV5Messages()](https://mastra.ai/reference/ai-sdk/to-ai-sdk-v5-messages)
|
|
41
41
|
- [withMastra()](https://mastra.ai/reference/ai-sdk/with-mastra)
|
|
42
42
|
- [workflowRoute()](https://mastra.ai/reference/ai-sdk/workflow-route)
|
|
43
|
+
- [workflowSnapshotToStream()](https://mastra.ai/reference/ai-sdk/workflow-snapshot-to-stream)
|
|
43
44
|
- [Auth0](https://mastra.ai/reference/auth/auth0)
|
|
44
45
|
- [Better Auth](https://mastra.ai/reference/auth/better-auth)
|
|
45
46
|
- [Clerk](https://mastra.ai/reference/auth/clerk)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.2-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`bf3fe49`](https://github.com/mastra-ai/mastra/commit/bf3fe49f9467dbbdb8f9eaf74e0f7971ffb19559), [`24ceaea`](https://github.com/mastra-ai/mastra/commit/24ceaea0bdd8609cabbab764380608ca6621a194), [`6ccf67b`](https://github.com/mastra-ai/mastra/commit/6ccf67bf075753754927a57bc2e1734ba2c820c5), [`825d8de`](https://github.com/mastra-ai/mastra/commit/825d8def9fa64c2bcc3d8dd6b49e09342c3ac5c7), [`ffa09e7`](https://github.com/mastra-ai/mastra/commit/ffa09e772a5c92270eabe2090fc42d45bd8ec4b7), [`461a7c5`](https://github.com/mastra-ai/mastra/commit/461a7c501449295287f4f0ee4b0b42344f39fcf8), [`4211472`](https://github.com/mastra-ai/mastra/commit/4211472a5a2bd319c60cd2e42d9109c3eef7ac1c), [`9e45902`](https://github.com/mastra-ai/mastra/commit/9e4590208e745055cecca202e2db0e5c65e17d3c), [`5c0df77`](https://github.com/mastra-ai/mastra/commit/5c0df776c40efa420f8c07a2f3ee66010296618e)]:
|
|
8
|
+
- @mastra/core@1.47.0-alpha.3
|
|
9
|
+
|
|
3
10
|
## 1.2.2-alpha.3
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.2-alpha.
|
|
3
|
+
"version": "1.2.2-alpha.5",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.47.0-alpha.
|
|
31
|
+
"@mastra/core": "1.47.0-alpha.3",
|
|
32
32
|
"@mastra/mcp": "^1.12.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"tsx": "^4.22.4",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
47
|
"vitest": "4.1.8",
|
|
48
|
-
"@
|
|
48
|
+
"@internal/lint": "0.0.108",
|
|
49
49
|
"@internal/types-builder": "0.0.83",
|
|
50
|
-
"@
|
|
50
|
+
"@mastra/core": "1.47.0-alpha.3"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|