@mastra/mcp-docs-server 1.2.8-alpha.5 → 1.2.8-alpha.7
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/docs/long-running-agents/durable-agents.md +2 -1
- package/.docs/reference/acp/acp-agent.md +2 -0
- package/.docs/reference/acp/create-acp-tool.md +28 -0
- package/.docs/reference/agent-controller/session.md +2 -0
- package/.docs/reference/agents/durable-agent.md +23 -0
- package/CHANGELOG.md +7 -0
- package/package.json +5 -5
|
@@ -159,8 +159,9 @@ cleanup()
|
|
|
159
159
|
```typescript
|
|
160
160
|
import { createDurableAgent } from '@mastra/core/agent/durable'
|
|
161
161
|
import { RedisServerCache } from '@mastra/redis'
|
|
162
|
+
import Redis from 'ioredis'
|
|
162
163
|
|
|
163
|
-
const cache = new RedisServerCache({
|
|
164
|
+
const cache = new RedisServerCache({ client: new Redis('redis://localhost:6379') })
|
|
164
165
|
|
|
165
166
|
export const durableAgent = createDurableAgent({
|
|
166
167
|
agent,
|
|
@@ -76,6 +76,8 @@ export const claudeCodeAgent = new AcpAgent({
|
|
|
76
76
|
|
|
77
77
|
**onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
|
|
78
78
|
|
|
79
|
+
**createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers. See Extension methods.
|
|
80
|
+
|
|
79
81
|
**workspace** (`Workspace`): Workspace used for ACP file read and write requests. Defaults to a Workspace backed by LocalFilesystem at cwd or process.cwd().
|
|
80
82
|
|
|
81
83
|
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
|
|
@@ -57,6 +57,8 @@ export const codeSupervisor = new Agent({
|
|
|
57
57
|
|
|
58
58
|
**onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
|
|
59
59
|
|
|
60
|
+
**createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers.
|
|
61
|
+
|
|
60
62
|
**workspace** (`Workspace`): Workspace option from the shared ACP connection options. During tool execution, createACPTool() passes the current Mastra workspace from the execution context when one is available; otherwise the ACP connection falls back to a local filesystem workspace. Use AcpAgent when you need to provide an explicit workspace instance.
|
|
61
63
|
|
|
62
64
|
**model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
|
|
@@ -124,6 +126,32 @@ export const codeAgentTool = createACPTool({
|
|
|
124
126
|
|
|
125
127
|
Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
|
|
126
128
|
|
|
129
|
+
## Extension methods
|
|
130
|
+
|
|
131
|
+
Some ACP agents call custom extension methods on the client, outside the standard ACP request set. The default client rejects unknown methods with a "Method not found" error, which can abort the agent's turn.
|
|
132
|
+
|
|
133
|
+
Pass `createClient` to extend or replace the default client. The callback receives the default client and returns the client used for the connection:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { createACPTool } from '@mastra/acp'
|
|
137
|
+
|
|
138
|
+
export const codeAgentTool = createACPTool({
|
|
139
|
+
id: 'code-agent',
|
|
140
|
+
description: 'Use an ACP-compatible coding agent',
|
|
141
|
+
command: 'acp-agent',
|
|
142
|
+
args: ['--stdio'],
|
|
143
|
+
createClient: defaultClient =>
|
|
144
|
+
Object.assign(defaultClient, {
|
|
145
|
+
async extMethod(method: string, params: Record<string, unknown>) {
|
|
146
|
+
return {}
|
|
147
|
+
},
|
|
148
|
+
async extNotification(method: string, params: Record<string, unknown>) {},
|
|
149
|
+
}),
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Return a fully custom `Client` implementation when you need to change the standard handlers as well. The `Client` type is re-exported from `@mastra/acp`.
|
|
154
|
+
|
|
127
155
|
## Related
|
|
128
156
|
|
|
129
157
|
- [Agent Client Protocol docs](https://mastra.ai/docs/agents/acp)
|
|
@@ -211,6 +211,8 @@ Retrieve messages for a specific thread.
|
|
|
211
211
|
const messages = await agentController.session.thread.listMessages({ threadId: 'thread-abc123' })
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
+
The message-reading methods `listActiveMessages`, `listMessages`, and `firstUserMessage` return `MastraDBMessage` objects, while `firstUserMessages` returns a `Map<string, MastraDBMessage>` keyed by thread ID. Each message has a `role`, an `id`, a `createdAt`, and a `content` object with `content.format` and a `content.parts` array. Read text, reasoning, tool calls, and attachments from `content.parts`. Signals such as system reminders and notifications are returned as separate messages with `role: 'signal'`.
|
|
215
|
+
|
|
214
216
|
### `session.thread.firstUserMessage({ threadId })`
|
|
215
217
|
|
|
216
218
|
Retrieve the first user message for a thread, or `null` if none.
|
|
@@ -37,6 +37,29 @@ const text = await output.text
|
|
|
37
37
|
cleanup()
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### Using the `durable` config flag
|
|
41
|
+
|
|
42
|
+
Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it is attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, or `cleanupTimeoutMs`.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { Mastra } from '@mastra/core'
|
|
46
|
+
import { Agent } from '@mastra/core/agent'
|
|
47
|
+
|
|
48
|
+
const myAgent = new Agent({
|
|
49
|
+
id: 'my-agent',
|
|
50
|
+
name: 'My Agent',
|
|
51
|
+
instructions: 'You are a helpful assistant',
|
|
52
|
+
model: 'openai/gpt-5.5',
|
|
53
|
+
durable: true, // or: { maxSteps: 10, cleanupTimeoutMs: 60_000 }
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export const mastra = new Mastra({
|
|
57
|
+
agents: { myAgent },
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) do not become durable; the wrapping is applied at registration.
|
|
62
|
+
|
|
40
63
|
## `createDurableAgent(options)`
|
|
41
64
|
|
|
42
65
|
Wraps an `Agent` with durable execution and resumable streams. This is the recommended way to create a `DurableAgent`.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.8-alpha.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`1426af2`](https://github.com/mastra-ai/mastra/commit/1426af24975879c000d13ac75673f630fcc970c1), [`975295d`](https://github.com/mastra-ai/mastra/commit/975295d418552f0d46a59edfef4c3ee555f9930a), [`85e4fb5`](https://github.com/mastra-ai/mastra/commit/85e4fb50087a81c74df3a762f53b56373db0b912), [`ef03c0c`](https://github.com/mastra-ai/mastra/commit/ef03c0cfc62367a458e4cc56462e2148b35681c5), [`4fb4d88`](https://github.com/mastra-ai/mastra/commit/4fb4d881bc107acee13890ad4d78661016c510ed), [`4eba27a`](https://github.com/mastra-ai/mastra/commit/4eba27adcf60f991df0e62f94b3e75b4e67f3b4b), [`c701be3`](https://github.com/mastra-ai/mastra/commit/c701be32d7d9aa94a66da8c6cc38dcac6856f464)]:
|
|
8
|
+
- @mastra/core@1.52.0-alpha.3
|
|
9
|
+
|
|
3
10
|
## 1.2.8-alpha.4
|
|
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.8-alpha.
|
|
3
|
+
"version": "1.2.8-alpha.7",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.52.0-alpha.
|
|
31
|
+
"@mastra/core": "1.52.0-alpha.3",
|
|
32
32
|
"@mastra/mcp": "^1.15.0-alpha.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@hono/node-server": "^1.19.
|
|
35
|
+
"@hono/node-server": "^1.19.14",
|
|
36
36
|
"@types/jsdom": "^21.1.7",
|
|
37
37
|
"@types/node": "22.20.1",
|
|
38
38
|
"@vitest/coverage-v8": "4.1.10",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"tsx": "^4.22.4",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
47
|
"vitest": "4.1.10",
|
|
48
|
-
"@internal/lint": "0.0.114",
|
|
49
48
|
"@internal/types-builder": "0.0.89",
|
|
50
|
-
"@
|
|
49
|
+
"@internal/lint": "0.0.114",
|
|
50
|
+
"@mastra/core": "1.52.0-alpha.3"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|