@mastra/mcp-docs-server 1.1.17-alpha.3 → 1.1.17-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/workspace/lsp.md +116 -0
- package/.docs/docs/workspace/overview.md +15 -1
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/zai.md +14 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -1
- package/.docs/models/providers/zhipuai.md +13 -12
- package/.docs/reference/harness/harness-class.md +2 -0
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/processors/skill-search-processor.md +93 -0
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# LSP inspection
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.1.0`
|
|
4
|
+
|
|
5
|
+
LSP inspection gives workspace-backed agents semantic code intelligence. When you enable LSP on a workspace, agents can inspect symbols in supported files to retrieve hover information, jump to definitions, and find implementations.
|
|
6
|
+
|
|
7
|
+
## When to use LSP inspection
|
|
8
|
+
|
|
9
|
+
Use LSP inspection when your agent needs semantic code understanding instead of plain-text search alone:
|
|
10
|
+
|
|
11
|
+
- Inspect TypeScript or JavaScript symbols and their inferred types
|
|
12
|
+
- Find where a symbol is declared before editing related code
|
|
13
|
+
- Explore implementations across a codebase without manually tracing every file
|
|
14
|
+
- Combine semantic inspection with `view` and `search_content` for faster navigation
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
Enable LSP on a workspace by setting `lsp: true`:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace'
|
|
22
|
+
|
|
23
|
+
const workspace = new Workspace({
|
|
24
|
+
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
25
|
+
sandbox: new LocalSandbox({ workingDirectory: './workspace' }),
|
|
26
|
+
lsp: true,
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
With this configuration, the workspace registers the default LSP inspection tool alongside the configured filesystem and sandbox tools.
|
|
31
|
+
|
|
32
|
+
## Agent tool
|
|
33
|
+
|
|
34
|
+
When LSP is enabled, the workspace exposes `mastra_workspace_lsp_inspect` by default.
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"path": "/absolute/path/to/file.ts",
|
|
39
|
+
"line": 10,
|
|
40
|
+
"match": "const foo = <<<bar()"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The `match` field must include exactly one `<<<` cursor marker. The marker identifies the symbol position on the specified line.
|
|
45
|
+
|
|
46
|
+
The tool returns up to three result groups:
|
|
47
|
+
|
|
48
|
+
| Result | Description |
|
|
49
|
+
| ---------------- | ---------------------------------------------------------------- |
|
|
50
|
+
| `hover` | Type information or documentation for the symbol at the cursor |
|
|
51
|
+
| `diagnostics` | Line-scoped LSP diagnostics for the inspected line, when present |
|
|
52
|
+
| `definition` | Declaration locations with a one-line preview |
|
|
53
|
+
| `implementation` | Implementation or usage locations |
|
|
54
|
+
|
|
55
|
+
## Tool name remapping
|
|
56
|
+
|
|
57
|
+
Rename the tool if your agent expects a shorter name:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { Workspace, LocalFilesystem, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
61
|
+
|
|
62
|
+
const workspace = new Workspace({
|
|
63
|
+
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
64
|
+
lsp: true,
|
|
65
|
+
tools: {
|
|
66
|
+
[WORKSPACE_TOOLS.LSP.LSP_INSPECT]: {
|
|
67
|
+
name: 'lsp_inspect',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This changes the exposed tool name only. The configuration key stays `WORKSPACE_TOOLS.LSP.LSP_INSPECT`.
|
|
74
|
+
|
|
75
|
+
## LSP configuration
|
|
76
|
+
|
|
77
|
+
Set `lsp` to `true` for default behavior, or provide an object to customize server startup and diagnostics:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
81
|
+
|
|
82
|
+
const workspace = new Workspace({
|
|
83
|
+
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
84
|
+
lsp: {
|
|
85
|
+
diagnosticTimeout: 4000,
|
|
86
|
+
initTimeout: 8000,
|
|
87
|
+
disableServers: ['pyright'],
|
|
88
|
+
binaryOverrides: {
|
|
89
|
+
typescript: '/custom/path/to/typescript-language-server',
|
|
90
|
+
},
|
|
91
|
+
searchPaths: ['/opt/homebrew/bin'],
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use custom configuration when you need to:
|
|
97
|
+
|
|
98
|
+
- Increase timeouts for large repositories
|
|
99
|
+
- Disable specific language servers
|
|
100
|
+
- Point Mastra at custom language server binaries
|
|
101
|
+
- Add extra binary search paths in constrained environments
|
|
102
|
+
|
|
103
|
+
## Requirements and limitations
|
|
104
|
+
|
|
105
|
+
- LSP inspection only works for file types with a matching language server
|
|
106
|
+
- The `path` you inspect must resolve inside the workspace filesystem or allowed paths
|
|
107
|
+
- External package inspection may resolve to declaration files such as `.d.ts` instead of runtime source files
|
|
108
|
+
- `lsp_inspect` complements `view` and `search_content`, but does not replace reading implementation code when you need full context
|
|
109
|
+
|
|
110
|
+
## Related
|
|
111
|
+
|
|
112
|
+
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|
|
113
|
+
- [Filesystem](https://mastra.ai/docs/workspace/filesystem)
|
|
114
|
+
- [Sandbox](https://mastra.ai/docs/workspace/sandbox)
|
|
115
|
+
- [Search and indexing](https://mastra.ai/docs/workspace/search)
|
|
116
|
+
- [Workspace class reference](https://mastra.ai/reference/workspace/workspace-class)
|
|
@@ -8,9 +8,14 @@ A workspace supports the following features:
|
|
|
8
8
|
|
|
9
9
|
- **[Filesystem](https://mastra.ai/docs/workspace/filesystem)**: File storage (read, write, list, delete, copy, move, grep)
|
|
10
10
|
- **[Sandbox](https://mastra.ai/docs/workspace/sandbox)**: Command execution (shell commands) and background processes
|
|
11
|
+
- **[LSP inspection](https://mastra.ai/docs/workspace/lsp)**: Hover, definition, and implementation queries through language servers
|
|
11
12
|
- **[Search](https://mastra.ai/docs/workspace/search)**: BM25, vector, or hybrid search over indexed content
|
|
12
13
|
- **[Skills](https://mastra.ai/docs/workspace/skills)**: Reusable instructions for agents
|
|
13
14
|
|
|
15
|
+
## When to use workspaces
|
|
16
|
+
|
|
17
|
+
Use a workspace when your agent needs access to the local filesystem, shell commands, semantic code inspection, indexed search, or reusable skill instructions.
|
|
18
|
+
|
|
14
19
|
## How it works
|
|
15
20
|
|
|
16
21
|
When you assign a workspace to an agent, Mastra includes the corresponding tools in the agent's toolset. The agent can then use these tools to interact with files and execute commands.
|
|
@@ -208,16 +213,24 @@ import { Workspace, LocalFilesystem, LocalSandbox, WORKSPACE_TOOLS } from '@mast
|
|
|
208
213
|
const workspace = new Workspace({
|
|
209
214
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
210
215
|
sandbox: new LocalSandbox({ workingDirectory: './workspace' }),
|
|
216
|
+
lsp: true,
|
|
211
217
|
tools: {
|
|
212
218
|
[WORKSPACE_TOOLS.FILESYSTEM.READ_FILE]: { name: 'view' },
|
|
213
219
|
[WORKSPACE_TOOLS.FILESYSTEM.GREP]: { name: 'search_content' },
|
|
214
220
|
[WORKSPACE_TOOLS.FILESYSTEM.LIST_FILES]: { name: 'find_files' },
|
|
215
221
|
[WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND]: { name: 'execute_command' },
|
|
222
|
+
[WORKSPACE_TOOLS.LSP.LSP_INSPECT]: { name: 'lsp_inspect' },
|
|
216
223
|
},
|
|
217
224
|
})
|
|
218
225
|
```
|
|
219
226
|
|
|
220
|
-
The agent sees `view`, `search_content`, `find_files`, and `
|
|
227
|
+
The agent sees `view`, `search_content`, `find_files`, `execute_command`, and `lsp_inspect` instead of the default `mastra_workspace_*` names. Tool names must be unique — duplicate names or conflicts with other default names throw an error.
|
|
228
|
+
|
|
229
|
+
## LSP inspection
|
|
230
|
+
|
|
231
|
+
Enable `lsp` on a workspace to add semantic code inspection through language servers. This adds the `mastra_workspace_lsp_inspect` tool by default, which can return hover information, definition locations, and implementations for a symbol at a specific cursor position.
|
|
232
|
+
|
|
233
|
+
See [LSP inspection](https://mastra.ai/docs/workspace/lsp) for configuration, examples, and tool name remapping.
|
|
221
234
|
|
|
222
235
|
### Output truncation
|
|
223
236
|
|
|
@@ -294,6 +307,7 @@ External providers may perform additional setup like establishing connections or
|
|
|
294
307
|
|
|
295
308
|
- [Filesystem](https://mastra.ai/docs/workspace/filesystem)
|
|
296
309
|
- [Sandbox](https://mastra.ai/docs/workspace/sandbox)
|
|
310
|
+
- [LSP inspection](https://mastra.ai/docs/workspace/lsp)
|
|
297
311
|
- [Skills](https://mastra.ai/docs/workspace/skills)
|
|
298
312
|
- [Search and indexing](https://mastra.ai/docs/workspace/search)
|
|
299
313
|
- [Workspace class reference](https://mastra.ai/reference/workspace/workspace-class)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenRouter
|
|
2
2
|
|
|
3
|
-
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
3
|
+
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 165 models through Mastra's model router.
|
|
4
4
|
|
|
5
5
|
Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
6
6
|
|
|
@@ -103,6 +103,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
103
103
|
| `mistralai/devstral-small-2507` |
|
|
104
104
|
| `mistralai/mistral-medium-3` |
|
|
105
105
|
| `mistralai/mistral-medium-3.1` |
|
|
106
|
+
| `mistralai/mistral-small-2603` |
|
|
106
107
|
| `mistralai/mistral-small-3.1-24b-instruct` |
|
|
107
108
|
| `mistralai/mistral-small-3.2-24b-instruct` |
|
|
108
109
|
| `moonshotai/kimi-k2` |
|
package/.docs/models/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Model Providers
|
|
2
2
|
|
|
3
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
3
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 3396 models from 94 providers through a single API.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Z.AI
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 11 Z.AI models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Z.AI documentation](https://docs.z.ai/guides/overview/pricing).
|
|
6
6
|
|
|
@@ -32,18 +32,19 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `zai/glm-4.5`
|
|
38
|
-
| `zai/glm-4.5-air`
|
|
39
|
-
| `zai/glm-4.5-flash`
|
|
40
|
-
| `zai/glm-4.5v`
|
|
41
|
-
| `zai/glm-4.6`
|
|
42
|
-
| `zai/glm-4.6v`
|
|
43
|
-
| `zai/glm-4.7`
|
|
44
|
-
| `zai/glm-4.7-flash`
|
|
45
|
-
| `zai/glm-
|
|
46
|
-
| `zai/glm-5
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| -------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `zai/glm-4.5` | 131K | | | | | | $0.60 | $2 |
|
|
38
|
+
| `zai/glm-4.5-air` | 131K | | | | | | $0.20 | $1 |
|
|
39
|
+
| `zai/glm-4.5-flash` | 131K | | | | | | — | — |
|
|
40
|
+
| `zai/glm-4.5v` | 64K | | | | | | $0.60 | $2 |
|
|
41
|
+
| `zai/glm-4.6` | 205K | | | | | | $0.60 | $2 |
|
|
42
|
+
| `zai/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
43
|
+
| `zai/glm-4.7` | 205K | | | | | | $0.60 | $2 |
|
|
44
|
+
| `zai/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
45
|
+
| `zai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
46
|
+
| `zai/glm-5` | 205K | | | | | | $1 | $3 |
|
|
47
|
+
| `zai/glm-5-turbo` | 200K | | | | | | $1 | $4 |
|
|
47
48
|
|
|
48
49
|
## Advanced configuration
|
|
49
50
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Zhipu AI Coding Plan
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 12 Zhipu AI Coding Plan models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Zhipu AI Coding Plan documentation](https://docs.bigmodel.cn/cn/coding-plan/overview).
|
|
6
6
|
|
|
@@ -42,6 +42,8 @@ for await (const chunk of stream) {
|
|
|
42
42
|
| `zhipuai-coding-plan/glm-4.6v` | 128K | | | | | | — | — |
|
|
43
43
|
| `zhipuai-coding-plan/glm-4.6v-flash` | 128K | | | | | | — | — |
|
|
44
44
|
| `zhipuai-coding-plan/glm-4.7` | 205K | | | | | | — | — |
|
|
45
|
+
| `zhipuai-coding-plan/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
46
|
+
| `zhipuai-coding-plan/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
45
47
|
| `zhipuai-coding-plan/glm-5` | 205K | | | | | | — | — |
|
|
46
48
|
| `zhipuai-coding-plan/glm-5-turbo` | 200K | | | | | | — | — |
|
|
47
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Zhipu AI
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 10 Zhipu AI models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Zhipu AI documentation](https://docs.z.ai/guides/overview/pricing).
|
|
6
6
|
|
|
@@ -32,17 +32,18 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `zhipuai/glm-4.5`
|
|
38
|
-
| `zhipuai/glm-4.5-air`
|
|
39
|
-
| `zhipuai/glm-4.5-flash`
|
|
40
|
-
| `zhipuai/glm-4.5v`
|
|
41
|
-
| `zhipuai/glm-4.6`
|
|
42
|
-
| `zhipuai/glm-4.6v`
|
|
43
|
-
| `zhipuai/glm-4.7`
|
|
44
|
-
| `zhipuai/glm-4.7-flash`
|
|
45
|
-
| `zhipuai/glm-
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| ------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `zhipuai/glm-4.5` | 131K | | | | | | $0.60 | $2 |
|
|
38
|
+
| `zhipuai/glm-4.5-air` | 131K | | | | | | $0.20 | $1 |
|
|
39
|
+
| `zhipuai/glm-4.5-flash` | 131K | | | | | | — | — |
|
|
40
|
+
| `zhipuai/glm-4.5v` | 64K | | | | | | $0.60 | $2 |
|
|
41
|
+
| `zhipuai/glm-4.6` | 205K | | | | | | $0.60 | $2 |
|
|
42
|
+
| `zhipuai/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
43
|
+
| `zhipuai/glm-4.7` | 205K | | | | | | $0.60 | $2 |
|
|
44
|
+
| `zhipuai/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
45
|
+
| `zhipuai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
46
|
+
| `zhipuai/glm-5` | 205K | | | | | | $1 | $3 |
|
|
46
47
|
|
|
47
48
|
## Advanced configuration
|
|
48
49
|
|
|
@@ -94,6 +94,8 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
94
94
|
|
|
95
95
|
**omConfig** (`HarnessOMConfig`): Default configuration for observational memory (observer/reflector model IDs and thresholds).
|
|
96
96
|
|
|
97
|
+
**disableBuiltinTools** (`BuiltinToolId[]`): Built-in harness tool IDs to remove from the \`harnessBuiltIn\` toolset. Valid values are \`ask\_user\`, \`submit\_plan\`, \`task\_write\`, \`task\_check\`, and \`subagent\`.
|
|
98
|
+
|
|
97
99
|
**heartbeatHandlers** (`HeartbeatHandler[]`): Periodic background tasks started during \`init()\`. Use for gateway sync, cache refresh, and similar tasks.
|
|
98
100
|
|
|
99
101
|
**idGenerator** (`() => string`): Custom ID generator for Harness-managed IDs such as threads and mode-run identifiers. (Default: `timestamp + random string`)
|
package/.docs/reference/index.md
CHANGED
|
@@ -153,6 +153,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
153
153
|
- [Processor Interface](https://mastra.ai/reference/processors/processor-interface)
|
|
154
154
|
- [PromptInjectionDetector](https://mastra.ai/reference/processors/prompt-injection-detector)
|
|
155
155
|
- [SemanticRecall](https://mastra.ai/reference/processors/semantic-recall-processor)
|
|
156
|
+
- [SkillSearchProcessor](https://mastra.ai/reference/processors/skill-search-processor)
|
|
156
157
|
- [SystemPromptScrubber](https://mastra.ai/reference/processors/system-prompt-scrubber)
|
|
157
158
|
- [TokenLimiterProcessor](https://mastra.ai/reference/processors/token-limiter-processor)
|
|
158
159
|
- [ToolCallFilter](https://mastra.ai/reference/processors/tool-call-filter)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# SkillSearchProcessor
|
|
2
|
+
|
|
3
|
+
The `SkillSearchProcessor` is an **input processor** that enables on-demand skill discovery and loading. Instead of injecting all skill metadata into the system prompt upfront (like `SkillsProcessor`), it gives the agent two meta-tools (`search_skills` and `load_skill`) that let it find and load skills on demand. This reduces context token usage when workspaces have many skills.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { SkillSearchProcessor } from '@mastra/core/processors'
|
|
9
|
+
|
|
10
|
+
const skillSearch = new SkillSearchProcessor({
|
|
11
|
+
workspace,
|
|
12
|
+
search: {
|
|
13
|
+
topK: 5,
|
|
14
|
+
minScore: 0.1,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Constructor parameters
|
|
20
|
+
|
|
21
|
+
**options** (`SkillSearchProcessorOptions`): Configuration options for the skill search processor
|
|
22
|
+
|
|
23
|
+
**options.workspace** (`Workspace`): Workspace instance containing skills. Skills are accessed via workspace.skills.
|
|
24
|
+
|
|
25
|
+
**options.search** (`{ topK?: number; minScore?: number }`): Configuration for the search behavior.
|
|
26
|
+
|
|
27
|
+
**options.search.topK** (`number`): Maximum number of skills to return in search results.
|
|
28
|
+
|
|
29
|
+
**options.search.minScore** (`number`): Minimum relevance score for including a skill in search results.
|
|
30
|
+
|
|
31
|
+
**options.ttl** (`number`): Time-to-live for thread state in milliseconds. After this duration of inactivity, thread state will be cleaned up. Set to 0 to disable cleanup.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
**id** (`string`): Processor identifier set to 'skill-search'
|
|
36
|
+
|
|
37
|
+
**name** (`string`): Processor display name set to 'Skill Search Processor'
|
|
38
|
+
|
|
39
|
+
**processInputStep** (`(args: ProcessInputStepArgs) => Promise<ProcessInputStepResult>`): Processes each step to inject search/load meta-tools and any previously loaded skill instructions as system messages.
|
|
40
|
+
|
|
41
|
+
## Extended usage example
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { Agent } from '@mastra/core/agent'
|
|
45
|
+
import { SkillSearchProcessor } from '@mastra/core/processors'
|
|
46
|
+
import { Workspace, LocalFilesystem } from '@mastra/core/workspace'
|
|
47
|
+
|
|
48
|
+
const workspace = new Workspace({
|
|
49
|
+
filesystem: new LocalFilesystem({ basePath: './project' }),
|
|
50
|
+
skills: ['/skills'],
|
|
51
|
+
bm25: true,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const skillSearch = new SkillSearchProcessor({
|
|
55
|
+
workspace,
|
|
56
|
+
search: {
|
|
57
|
+
topK: 5,
|
|
58
|
+
minScore: 0.1,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const agent = new Agent({
|
|
63
|
+
name: 'skill-agent',
|
|
64
|
+
instructions:
|
|
65
|
+
'You are a helpful assistant. Use search_skills to find relevant skills, then load_skill to load their instructions.',
|
|
66
|
+
model: 'openai/gpt-4o',
|
|
67
|
+
workspace,
|
|
68
|
+
inputProcessors: [skillSearch],
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The agent workflow is:
|
|
73
|
+
|
|
74
|
+
1. Agent receives a user message
|
|
75
|
+
2. Agent calls `search_skills` with keywords (e.g., "api design")
|
|
76
|
+
3. Agent reviews results and calls `load_skill` with the skill name
|
|
77
|
+
4. The skill's instructions appear as system messages on the next turn
|
|
78
|
+
5. Agent follows the loaded skill's instructions
|
|
79
|
+
|
|
80
|
+
## Compared to SkillsProcessor
|
|
81
|
+
|
|
82
|
+
| | SkillsProcessor | SkillSearchProcessor |
|
|
83
|
+
| -------------- | -------------------------- | ---------------------------------- |
|
|
84
|
+
| Scaling | Injects all skills upfront | On-demand discovery |
|
|
85
|
+
| Context usage | Grows with skill count | Constant (only loaded skills) |
|
|
86
|
+
| Agent workflow | Skills always visible | Agent searches and loads as needed |
|
|
87
|
+
| Best for | Few skills (< 10) | Many skills (10+) |
|
|
88
|
+
|
|
89
|
+
## Related
|
|
90
|
+
|
|
91
|
+
- [ToolSearchProcessor](https://mastra.ai/reference/processors/tool-search-processor)
|
|
92
|
+
- [Processors](https://mastra.ai/docs/agents/processors)
|
|
93
|
+
- [Workspace Skills](https://mastra.ai/docs/workspace/overview)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.17-alpha.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067), [`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778)]:
|
|
8
|
+
- @mastra/core@1.18.0-alpha.0
|
|
9
|
+
|
|
10
|
+
## 1.1.17-alpha.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`86e3263`](https://github.com/mastra-ai/mastra/commit/86e326363edd12be5a5b25ccce4a39f66f7c9f50), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778)]:
|
|
15
|
+
- @mastra/core@1.17.0-alpha.2
|
|
16
|
+
|
|
3
17
|
## 1.1.17-alpha.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.17-alpha.
|
|
3
|
+
"version": "1.1.17-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",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@mastra/
|
|
33
|
-
"@mastra/
|
|
32
|
+
"@mastra/core": "1.18.0-alpha.0",
|
|
33
|
+
"@mastra/mcp": "^1.3.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@hono/node-server": "^1.19.11",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "4.0.18",
|
|
49
49
|
"@internal/lint": "0.0.74",
|
|
50
50
|
"@internal/types-builder": "0.0.49",
|
|
51
|
-
"@mastra/core": "1.
|
|
51
|
+
"@mastra/core": "1.18.0-alpha.0"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|