@mastra/mcp-docs-server 1.2.2-alpha.5 → 1.2.2-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.
|
@@ -79,6 +79,27 @@ const buildMode = { id: 'build', additionalTools: { deployTool } }
|
|
|
79
79
|
|
|
80
80
|
You can't set both `tools` and `additionalTools` on the same mode.
|
|
81
81
|
|
|
82
|
+
### Restricting tool visibility
|
|
83
|
+
|
|
84
|
+
`tools` and `additionalTools` control which tools are **added** to a mode's run — they don't hide the backing agent's own tools. To restrict which of those tools the model can actually see and call, set `availableTools`:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const reviewMode = {
|
|
88
|
+
id: 'review',
|
|
89
|
+
name: 'Review',
|
|
90
|
+
// Only these tools are visible to the model in this mode.
|
|
91
|
+
availableTools: ['view', 'find_files', 'search_content'],
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`availableTools` is a per-mode visibility allowlist that matches each tool by its final exposed name:
|
|
96
|
+
|
|
97
|
+
- **`undefined`** (default): no mode-level restriction — every tool is visible.
|
|
98
|
+
- **`[]`**: no tools are available for this mode.
|
|
99
|
+
- A denied tool stays hidden even if it appears in the list. Per-tool and per-category `deny` rules in your permission config always take precedence.
|
|
100
|
+
|
|
101
|
+
Workspace tools use the same list as every other tool — reference them by their exposed names (`view`, `write_file`, `find_files`, etc.). Visibility is enforced at LLM-call time, so the model never sees — and can't attempt to call — a tool outside the allowlist.
|
|
102
|
+
|
|
82
103
|
### Mode transitions
|
|
83
104
|
|
|
84
105
|
A mode can declare a `transitionsTo` target. When the `submit_plan` built-in tool runs in that mode, the Harness transitions to the target mode on approval:
|
|
@@ -82,6 +82,8 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
82
82
|
|
|
83
83
|
**modes.additionalTools** (`ToolsInput`): Tools layered on top of the backing agent's tools. Mutually exclusive with \`tools\`.
|
|
84
84
|
|
|
85
|
+
**modes.availableTools** (`string[]`): Per-mode tool visibility allowlist. When set, only tools whose final exposed names appear in this list are visible to the model and executable during this mode's runs. \`undefined\` = all tools visible; \`\[]\` = no tools. Per-tool and per-category \`deny\` rules take precedence over this list. Workspace tools use the same list — reference them by exposed names (\`view\`, \`write\_file\`, etc.).
|
|
86
|
+
|
|
85
87
|
**modes.agent** (`Agent`): The agent for this mode. Deprecated in favor of the top-level \`agent\` config with mode-level overrides.
|
|
86
88
|
|
|
87
89
|
**agent** (`Agent`): Shared backing agent that each mode forks and decorates. When provided, modes layer instructions and tool overrides on top of this agent instead of providing their own.
|
|
@@ -92,9 +94,9 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
92
94
|
|
|
93
95
|
**tools** (`ToolsInput | ((ctx) => ToolsInput)`): Tools available to all agents across all modes. It can be a static tools object or a dynamic function that receives the request context.
|
|
94
96
|
|
|
95
|
-
**workspace** (`Workspace |
|
|
97
|
+
**workspace** (`Workspace | ((ctx) => Workspace)`): Workspace instance or a dynamic factory function. When omitted, each session created via createSession must provide its own workspace. The factory receives the request context and Mastra instance.
|
|
96
98
|
|
|
97
|
-
**browser** (`MastraBrowser | ((ctx) => MastraBrowser)`): Browser automation
|
|
99
|
+
**browser** (`MastraBrowser | ((ctx) => MastraBrowser)`): Browser automation instance or a dynamic factory function. When omitted, each session created via createSession can provide its own browser.
|
|
98
100
|
|
|
99
101
|
**subagents** (`HarnessSubagent[]`): Subagent definitions. When provided, the harness creates a built-in \`subagent\` tool that parent agents can call to spawn focused subagents.
|
|
100
102
|
|
|
@@ -160,20 +162,22 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
160
162
|
|
|
161
163
|
#### `init()`
|
|
162
164
|
|
|
163
|
-
Initialize the harness. Loads storage, initializes
|
|
165
|
+
Initialize the harness. Loads storage, initializes a static workspace (dynamic factory workspaces are resolved per-session during `createSession`), propagates memory and workspace to mode agents, and starts heartbeat handlers. Call this before using the harness.
|
|
164
166
|
|
|
165
167
|
```typescript
|
|
166
168
|
await harness.init()
|
|
167
169
|
```
|
|
168
170
|
|
|
169
|
-
#### `createSession({ id, ownerId, resourceId? })`
|
|
171
|
+
#### `createSession({ id, ownerId, resourceId?, tags?, workspace?, browser?, requestContext? })`
|
|
170
172
|
|
|
171
|
-
Create a new, fully-wired `Session` and bring it online. The session starts in the default mode with the seeded model, connects to the Harness's shared machinery (agent, storage/lock, config catalog), and has a current thread (the most recent thread for the resource, or a freshly created one). Call `init()` once before creating sessions so shared storage
|
|
173
|
+
Create a new, fully-wired `Session` and bring it online. The session starts in the default mode with the seeded model, connects to the Harness's shared machinery (agent, storage/lock, config catalog), and has a current thread (the most recent thread for the resource, or a freshly created one). Call `init()` once before creating sessions so shared storage is ready.
|
|
172
174
|
|
|
173
175
|
The Harness owns no session of its own — every consumer creates its own session and drives all work through it. In a server or multiplayer setting, each request, thread, or user gets its own session, isolated from every other: independent event bus, mode, model, state, and current thread.
|
|
174
176
|
|
|
175
177
|
`id` and `ownerId` are required — they mirror `SessionRecord.id` and `SessionRecord.ownerId` and are stable for the life of the session. `resourceId` is optional and defaults to `config.resourceId` then `config.id`.
|
|
176
178
|
|
|
179
|
+
Each session owns its own `Workspace` and `Browser` instance. When `workspace` is omitted, the Harness resolves its configured workspace (a static instance or a dynamic factory) and passes it to the session. Pass a `workspace` override to give a specific session a different workspace than the Harness default. The workspace is initialized during session creation; `workspace_ready` and `workspace_status_changed` events are emitted on the session bus after `init()` completes, and late subscribers receive a replay of the last workspace status.
|
|
180
|
+
|
|
177
181
|
```typescript
|
|
178
182
|
const session = await harness.createSession({
|
|
179
183
|
id: 'session-xyz',
|
|
@@ -191,6 +195,19 @@ const session = await harness.createSession({
|
|
|
191
195
|
})
|
|
192
196
|
```
|
|
193
197
|
|
|
198
|
+
Override the workspace and browser for a specific session:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
const session = await harness.createSession({
|
|
202
|
+
id: 'session-xyz',
|
|
203
|
+
ownerId: 'user-123',
|
|
204
|
+
workspace: myWorkspace,
|
|
205
|
+
browser: myBrowser,
|
|
206
|
+
})
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`tags` scopes initial thread selection: a thread is a resume candidate only when its metadata matches every provided tag. This lets worktrees sharing a resourceId each resume their own thread (via a `projectPath` tag).
|
|
210
|
+
|
|
194
211
|
Switching the resource ID via `harness.setResourceId()` changes only the resource ID, not `id` or `ownerId`. Read them through `session.identity.getId()` and `session.identity.getOwnerId()`.
|
|
195
212
|
|
|
196
213
|
#### `selectOrCreateThread()`
|
|
@@ -249,6 +266,48 @@ Return the internal `Mastra` instance, or `undefined` before `init()`. Useful fo
|
|
|
249
266
|
const mastra = harness.getMastra()
|
|
250
267
|
```
|
|
251
268
|
|
|
269
|
+
#### `getWorkspace()`
|
|
270
|
+
|
|
271
|
+
Return the Harness-level workspace if it is a static `Workspace` instance. Dynamic factory workspaces are not resolved here — use [`resolveWorkspace()`](#resolveworkspace-session-requestcontext-) to resolve a factory against a session's request context.
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const workspace = harness.getWorkspace()
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### `resolveWorkspace({ session, requestContext? })`
|
|
278
|
+
|
|
279
|
+
Eagerly resolve and cache the workspace. For dynamic workspaces (factory function), this triggers the factory against the given session's request context and caches the result so `getWorkspace()` returns it. Returns the resolved workspace or `undefined` if none is configured.
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
const workspace = await harness.resolveWorkspace({ session })
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
// With an explicit request context
|
|
287
|
+
const requestContext = new RequestContext()
|
|
288
|
+
const workspace = await harness.resolveWorkspace({ session, requestContext })
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### `hasWorkspace()`
|
|
292
|
+
|
|
293
|
+
Whether a workspace is configured on this Harness (static instance or dynamic factory). Sessions without an explicit workspace override fall back to this.
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
if (harness.hasWorkspace()) {
|
|
297
|
+
// ...
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### `isWorkspaceReady()`
|
|
302
|
+
|
|
303
|
+
Whether the Harness-level static workspace has been initialized. Dynamic factory workspaces are resolved and initialized per-session during `createSession`, so this returns `false` for factory configs until a session is created.
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
if (harness.isWorkspaceReady()) {
|
|
307
|
+
// ...
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
252
311
|
### Modes
|
|
253
312
|
|
|
254
313
|
#### `listModes()`
|
|
@@ -469,52 +528,6 @@ const category = harness.getToolCategory({ toolName: 'mastra_workspace_write_fil
|
|
|
469
528
|
// 'edit'
|
|
470
529
|
```
|
|
471
530
|
|
|
472
|
-
### Workspace
|
|
473
|
-
|
|
474
|
-
#### `getWorkspace()`
|
|
475
|
-
|
|
476
|
-
Return the current workspace instance, or `undefined` if no workspace is configured or it hasn't been resolved yet.
|
|
477
|
-
|
|
478
|
-
```typescript
|
|
479
|
-
const workspace = harness.getWorkspace()
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
#### `resolveWorkspace({ requestContext? })`
|
|
483
|
-
|
|
484
|
-
Eagerly resolve and cache the workspace. For dynamic workspaces (factory function), this triggers the factory and caches the result so `getWorkspace()` returns it. Returns the resolved workspace or `undefined` if none is configured.
|
|
485
|
-
|
|
486
|
-
```typescript
|
|
487
|
-
const workspace = await harness.resolveWorkspace()
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
#### `hasWorkspace()`
|
|
491
|
-
|
|
492
|
-
Return whether a workspace is configured (static, config-based, or dynamic).
|
|
493
|
-
|
|
494
|
-
```typescript
|
|
495
|
-
if (harness.hasWorkspace()) {
|
|
496
|
-
const workspace = await harness.resolveWorkspace()
|
|
497
|
-
}
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
#### `isWorkspaceReady()`
|
|
501
|
-
|
|
502
|
-
Return whether the workspace is ready to use. For dynamic workspaces (factory function), always returns `true`. For static workspaces, returns `true` after `init()` succeeds.
|
|
503
|
-
|
|
504
|
-
```typescript
|
|
505
|
-
if (harness.isWorkspaceReady()) {
|
|
506
|
-
const workspace = harness.getWorkspace()
|
|
507
|
-
}
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
#### `destroyWorkspace()`
|
|
511
|
-
|
|
512
|
-
Destroy the workspace and release resources. Only applies to static workspaces — dynamic workspaces aren't destroyed.
|
|
513
|
-
|
|
514
|
-
```typescript
|
|
515
|
-
await harness.destroyWorkspace()
|
|
516
|
-
```
|
|
517
|
-
|
|
518
531
|
### Observational Memory
|
|
519
532
|
|
|
520
533
|
#### `loadOMProgress()`
|
|
@@ -51,6 +51,8 @@ The session is organized into sub-objects, each owning one domain of per-convers
|
|
|
51
51
|
|
|
52
52
|
**state** (`SessionState<TState>`): The schema-validated, session-owned Harness state. See state methods below.
|
|
53
53
|
|
|
54
|
+
**browser** (`MastraBrowser | undefined`): The browser automation instance for this session. Set at creation via createSession, or from the Harness config default. Undefined when no browser is configured.
|
|
55
|
+
|
|
54
56
|
## Methods
|
|
55
57
|
|
|
56
58
|
### Permissions
|
|
@@ -563,6 +565,19 @@ const added = await harness.session.state.update(current => ({
|
|
|
563
565
|
}))
|
|
564
566
|
```
|
|
565
567
|
|
|
568
|
+
## Scoping tags
|
|
569
|
+
|
|
570
|
+
Sessions carry scoping tags (e.g. `{ projectPath }`) seeded at creation and stamped onto every thread the session creates. Thread listings can be filtered back to the session's scope using these tags.
|
|
571
|
+
|
|
572
|
+
### `getTags()`
|
|
573
|
+
|
|
574
|
+
Return a copy of the session's scoping tags. Empty object when the session is unscoped.
|
|
575
|
+
|
|
576
|
+
```typescript
|
|
577
|
+
const tags = harness.session.getTags()
|
|
578
|
+
// { projectPath: '/my/project' }
|
|
579
|
+
```
|
|
580
|
+
|
|
566
581
|
## Related
|
|
567
582
|
|
|
568
583
|
- [Harness class](https://mastra.ai/reference/harness/harness-class)
|
|
@@ -638,6 +638,8 @@ processOutputStep?(args: ProcessOutputStepArgs): ProcessorMessageResult;
|
|
|
638
638
|
|
|
639
639
|
**finishReason** (`string`): The finish reason from the LLM (stop, tool-use, length, etc.).
|
|
640
640
|
|
|
641
|
+
**providerMetadata** (`ProviderMetadata`): Provider-specific metadata for the finishing step (e.g. AWS Bedrock guardrail trace). Present when the model step produced provider metadata, including on content-filter blocks where \`steps\` is empty.
|
|
642
|
+
|
|
641
643
|
**toolCalls** (`ToolCallInfo[]`): Tool calls made in this step (if any).
|
|
642
644
|
|
|
643
645
|
**text** (`string`): Generated text from this step.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.2-alpha.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`462a769`](https://github.com/mastra-ai/mastra/commit/462a769da61850862ca1be3d74134d33078ee6a7), [`f328049`](https://github.com/mastra-ai/mastra/commit/f3280498c324afd2a8d36cd828f5b9f94a2dddc1), [`e545228`](https://github.com/mastra-ai/mastra/commit/e54522856934a5dc030b7b6385771e3548020d59)]:
|
|
8
|
+
- @mastra/core@1.47.0-alpha.4
|
|
9
|
+
|
|
3
10
|
## 1.2.2-alpha.5
|
|
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.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,8 +28,8 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/
|
|
32
|
-
"@mastra/
|
|
31
|
+
"@mastra/mcp": "^1.12.0",
|
|
32
|
+
"@mastra/core": "1.47.0-alpha.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@hono/node-server": "^1.19.11",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"vitest": "4.1.8",
|
|
48
48
|
"@internal/lint": "0.0.108",
|
|
49
49
|
"@internal/types-builder": "0.0.83",
|
|
50
|
-
"@mastra/core": "1.47.0-alpha.
|
|
50
|
+
"@mastra/core": "1.47.0-alpha.4"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|