@mastra/mcp-docs-server 1.2.18-alpha.3 → 1.2.18-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.
- package/.docs/docs/mastra-platform/workspaces.md +6 -3
- package/.docs/docs/sandbox/filesystem.md +120 -139
- package/.docs/docs/sandbox/lsp.md +195 -143
- package/.docs/docs/sandbox/overview.md +103 -69
- package/.docs/docs/sandbox/search.md +172 -153
- package/.docs/docs/sandbox/skills.md +94 -151
- package/.docs/integrations/deploy/render.md +136 -89
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/edenai.md +2 -3
- package/.docs/models/providers/empiriolabs.md +1 -1
- package/.docs/models/providers/kilo.md +2 -2
- package/.docs/models/providers/llmgateway.md +2 -1
- package/.docs/models/providers/nano-gpt.md +3 -1
- package/.docs/models/providers/ofox.md +1 -1
- package/.docs/models/providers/opencode.md +65 -65
- package/.docs/reference/observability/tracing/exporters/langfuse.md +2 -0
- package/.docs/reference/rag/metadata-filters.md +16 -8
- package/.docs/reference/rag/retrieval.md +113 -5
- package/CHANGELOG.md +7 -0
- package/package.json +3 -3
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Filesystem-backed skills
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Filesystem-backed skills are directories of reusable instructions and supporting files. Mastra discovers them from paths in the `skills` option, then makes them available to every agent using that configuration. Skills follow the [Agent Skills specification](https://agentskills.io).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## When to use skills
|
|
10
|
-
|
|
11
|
-
Use workspace skills when your agent needs to:
|
|
12
|
-
|
|
13
|
-
- Follow repeatable instructions for specialized tasks
|
|
14
|
-
- Load detailed guidance only when it becomes relevant
|
|
15
|
-
- Share instructions, reference files, scripts, and assets across agents
|
|
16
|
-
- Discover capabilities from one or more directories
|
|
17
|
-
- Search skill content alongside other workspace content
|
|
7
|
+
Use [agent skills](https://mastra.ai/docs/skills) instead when you want to define a skill directly in one agent's code. An agent can use both types. If a direct agent skill and a filesystem-backed skill have the same name, the direct agent skill takes precedence.
|
|
18
8
|
|
|
19
9
|
## Quickstart
|
|
20
10
|
|
|
21
|
-
Create a
|
|
11
|
+
Create a directory with a `SKILL.md` file:
|
|
22
12
|
|
|
23
13
|
```markdown
|
|
24
14
|
---
|
|
@@ -31,203 +21,156 @@ description: Reviews code for bugs and readability issues
|
|
|
31
21
|
Check the code for bugs, missing error handling, and unclear naming.
|
|
32
22
|
```
|
|
33
23
|
|
|
34
|
-
Configure the
|
|
24
|
+
Configure the directory:
|
|
35
25
|
|
|
36
26
|
```typescript
|
|
37
|
-
import {
|
|
27
|
+
import { LocalFilesystem, Workspace } from '@mastra/core/workspace'
|
|
38
28
|
|
|
39
|
-
const workspace = new Workspace({
|
|
40
|
-
filesystem: new LocalFilesystem({
|
|
29
|
+
export const workspace = new Workspace({
|
|
30
|
+
filesystem: new LocalFilesystem({
|
|
31
|
+
basePath: './workspace',
|
|
32
|
+
}),
|
|
41
33
|
skills: ['skills'],
|
|
42
34
|
})
|
|
43
35
|
```
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
The `skills` path is relative to the filesystem root, so Mastra discovers `./workspace/skills/code-review/SKILL.md`. An agent using this configuration can now discover and load `code-review` when a request needs it.
|
|
46
38
|
|
|
47
39
|
## Skill structure
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- `SKILL.md`: Instructions and metadata for the agent
|
|
52
|
-
- `references/`: Supporting documentation (optional)
|
|
53
|
-
- `scripts/`: Executable scripts (optional)
|
|
54
|
-
- `assets/`: Images and other files (optional)
|
|
41
|
+
Each skill is a directory with a required `SKILL.md` file. It can also contain supporting files:
|
|
55
42
|
|
|
56
43
|
```plaintext
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
44
|
+
code-review/
|
|
45
|
+
SKILL.md
|
|
46
|
+
references/
|
|
47
|
+
style-guide.md
|
|
48
|
+
scripts/
|
|
49
|
+
lint.ts
|
|
50
|
+
assets/
|
|
51
|
+
review-template.md
|
|
65
52
|
```
|
|
66
53
|
|
|
67
|
-
|
|
54
|
+
- `SKILL.md`: Metadata and instructions that Mastra loads when the agent selects the skill
|
|
55
|
+
- `references/`: Documentation that the agent can read or search as needed
|
|
56
|
+
- `scripts/`: Scripts used by the skill
|
|
57
|
+
- `assets/`: Templates, images, and other supporting files
|
|
68
58
|
|
|
69
|
-
|
|
59
|
+
Keep the main workflow in `SKILL.md`. Move detailed material to `references/` so the agent only reads it when needed.
|
|
70
60
|
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
name: code-review
|
|
74
|
-
description: Reviews code for quality, style, and potential issues
|
|
75
|
-
version: 1.0.0
|
|
76
|
-
tags:
|
|
77
|
-
- development
|
|
78
|
-
- review
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
# Code Review
|
|
82
|
-
|
|
83
|
-
You are a code reviewer. When reviewing code:
|
|
84
|
-
|
|
85
|
-
1. Check for bugs and edge cases
|
|
86
|
-
2. Verify the code follows the style guide in references/style-guide.md
|
|
87
|
-
3. Suggest improvements for readability
|
|
88
|
-
4. Run the linter using scripts/lint.ts
|
|
89
|
-
|
|
90
|
-
## What to look out for
|
|
91
|
-
|
|
92
|
-
- Unused variables and imports
|
|
93
|
-
- Missing error handling
|
|
94
|
-
- Security vulnerabilities
|
|
95
|
-
- Performance issues
|
|
96
|
-
```
|
|
61
|
+
## `SKILL.md` format
|
|
97
62
|
|
|
98
|
-
|
|
63
|
+
The YAML frontmatter requires `name` and `description`. The `name` must match the skill directory name, contain at most 64 lowercase letters, numbers, or hyphens, not start or end with a hyphen, and not contain consecutive hyphens. The Markdown body contains the instructions returned to the agent when it loads the skill.
|
|
99
64
|
|
|
100
|
-
|
|
65
|
+
Mastra also reads the optional `license`, `compatibility`, `user-invocable`, and `metadata` fields. See the [Agent Skills specification](https://agentskills.io/specification) for the complete package format and field guidance.
|
|
101
66
|
|
|
102
|
-
|
|
103
|
-
const workspace = new Workspace({
|
|
104
|
-
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
105
|
-
skills: [
|
|
106
|
-
'skills', // Project skills
|
|
107
|
-
'team-skills', // Shared team skills
|
|
108
|
-
],
|
|
109
|
-
})
|
|
110
|
-
```
|
|
67
|
+
## How agents use skills
|
|
111
68
|
|
|
112
|
-
|
|
69
|
+
When skills are configured, Mastra adds each skill's name, description, path, and source type to the system message. This lets the agent discover available skills without loading every instruction file into its context.
|
|
113
70
|
|
|
114
|
-
|
|
115
|
-
const workspace = new Workspace({
|
|
116
|
-
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
117
|
-
skills: ['path/to/my-skill'],
|
|
118
|
-
})
|
|
119
|
-
```
|
|
71
|
+
Mastra also gives the agent three tools:
|
|
120
72
|
|
|
121
|
-
|
|
73
|
+
| Tool | Does |
|
|
74
|
+
| -------------- | ----------------------------------------------------------------------------------------- |
|
|
75
|
+
| `skill` | Loads a skill's `SKILL.md` instructions and lists its reference, script, and asset files. |
|
|
76
|
+
| `skill_read` | Reads all or part of any file under the selected skill directory. |
|
|
77
|
+
| `skill_search` | Searches skill instructions and reference files. |
|
|
122
78
|
|
|
123
|
-
|
|
124
|
-
const workspace = new Workspace({
|
|
125
|
-
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
126
|
-
skills: ['./**/skills'],
|
|
127
|
-
})
|
|
128
|
-
```
|
|
79
|
+
Loading is stateless. The instructions remain in the conversation as a tool result, and the agent can call `skill` again if they leave the context after compaction.
|
|
129
80
|
|
|
130
|
-
##
|
|
81
|
+
## Configure skill paths
|
|
131
82
|
|
|
132
|
-
|
|
83
|
+
The `skills` array accepts several path forms:
|
|
133
84
|
|
|
134
|
-
|
|
85
|
+
| Path | Discovery behavior |
|
|
86
|
+
| ----------------------------- | ----------------------------------------------------------------- |
|
|
87
|
+
| `skills` | Scans each immediate subdirectory for a `SKILL.md` file. |
|
|
88
|
+
| `skills/code-review` | Loads one skill directory directly. |
|
|
89
|
+
| `skills/code-review/SKILL.md` | Loads one skill file directly. |
|
|
90
|
+
| `./**/skills` | Finds matching directories, then discovers skills under each one. |
|
|
91
|
+
| `./**/SKILL.md` | Finds and loads matching skill files. |
|
|
135
92
|
|
|
136
|
-
|
|
137
|
-
- **`skill_read`**: Reads a file from a skill's `references/`, `scripts/`, or `assets/` directory.
|
|
138
|
-
- **`skill_search`**: Searches across all skill content. Uses BM25 or vector search when configured, otherwise falls back to basic text matching.
|
|
93
|
+
Add more entries to discover skills from several roots, such as project, team, or package directories.
|
|
139
94
|
|
|
140
|
-
|
|
95
|
+
Glob traversal is limited to four directory levels below the glob base.
|
|
141
96
|
|
|
142
|
-
|
|
97
|
+
Paths use the configured filesystem when one is available. Without a filesystem, Mastra reads them from local disk relative to the application process's current working directory. An explicit [`skillSource`](#custom-skill-sources) replaces both defaults.
|
|
143
98
|
|
|
144
99
|
## Same-named skills
|
|
145
100
|
|
|
146
|
-
|
|
101
|
+
Mastra lists every distinct filesystem-backed skill in the system message, including its path and source type. If several skills have the same name, a lookup by name uses this priority:
|
|
147
102
|
|
|
148
|
-
|
|
103
|
+
1. Local project paths
|
|
104
|
+
2. Managed paths under `.mastra/skills`
|
|
105
|
+
3. External paths under `node_modules`
|
|
149
106
|
|
|
150
|
-
|
|
151
|
-
2. **Unresolvable conflicts throw**: if two skills share the same name and the same source type (for example, two local skills that both use the name `brand-guidelines`), `get()` throws an error. Rename one or move it to a different source type to resolve the conflict.
|
|
152
|
-
3. **Path escape hatch**: the agent can pass a skill's full path instead of its name to activate a specific skill, bypassing tie-breaking entirely.
|
|
107
|
+
If multiple highest-priority candidates have the same source type, Mastra can't choose between them and throws an error. Rename one skill or move it to a different source type.
|
|
153
108
|
|
|
154
|
-
|
|
155
|
-
const workspace = new Workspace({
|
|
156
|
-
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
157
|
-
skills: [
|
|
158
|
-
'node_modules/@myorg/skills', // external: provides "brand-guidelines"
|
|
159
|
-
'skills', // local: also provides "brand-guidelines"
|
|
160
|
-
],
|
|
161
|
-
})
|
|
109
|
+
The agent can bypass name-based resolution by passing the exact path shown in the system message to `skill` or `skill_read`. Paths with or without the trailing `/SKILL.md` work. If several configured paths resolve to the same canonical directory, Mastra treats them as aliases and lists the skill once.
|
|
162
110
|
|
|
163
|
-
|
|
164
|
-
// get('node_modules/@myorg/skills/brand-guidelines') returns the external copy
|
|
165
|
-
```
|
|
111
|
+
Direct [agent skills](https://mastra.ai/docs/skills) are resolved before filesystem-backed skills, so a direct skill wins when both types use the same name.
|
|
166
112
|
|
|
167
|
-
##
|
|
113
|
+
## Search skill content
|
|
168
114
|
|
|
169
|
-
|
|
115
|
+
When [BM25 or vector search](https://mastra.ai/docs/sandbox/search) is configured alongside skills, Mastra automatically indexes each skill's `SKILL.md` instructions and reference files. Scripts and assets aren't indexed.
|
|
170
116
|
|
|
171
|
-
|
|
172
|
-
const workspace = new Workspace({
|
|
173
|
-
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
174
|
-
skills: ['skills'],
|
|
175
|
-
bm25: true,
|
|
176
|
-
})
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## Custom skill source
|
|
117
|
+
Without BM25 or vector search, `skill_search` falls back to case-insensitive text matching across the instructions and references. This keeps skill search available without a separate search configuration, while indexed search provides ranking and semantic retrieval for larger collections.
|
|
180
118
|
|
|
181
|
-
|
|
119
|
+
## Dynamic skill paths
|
|
182
120
|
|
|
183
|
-
|
|
121
|
+
Pass a synchronous or asynchronous function when the available paths depend on request context. This example adds development skills for users with the `developer` role:
|
|
184
122
|
|
|
185
123
|
```typescript
|
|
186
|
-
import {
|
|
187
|
-
import { VersionedSkillSource } from '@mastra/core/workspace'
|
|
124
|
+
import { LocalFilesystem, Workspace } from '@mastra/core/workspace'
|
|
188
125
|
|
|
189
126
|
const workspace = new Workspace({
|
|
190
127
|
filesystem: new LocalFilesystem({ basePath: './workspace' }),
|
|
191
|
-
skills:
|
|
192
|
-
|
|
193
|
-
})
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
`VersionedSkillSource` accepts three parameters:
|
|
197
|
-
|
|
198
|
-
- **`versionTree`** (`SkillVersionTree`): A manifest mapping relative file paths to blob entries (`{ entries: Record<string, { blobHash, size, mimeType?, encoding? }> }`).
|
|
199
|
-
- **`blobStore`** (`BlobStore`): A content-addressable blob store instance that holds the actual file contents referenced by hash.
|
|
200
|
-
- **`versionCreatedAt`** (`Date`): The timestamp when this skill version was published. Used as the modification time for all files in the version.
|
|
128
|
+
skills: ({ requestContext }) => {
|
|
129
|
+
const paths = ['skills']
|
|
201
130
|
|
|
202
|
-
|
|
131
|
+
if (requestContext?.get('user-role') === 'developer') {
|
|
132
|
+
paths.push('developer-skills')
|
|
133
|
+
}
|
|
203
134
|
|
|
204
|
-
|
|
135
|
+
return paths
|
|
136
|
+
},
|
|
137
|
+
})
|
|
138
|
+
```
|
|
205
139
|
|
|
206
|
-
|
|
140
|
+
Mastra resolves the function for each execution and gives the agent the skill set for that request. The returned paths support the same directory, file, and glob forms as a static array.
|
|
207
141
|
|
|
208
|
-
|
|
142
|
+
## Custom skill sources
|
|
209
143
|
|
|
210
|
-
|
|
144
|
+
Set `skillSource` when skills should come from a backend other than the configured filesystem or local disk. A custom source handles skill discovery and file reads for every configured path.
|
|
211
145
|
|
|
212
|
-
For
|
|
146
|
+
For example, `CompositeVersionedSkillSource` mounts published skill versions from a content-addressable blob store under directories where Mastra can discover them:
|
|
213
147
|
|
|
214
148
|
```typescript
|
|
149
|
+
import { CompositeVersionedSkillSource, Workspace } from '@mastra/core/workspace'
|
|
150
|
+
|
|
151
|
+
const skillSource = new CompositeVersionedSkillSource(
|
|
152
|
+
[
|
|
153
|
+
{
|
|
154
|
+
dirName: 'code-review',
|
|
155
|
+
tree: versionTree,
|
|
156
|
+
versionCreatedAt,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
blobStore,
|
|
160
|
+
)
|
|
161
|
+
|
|
215
162
|
const workspace = new Workspace({
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const paths = ['skills']
|
|
219
|
-
if (ctx.requestContext?.get('userRole') === 'developer') {
|
|
220
|
-
paths.push('dev-skills')
|
|
221
|
-
}
|
|
222
|
-
return paths
|
|
223
|
-
},
|
|
163
|
+
skills: ['.'],
|
|
164
|
+
skillSource,
|
|
224
165
|
})
|
|
225
166
|
```
|
|
226
167
|
|
|
168
|
+
An explicit `skillSource` doesn't fall back to the configured filesystem or local disk when a path is missing. See the [configuration reference](https://mastra.ai/reference/workspace/workspace-class) for the source interface and related options.
|
|
169
|
+
|
|
227
170
|
## Related
|
|
228
171
|
|
|
229
172
|
- [Agent skills](https://mastra.ai/docs/skills)
|
|
230
|
-
- [Agent
|
|
231
|
-
- [
|
|
173
|
+
- [Agent Skills specification](https://agentskills.io)
|
|
174
|
+
- [Sandboxes](https://mastra.ai/docs/sandbox/overview)
|
|
232
175
|
- [Search and indexing](https://mastra.ai/docs/sandbox/search)
|
|
233
176
|
- [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill)
|