@mastra/mcp-docs-server 1.2.13-alpha.8 → 1.2.13
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/agents/overview.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +29 -0
- package/.docs/docs/capabilities/channels/imessage.md +181 -0
- package/.docs/docs/capabilities/channels/overview.md +1 -0
- package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
- package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +59 -2
- package/.docs/docs/editor/overview.md +201 -206
- package/.docs/docs/evals/evals-with-memory.md +1 -1
- package/.docs/docs/getting-started/develop.md +196 -0
- package/.docs/docs/index.md +78 -1
- package/.docs/docs/mastra-platform/workspaces.md +13 -13
- package/.docs/docs/memory/observational-memory.md +23 -0
- package/.docs/docs/studio/observability.md +4 -0
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/getting-started/quickstart.md +3 -3
- package/.docs/{docs → guides}/rag/chunking-and-embedding.md +1 -1
- package/.docs/{docs → guides}/rag/graph-rag.md +1 -1
- package/.docs/{docs → guides}/rag/overview.md +2 -2
- package/.docs/{docs → guides}/rag/retrieval.md +1 -1
- package/.docs/{docs → guides}/voice/overview.md +4 -4
- package/.docs/{docs → guides}/voice/realtime-voice.md +2 -2
- package/.docs/{docs → guides}/voice/speech-to-speech.md +1 -1
- package/.docs/{docs → guides}/voice/speech-to-text.md +1 -1
- package/.docs/{docs → guides}/voice/text-to-speech.md +2 -2
- package/.docs/models/embeddings.md +63 -65
- package/.docs/models/environment-variables.md +5 -1
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +5 -3
- package/.docs/models/gateways/vercel.md +8 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +3 -1
- package/.docs/models/providers/alibaba-token-plan-cn.md +27 -25
- package/.docs/models/providers/alibaba-token-plan.md +27 -25
- package/.docs/models/providers/alibaba.md +2 -1
- package/.docs/models/providers/ambient.md +13 -12
- package/.docs/models/providers/baseten.md +3 -1
- package/.docs/models/providers/chutes.md +6 -8
- package/.docs/models/providers/crof.md +2 -1
- package/.docs/models/providers/crossmodel.md +7 -3
- package/.docs/models/providers/deepinfra.md +9 -2
- package/.docs/models/providers/digitalocean.md +34 -27
- package/.docs/models/providers/empiriolabs.md +4 -1
- package/.docs/models/providers/fireworks-ai.md +20 -19
- package/.docs/models/providers/greenpt.md +17 -8
- package/.docs/models/providers/groq.md +20 -20
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +9 -7
- package/.docs/models/providers/impossibl.md +148 -0
- package/.docs/models/providers/infomaniak.md +83 -0
- package/.docs/models/providers/kilo.md +349 -350
- package/.docs/models/providers/llmgateway.md +6 -3
- package/.docs/models/providers/mistral.md +5 -2
- package/.docs/models/providers/modal.md +5 -4
- package/.docs/models/providers/modelis.md +81 -0
- package/.docs/models/providers/nano-gpt.md +146 -148
- package/.docs/models/providers/neuralwatt.md +2 -1
- package/.docs/models/providers/ofox.md +2 -2
- package/.docs/models/providers/ollama-cloud.md +23 -22
- package/.docs/models/providers/opencode-go.md +3 -2
- package/.docs/models/providers/requesty.md +54 -45
- package/.docs/models/providers/scx.md +74 -0
- package/.docs/models/providers/tensorx.md +97 -0
- package/.docs/models/providers/togetherai.md +2 -1
- package/.docs/models/providers/umans-ai-coding-plan.md +11 -9
- package/.docs/models/providers/umans-ai.md +11 -9
- package/.docs/models/providers/wandb.md +2 -2
- package/.docs/models/providers/zai-coding-plan.md +11 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
- package/.docs/models/providers.md +5 -1
- package/.docs/reference/agents/agent.md +1 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/{docs/getting-started → reference}/build-with-ai.md +5 -110
- package/.docs/reference/cli/create-mastra.md +2 -0
- package/.docs/reference/cli/mastra.md +66 -1
- package/.docs/reference/client-js/agents.md +1 -1
- package/.docs/reference/configuration.md +2 -2
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/datasets/startExperiment.md +6 -0
- package/.docs/reference/datasets/startExperimentAsync.md +4 -0
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +31 -18
- package/.docs/reference/editor/prompt-blocks.md +137 -0
- package/.docs/reference/editor/sandbox-provider.md +1 -1
- package/.docs/reference/editor/storage-browser-ref.md +3 -3
- package/.docs/reference/editor/storage-workspace-ref.md +3 -3
- package/.docs/reference/editor/tool-provider.md +44 -10
- package/.docs/reference/editor/tools.md +100 -0
- package/.docs/reference/editor/versioning.md +130 -0
- package/.docs/reference/evals/mastra-scorer.md +68 -8
- package/.docs/reference/file-based-agents/config.md +39 -1
- package/.docs/reference/index.md +3 -4
- package/.docs/reference/memory/observational-memory.md +3 -1
- package/.docs/reference/memory/serialized-memory-config.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +3 -1
- package/.docs/reference/processors/token-limiter-processor.md +15 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/reference/storage/composite.md +2 -0
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/voice/livekit.md +3 -3
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +5 -5
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/package.json +6 -6
- package/.docs/docs/agent-builder/access-control.md +0 -99
- package/.docs/docs/agent-builder/browser.md +0 -63
- package/.docs/docs/agent-builder/channels.md +0 -78
- package/.docs/docs/agent-builder/configuration.md +0 -132
- package/.docs/docs/agent-builder/deploying.md +0 -124
- package/.docs/docs/agent-builder/integrations.md +0 -115
- package/.docs/docs/agent-builder/memory.md +0 -69
- package/.docs/docs/agent-builder/model-policy.md +0 -50
- package/.docs/docs/agent-builder/overview.md +0 -114
- package/.docs/docs/agent-builder/skill-registries.md +0 -31
- package/.docs/docs/agent-builder/workspace.md +0 -62
- package/.docs/docs/editor/prompts.md +0 -140
- package/.docs/docs/editor/tools.md +0 -148
- package/.docs/docs/getting-started/file-based-agents.md +0 -121
- package/.docs/docs/what-is-mastra.md +0 -161
- package/.docs/reference/client-js/agent-builder.md +0 -163
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +0 -76
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +0 -79
- package/.docs/reference/editor/agent-builder/builder-models.md +0 -66
- /package/.docs/{docs → guides}/getting-started/manual-install.md +0 -0
- /package/.docs/{docs → guides}/rag/vector-databases.md +0 -0
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "zhipuai-coding-plan/glm-4.
|
|
20
|
+
model: "zhipuai-coding-plan/glm-4.6v"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -34,15 +34,15 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
## Models
|
|
36
36
|
|
|
37
|
-
| Model
|
|
38
|
-
|
|
|
39
|
-
| `zhipuai-coding-plan/glm-4.
|
|
40
|
-
| `zhipuai-coding-plan/glm-4.
|
|
41
|
-
| `zhipuai-coding-plan/glm-
|
|
42
|
-
| `zhipuai-coding-plan/glm-5
|
|
43
|
-
| `zhipuai-coding-plan/glm-5.
|
|
44
|
-
| `zhipuai-coding-plan/glm-5.2`
|
|
45
|
-
| `zhipuai-coding-plan/glm-5v-turbo`
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| --------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `zhipuai-coding-plan/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
40
|
+
| `zhipuai-coding-plan/glm-4.7` | 205K | | | | | | — | — |
|
|
41
|
+
| `zhipuai-coding-plan/glm-5-turbo` | 200K | | | | | | — | — |
|
|
42
|
+
| `zhipuai-coding-plan/glm-5.1` | 200K | | | | | | — | — |
|
|
43
|
+
| `zhipuai-coding-plan/glm-5.2` | 1.0M | | | | | | — | — |
|
|
44
|
+
| `zhipuai-coding-plan/glm-5.2-highspeed` | 1.0M | | | | | | — | — |
|
|
45
|
+
| `zhipuai-coding-plan/glm-5v-turbo` | 200K | | | | | | — | — |
|
|
46
46
|
|
|
47
47
|
## Advanced configuration
|
|
48
48
|
|
|
@@ -54,7 +54,7 @@ const agent = new Agent({
|
|
|
54
54
|
name: "custom-agent",
|
|
55
55
|
model: {
|
|
56
56
|
url: "https://open.bigmodel.cn/api/coding/paas/v4",
|
|
57
|
-
id: "zhipuai-coding-plan/glm-4.
|
|
57
|
+
id: "zhipuai-coding-plan/glm-4.6v",
|
|
58
58
|
apiKey: process.env.ZHIPU_API_KEY,
|
|
59
59
|
headers: {
|
|
60
60
|
"X-Custom-Header": "value"
|
|
@@ -73,7 +73,7 @@ const agent = new Agent({
|
|
|
73
73
|
const useAdvanced = requestContext.task === "complex";
|
|
74
74
|
return useAdvanced
|
|
75
75
|
? "zhipuai-coding-plan/glm-5v-turbo"
|
|
76
|
-
: "zhipuai-coding-plan/glm-4.
|
|
76
|
+
: "zhipuai-coding-plan/glm-4.6v";
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
```
|
|
@@ -56,7 +56,6 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
56
56
|
- [FreeModel](https://mastra.ai/models/providers/freemodel)
|
|
57
57
|
- [Friendli](https://mastra.ai/models/providers/friendli)
|
|
58
58
|
- [FrogBot](https://mastra.ai/models/providers/frogbot)
|
|
59
|
-
- [GitHub Models](https://mastra.ai/models/providers/github-models)
|
|
60
59
|
- [GMI Cloud](https://mastra.ai/models/providers/gmicloud)
|
|
61
60
|
- [GreenPT](https://mastra.ai/models/providers/greenpt)
|
|
62
61
|
- [Helicone](https://mastra.ai/models/providers/helicone)
|
|
@@ -64,10 +63,12 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
64
63
|
- [HPC-AI](https://mastra.ai/models/providers/hpc-ai)
|
|
65
64
|
- [Hugging Face](https://mastra.ai/models/providers/huggingface)
|
|
66
65
|
- [iFlow](https://mastra.ai/models/providers/iflowcn)
|
|
66
|
+
- [Impossibl](https://mastra.ai/models/providers/impossibl)
|
|
67
67
|
- [Inception](https://mastra.ai/models/providers/inception)
|
|
68
68
|
- [Inceptron](https://mastra.ai/models/providers/inceptron)
|
|
69
69
|
- [Inference](https://mastra.ai/models/providers/inference)
|
|
70
70
|
- [InferX](https://mastra.ai/models/providers/inferx)
|
|
71
|
+
- [Infomaniak](https://mastra.ai/models/providers/infomaniak)
|
|
71
72
|
- [IO.NET](https://mastra.ai/models/providers/io-net)
|
|
72
73
|
- [Jiekou.AI](https://mastra.ai/models/providers/jiekou)
|
|
73
74
|
- [Kenari](https://mastra.ai/models/providers/kenari)
|
|
@@ -92,6 +93,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
92
93
|
- [Moark](https://mastra.ai/models/providers/moark)
|
|
93
94
|
- [Modal](https://mastra.ai/models/providers/modal)
|
|
94
95
|
- [Model Oracle AI](https://mastra.ai/models/providers/model-oracle-ai)
|
|
96
|
+
- [Modelis](https://mastra.ai/models/providers/modelis)
|
|
95
97
|
- [ModelScope](https://mastra.ai/models/providers/modelscope)
|
|
96
98
|
- [Moonshot AI](https://mastra.ai/models/providers/moonshotai)
|
|
97
99
|
- [Moonshot AI (China)](https://mastra.ai/models/providers/moonshotai-cn)
|
|
@@ -124,6 +126,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
124
126
|
- [Sakana AI](https://mastra.ai/models/providers/sakana)
|
|
125
127
|
- [Sarvam AI](https://mastra.ai/models/providers/sarvam)
|
|
126
128
|
- [Scaleway](https://mastra.ai/models/providers/scaleway)
|
|
129
|
+
- [SCX.ai](https://mastra.ai/models/providers/scx)
|
|
127
130
|
- [SiliconFlow](https://mastra.ai/models/providers/siliconflow)
|
|
128
131
|
- [SiliconFlow (China)](https://mastra.ai/models/providers/siliconflow-cn)
|
|
129
132
|
- [Snowflake Cortex](https://mastra.ai/models/providers/snowflake-cortex)
|
|
@@ -138,6 +141,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
138
141
|
- [Tencent Coding Plan (China)](https://mastra.ai/models/providers/tencent-coding-plan)
|
|
139
142
|
- [Tencent Token Plan](https://mastra.ai/models/providers/tencent-token-plan)
|
|
140
143
|
- [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
|
|
144
|
+
- [TensorX](https://mastra.ai/models/providers/tensorx)
|
|
141
145
|
- [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
|
|
142
146
|
- [Thinking Machines](https://mastra.ai/models/providers/thinkingmachines)
|
|
143
147
|
- [Tinfoil](https://mastra.ai/models/providers/tinfoil)
|
|
@@ -564,7 +564,7 @@ When you register the [`MastraEditor`](https://mastra.ai/reference/editor/mastra
|
|
|
564
564
|
|
|
565
565
|
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean } }`): Omit to allow editing instructions and tools. Set to false to lock the agent. Set instructions: true to allow instruction edits. Set tools: true to allow tool membership and description edits, or tools: { description: true } to allow only description edits.
|
|
566
566
|
|
|
567
|
-
The agent's `id`, `name`, and `model` always come from code and can't be overridden through
|
|
567
|
+
The agent's `id`, `name`, and `model` always come from code and can't be overridden through Editor. See [Editor](https://mastra.ai/docs/editor/overview) for usage.
|
|
568
568
|
|
|
569
569
|
## Returns
|
|
570
570
|
|
|
@@ -214,7 +214,7 @@ const result = await agent.generate('message for agent')
|
|
|
214
214
|
|
|
215
215
|
**options.tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
216
216
|
|
|
217
|
-
**options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See
|
|
217
|
+
**options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See Editor versioning.
|
|
218
218
|
|
|
219
219
|
**options.versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors.
|
|
220
220
|
|
|
@@ -2,110 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Build with AI
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
To give your agent access to Mastra's documentation, we recommend using **skills**. While the MCP docs server also provides this information, skills will perform better. Use the MCP docs server when you need its tools, e.g. the migration tool.
|
|
8
|
-
|
|
9
|
-
## Mastra skills
|
|
10
|
-
|
|
11
|
-
Agent Skills are folders of instructions, scripts, and resources that agents can discover and use to do things accurately and efficiently. Mastra skills contain setup instructions, best practices, CLI commands, and instructions on how to fetch up-to-date information from Mastra's documentation.
|
|
12
|
-
|
|
13
|
-
To install all available Mastra skills, run the following command:
|
|
14
|
-
|
|
15
|
-
**npm**:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx skills add mastra-ai/skills
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**pnpm**:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm dlx skills add mastra-ai/skills
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Yarn**:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
yarn dlx skills add mastra-ai/skills
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Bun**:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
bun x skills add mastra-ai/skills
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Mastra skills work with any coding agent that supports the [Skills standard](https://agentskills.io/), including Claude Code, Cursor, Codex, OpenCode, and others.
|
|
40
|
-
|
|
41
|
-
They're also available on [GitHub](https://github.com/mastra-ai/skills).
|
|
42
|
-
|
|
43
|
-
### Update skill
|
|
44
|
-
|
|
45
|
-
To update to the latest version of the Mastra skill, run:
|
|
46
|
-
|
|
47
|
-
**npm**:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
npx skills update mastra
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**pnpm**:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm dlx skills update mastra
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**Yarn**:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
yarn dlx skills update mastra
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Bun**:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
bun x skills update mastra
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Mastra CLI
|
|
72
|
-
|
|
73
|
-
The [Mastra CLI](https://mastra.ai/reference/cli/mastra) gives your coding agent a direct line to your Mastra runtime.
|
|
74
|
-
|
|
75
|
-
Agents can invoke other agents and run workflows. They can execute tools and inspect memory. They can also run evals or query traces and logs.
|
|
76
|
-
|
|
77
|
-
**npm**:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npm install mastra@latest -g
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**pnpm**:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
pnpm add mastra@latest -g
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Yarn**:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
yarn global add mastra@latest
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Bun**:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
bun add mastra@latest --global
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
For example, your coding agent can run an agent, then pull traces to inspect the results:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
mastra api --url http://localhost:4111 agent run weather-agent '{"messages":"What is the weather in London?"}'
|
|
105
|
-
mastra api --url http://localhost:4111 trace list
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Install the [Mastra skills](#mastra-skills) to teach your agent how to use the CLI. See the [CLI commands reference](https://mastra.ai/reference/cli/mastra) for the full list of available commands.
|
|
5
|
+
For everyday AI-assisted development with Mastra skills and the CLI, see [Develop](https://mastra.ai/docs/getting-started/develop). This page covers other ways to give coding agents access to Mastra documentation.
|
|
109
6
|
|
|
110
7
|
## Embedded package docs
|
|
111
8
|
|
|
@@ -130,12 +27,10 @@ Examples for the [introduction page](https://mastra.ai/docs):
|
|
|
130
27
|
- [`/docs/llms.txt`](https://mastra.ai/docs/llms.txt)
|
|
131
28
|
- [`/docs.md`](https://mastra.ai/docs.md)
|
|
132
29
|
|
|
133
|
-
## Mastra's documentation
|
|
134
|
-
|
|
135
|
-
In addition to the [context files](#context-files) each documentation page also features a "Copy markdown" button at the top of the page. It'll copy the streamlined markdown version to your clipboard. Beside it, you'll find a dropdown menu to open the page on GitHub, in ChatGPT, Claude, and others.
|
|
136
|
-
|
|
137
30
|
## MCP docs server
|
|
138
31
|
|
|
32
|
+
> **Warning:** The MCP docs server isn't recommended for everyday development. Use the [Mastra skill](https://mastra.ai/docs/getting-started/develop) instead because it's more up to date and performs better.
|
|
33
|
+
|
|
139
34
|
The `@mastra/mcp-docs-server` package provides direct local access to Mastra’s full documentation via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro). It works with Cursor, Windsurf, Cline, Claude Code, VS Code, Codex or any tool that supports MCP.
|
|
140
35
|
|
|
141
36
|
These tools are designed to help agents retrieve precise, task-specific information, whether you're adding a feature to an agent or scaffolding a new project, or alternatively exploring how something works.
|
|
@@ -144,7 +39,7 @@ If you're unable to use a local MCP server and need to connect to a remote serve
|
|
|
144
39
|
|
|
145
40
|
### Installation
|
|
146
41
|
|
|
147
|
-
The [`create-mastra`](https://mastra.ai/reference/cli/create-mastra) command
|
|
42
|
+
The [`create-mastra`](https://mastra.ai/reference/cli/create-mastra) command doesn't configure the MCP docs server. Add the server manually when you need MCP-specific tools such as the migration tool.
|
|
148
43
|
|
|
149
44
|
If there are no specific instructions for your tool below, you may be able to add the MCP server with this common JSON configuration.
|
|
150
45
|
|
|
@@ -354,7 +249,7 @@ Once configured, you can ask your AI tool questions about Mastra or instruct it
|
|
|
354
249
|
- "How does working memory behave in Mastra and how can I use it to do `[task]`? It doesn't seem to work the way I expect."
|
|
355
250
|
- "I saw there are new workflow features, explain them to me and then update `[workflow]` to use them."
|
|
356
251
|
|
|
357
|
-
|
|
252
|
+
### Troubleshooting
|
|
358
253
|
|
|
359
254
|
1. **Server Not Starting**
|
|
360
255
|
|
|
@@ -201,6 +201,8 @@ Invalid input is rejected before templates are fetched or files are created.
|
|
|
201
201
|
|
|
202
202
|
**--no-git** (`boolean`): Skip automatic Git initialization and the initial commit.
|
|
203
203
|
|
|
204
|
+
**--no-install** (`boolean`): Skip dependency installation.
|
|
205
|
+
|
|
204
206
|
**-t, --template \[template]** (`string`): Use a template slug or public GitHub URL. Omit the value to select interactively.
|
|
205
207
|
|
|
206
208
|
**--timeout \<milliseconds>** (`number`): Positive integer timeout for dependency installation. Defaults to 60000.
|
|
@@ -103,7 +103,7 @@ These are forwarded to the Mastra model router and will work with any `"openai/.
|
|
|
103
103
|
|
|
104
104
|
## `mastra factory dev`
|
|
105
105
|
|
|
106
|
-
Starts a development server for [Agent Builder](https://mastra.ai/
|
|
106
|
+
Starts a development server for [Agent Builder](https://agent-builder.mastra.ai/) development. It uses the same dev runtime and flags as [`mastra dev`](#mastra-dev) and writes to the same `.mastra/output` directory.
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
npx mastra factory dev
|
|
@@ -199,6 +199,71 @@ Custom output directory. Defaults to `.mastra/output`.
|
|
|
199
199
|
|
|
200
200
|
Enable debug logging during the build.
|
|
201
201
|
|
|
202
|
+
## `mastra experiment build`
|
|
203
|
+
|
|
204
|
+
Builds a standalone companion worker that runs experiments without exposing an HTTP server. The worker loads your exported `Mastra` instance and accepts versioned newline-delimited JSON (NDJSON) protocol messages on standard input. It writes protocol events to standard output.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
mastra experiment build [options]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The command writes the worker to `.mastra/experiment-worker` by default. The directory contains the executable entry point, production dependencies, and `experiment-worker-manifest.json`. Treat standard output as protocol-only output. Worker diagnostics are written to standard error.
|
|
211
|
+
|
|
212
|
+
### Artifact contract
|
|
213
|
+
|
|
214
|
+
`experiment-worker-manifest.json` identifies the artifact as `mastra-experiment-worker` version `1` and provides:
|
|
215
|
+
|
|
216
|
+
- The CLI version, creation time, and unique build ID embedded in the executable.
|
|
217
|
+
- Supported protocol and dataset canonicalization versions.
|
|
218
|
+
- The executable, arguments, and working directory required to launch the worker.
|
|
219
|
+
- The dependency manifest and generated lockfile paths.
|
|
220
|
+
- A sorted SHA-256 digest for each artifact file.
|
|
221
|
+
- A SHA-256 content digest derived from those file paths and digests.
|
|
222
|
+
|
|
223
|
+
The content digest excludes `experiment-worker-manifest.json` to avoid a self-referential digest. Package the manifest with the rest of the directory. Use an outer package digest when the manifest itself must be attested.
|
|
224
|
+
|
|
225
|
+
### Protocol contract
|
|
226
|
+
|
|
227
|
+
The worker implements the pinned experiment companion-worker protocol version `1`. It reads strict UTF-8 NDJSON frames from standard input and requires every frame, including the last one, to end with a newline. Frames larger than 1 MiB, malformed or truncated frames, unsupported protocol or canonicalization versions, and messages that don't match the active experiment correlation are rejected as protocol failures.
|
|
228
|
+
|
|
229
|
+
A run request must match the artifact's embedded build ID and include the ordered dataset item count and SHA-256 attestation. The worker emits contiguous sequence numbers starting at `0`, timer-driven heartbeats, awaited experiment lifecycle events, and exactly one terminal event. Cancellation must match the active protocol version, experiment ID, job ID, attempt, and idempotency key.
|
|
230
|
+
|
|
231
|
+
Protocol exit codes are:
|
|
232
|
+
|
|
233
|
+
| Code | Meaning |
|
|
234
|
+
| ---- | -------------------------- |
|
|
235
|
+
| `0` | Completed |
|
|
236
|
+
| `10` | Completed with item errors |
|
|
237
|
+
| `20` | Fatal failure |
|
|
238
|
+
| `21` | Retryable failure |
|
|
239
|
+
| `30` | Cancelled |
|
|
240
|
+
| `31` | Timed out |
|
|
241
|
+
| `70` | Protocol failure |
|
|
242
|
+
|
|
243
|
+
### Packet field handling
|
|
244
|
+
|
|
245
|
+
The worker passes target identity, ordered inline dataset items, scorer IDs, concurrency, timeout, experiment metadata, request context, tool mocks, and cancellation to `runExperiment`. Scorer versions and artifact provenance are retained as experiment metadata. Scorer code provenance is enforced by artifact admission rather than runtime scorer lookup.
|
|
246
|
+
|
|
247
|
+
Version `1` uses deterministic undeclared-tool denial. Non-empty network allowlists and secret references are rejected with a policy failure because network enforcement and secret materialization belong to the process sandbox. Dataset item source and expected-trajectory fields are preserved as item metadata when passed to `runExperiment`.
|
|
248
|
+
|
|
249
|
+
### Flags
|
|
250
|
+
|
|
251
|
+
#### `--dir`
|
|
252
|
+
|
|
253
|
+
Path to your Mastra source directory. Defaults to `src/mastra`.
|
|
254
|
+
|
|
255
|
+
#### `--root`
|
|
256
|
+
|
|
257
|
+
Project root directory. Defaults to the current directory.
|
|
258
|
+
|
|
259
|
+
#### `--output-dir`
|
|
260
|
+
|
|
261
|
+
Custom artifact directory. Relative paths are resolved from the project root. Defaults to `.mastra/experiment-worker`.
|
|
262
|
+
|
|
263
|
+
#### `--debug`
|
|
264
|
+
|
|
265
|
+
Enable debug logging during the build.
|
|
266
|
+
|
|
202
267
|
## `mastra worker start`
|
|
203
268
|
|
|
204
269
|
> **Info:** You need to run `mastra worker build` or `mastra build` before using `mastra worker start`.
|
|
@@ -838,7 +838,7 @@ console.log(result.success) // true
|
|
|
838
838
|
|
|
839
839
|
## Version management
|
|
840
840
|
|
|
841
|
-
Both `Agent` (code-defined) and `StoredAgent` instances have methods for managing configuration versions. See
|
|
841
|
+
Both `Agent` (code-defined) and `StoredAgent` instances have methods for managing configuration versions. See [Editor versioning](https://mastra.ai/docs/editor/overview) for lifecycle and selection behavior.
|
|
842
842
|
|
|
843
843
|
### Getting an agent with a specific version
|
|
844
844
|
|
|
@@ -419,7 +419,7 @@ export const mastra = new Mastra({
|
|
|
419
419
|
|
|
420
420
|
Text-to-speech providers for voice synthesis capabilities. Register voice providers to enable agents to convert text responses into spoken audio.
|
|
421
421
|
|
|
422
|
-
Visit the [Voice documentation](https://mastra.ai/
|
|
422
|
+
Visit the [Voice documentation](https://mastra.ai/guides/voice/overview) to learn more.
|
|
423
423
|
|
|
424
424
|
> **Note:** Most users configure voice directly on agents. This top-level configuration is for defining reusable voice providers that can be shared across multiple agents.
|
|
425
425
|
|
|
@@ -440,7 +440,7 @@ export const mastra = new Mastra({
|
|
|
440
440
|
|
|
441
441
|
Vector stores for semantic search and embeddings. Used in RAG pipelines, similarity search, and other embedding-based features. Mastra supports multiple vector databases including Pinecone, PostgreSQL with pgvector, MongoDB, and more.
|
|
442
442
|
|
|
443
|
-
Visit the [RAG documentation](https://mastra.ai/
|
|
443
|
+
Visit the [RAG documentation](https://mastra.ai/guides/rag/overview) to learn more.
|
|
444
444
|
|
|
445
445
|
> **Note:** Most users create vector stores directly when building RAG pipelines. This top-level configuration is for defining reusable vector store instances that can be shared across your application.
|
|
446
446
|
|
|
@@ -20,5 +20,5 @@ mastra.getVector('testVectorStore')
|
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
23
|
-
- [Vector stores overview](https://mastra.ai/
|
|
24
|
-
- [RAG overview](https://mastra.ai/
|
|
23
|
+
- [Vector stores overview](https://mastra.ai/guides/rag/vector-databases)
|
|
24
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
@@ -20,5 +20,5 @@ This method doesn't accept any parameters.
|
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
23
|
-
- [Vector stores overview](https://mastra.ai/
|
|
24
|
-
- [RAG overview](https://mastra.ai/
|
|
23
|
+
- [Vector stores overview](https://mastra.ai/guides/rag/vector-databases)
|
|
24
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
@@ -97,7 +97,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
97
97
|
|
|
98
98
|
**notifications.dispatch.batchSize** (`number`): Maximum number of due notification records to process per dispatch run.
|
|
99
99
|
|
|
100
|
-
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See
|
|
100
|
+
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See Editor versioning for details.
|
|
101
101
|
|
|
102
102
|
**versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors. Each selector can target a specific version by ID or by publication status.
|
|
103
103
|
|
|
@@ -79,6 +79,12 @@ console.log(`Status: ${summary2.status}`)
|
|
|
79
79
|
|
|
80
80
|
**unmockedToolPolicy** (`'allow' | 'deny'`): Controls undeclared agent tool calls. allow executes them live. deny fails the item with TOOL\_MOCK\_NOT\_DECLARED before execution. An item-level value overrides this experiment default. (Default: `'allow'`)
|
|
81
81
|
|
|
82
|
+
**persistence** (`ExperimentPersistencePolicy`): Controls whether this run writes experiment records and score records. Targets and scorers still execute, and results remain available in the returned summary.
|
|
83
|
+
|
|
84
|
+
**persistence.experiments** (`'default' | 'none'`): Set to none to skip experiment creation, item results, progress, and terminal status writes.
|
|
85
|
+
|
|
86
|
+
**persistence.scores** (`'default' | 'none'`): Set to none to skip score writes while still running scorers.
|
|
87
|
+
|
|
82
88
|
## Returns
|
|
83
89
|
|
|
84
90
|
**result** (`Promise<ExperimentSummary>`): Summary of the completed experiment.
|
|
@@ -33,6 +33,10 @@ console.log(`Current status: ${experiment.status}`)
|
|
|
33
33
|
|
|
34
34
|
Takes the same `StartExperimentConfig` as [`dataset.startExperiment()`](https://mastra.ai/reference/datasets/startExperiment).
|
|
35
35
|
|
|
36
|
+
When `persistence.experiments` is set to `'none'`, `startExperimentAsync()` doesn't persist an experiment record, progress updates, or item results. Score persistence remains controlled separately by `persistence.scores`. Without an experiment event observer, the run is fire-and-forget, and the experiment API can't report whether it completed or failed.
|
|
37
|
+
|
|
38
|
+
Use synchronous [`startExperiment()`](https://mastra.ai/reference/datasets/startExperiment) when the caller needs the returned summary. An experiment event observer can receive lifecycle events and the terminal summary.
|
|
39
|
+
|
|
36
40
|
## Returns
|
|
37
41
|
|
|
38
42
|
**result** (`Promise<object>`): Immediate response with experiment ID.
|
|
@@ -54,7 +54,7 @@ export const myBrowserProvider: BrowserProvider<{ apiKey: string }> = {
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/
|
|
57
|
+
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://agent-builder.mastra.ai/reference/builder-agent-defaults):
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
new MastraEditor({
|
|
@@ -72,6 +72,6 @@ new MastraEditor({
|
|
|
72
72
|
|
|
73
73
|
## Related
|
|
74
74
|
|
|
75
|
-
- [Browser](https://mastra.ai/
|
|
75
|
+
- [Browser](https://agent-builder.mastra.ai/browser): Concept and worked examples.
|
|
76
76
|
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref): Stored configuration consumed by `createBrowser`.
|
|
77
77
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -58,7 +58,7 @@ Once registered, admins can reference the provider from an inline workspace conf
|
|
|
58
58
|
|
|
59
59
|
## Related
|
|
60
60
|
|
|
61
|
-
- [Workspace](https://mastra.ai/
|
|
61
|
+
- [Workspace](https://agent-builder.mastra.ai/workspace): Concept and worked examples.
|
|
62
62
|
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref): Stored configuration consumed by `createFilesystem`.
|
|
63
63
|
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider): Sibling provider for command execution.
|
|
64
64
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -4,24 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
The `MastraEditor` class sets up the editor system. Pass it to the `Mastra` constructor to turn on editor features like prompt blocks, agent code override, versioning, and tool providers.
|
|
6
6
|
|
|
7
|
-
See
|
|
7
|
+
See [Editor](https://mastra.ai/docs/editor/overview) for an introduction to what the editor does.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
import { Mastra } from '@mastra/core'
|
|
13
13
|
import { MastraEditor } from '@mastra/editor'
|
|
14
|
-
import { ComposioToolProvider } from '@mastra/editor/providers/composio'
|
|
15
14
|
|
|
16
15
|
export const mastra = new Mastra({
|
|
17
16
|
agents: {/* your agents */},
|
|
18
|
-
editor: new MastraEditor(
|
|
19
|
-
toolProviders: {
|
|
20
|
-
composio: new ComposioToolProvider({
|
|
21
|
-
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
17
|
+
editor: new MastraEditor(),
|
|
25
18
|
})
|
|
26
19
|
```
|
|
27
20
|
|
|
@@ -43,7 +36,7 @@ export const mastra = new Mastra({
|
|
|
43
36
|
|
|
44
37
|
**builder** (`AgentBuilderOptions`): Agent Builder configuration. See the AgentBuilderOptions reference. Omit or set enabled: false to disable the Builder.
|
|
45
38
|
|
|
46
|
-
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See
|
|
39
|
+
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See Editor storage options for the difference. (Default: `'db'`)
|
|
47
40
|
|
|
48
41
|
**codePath** (`string`): Directory used by the 'code' source for per-agent JSON files. Ignored when source is not 'code'. (Default: `'./mastra/editor/'`)
|
|
49
42
|
|
|
@@ -59,12 +52,12 @@ Each provider field above takes a record keyed by provider id. See the per-provi
|
|
|
59
52
|
|
|
60
53
|
## Agent Builder
|
|
61
54
|
|
|
62
|
-
The `builder` field enables the [Agent Builder](https://mastra.ai/
|
|
55
|
+
The `builder` field enables the [Agent Builder](https://agent-builder.mastra.ai/), a browser-based UI for creating and editing stored agents. See:
|
|
63
56
|
|
|
64
|
-
- [Agent Builder overview](https://mastra.ai/
|
|
65
|
-
- [AgentBuilderOptions](https://mastra.ai/reference/
|
|
66
|
-
- [BuilderAgentDefaults](https://mastra.ai/reference/
|
|
67
|
-
- [builder.configuration.agent.models](https://mastra.ai/reference/
|
|
57
|
+
- [Agent Builder overview](https://agent-builder.mastra.ai/): Concepts and getting started.
|
|
58
|
+
- [AgentBuilderOptions](https://agent-builder.mastra.ai/reference/agent-builder-options): Full options schema.
|
|
59
|
+
- [BuilderAgentDefaults](https://agent-builder.mastra.ai/reference/builder-agent-defaults): Admin-pinned defaults for new agents.
|
|
60
|
+
- [builder.configuration.agent.models](https://agent-builder.mastra.ai/reference/builder-models): Model allowlist and default model.
|
|
68
61
|
|
|
69
62
|
### Registering the Builder agent
|
|
70
63
|
|
|
@@ -85,7 +78,7 @@ export const mastra = new Mastra({
|
|
|
85
78
|
|
|
86
79
|
The key name (`builderAgent`) is conventional. Any key works. The `@mastra/editor/ee` subpath is gated by the Mastra Enterprise Edition license at runtime.
|
|
87
80
|
|
|
88
|
-
See the [Agent Builder overview](https://mastra.ai
|
|
81
|
+
See the [Agent Builder overview](https://agent-builder.mastra.ai/#prerequisites) for the full setup checklist.
|
|
89
82
|
|
|
90
83
|
## Namespaces
|
|
91
84
|
|
|
@@ -99,7 +92,7 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
99
92
|
|
|
100
93
|
**agent.getById** (`(id: string, options?: GetByIdOptions) => Promise<Agent | null>`): Return a hydrated Agent instance for a stored agent. Pass options with versionId, versionNumber, or status ("draft" | "published" | "archived") to target a specific version. Default version requests are cached.
|
|
101
94
|
|
|
102
|
-
**agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a
|
|
95
|
+
**agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a version from the provided snapshot fields, assigns it to activeVersionId, and invalidates the cache. Set memory to null to disable memory.
|
|
103
96
|
|
|
104
97
|
**agent.delete** (`(id: string) => Promise<void>`): Delete a stored agent and remove it from the Mastra runtime registry.
|
|
105
98
|
|
|
@@ -179,6 +172,24 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
179
172
|
|
|
180
173
|
**scorer.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one scorer or all scorers.
|
|
181
174
|
|
|
175
|
+
### Agent namespace examples
|
|
176
|
+
|
|
177
|
+
Create a stored override for an existing code-defined agent:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { mastra } from '../mastra'
|
|
181
|
+
|
|
182
|
+
const editor = mastra.getEditor()!
|
|
183
|
+
|
|
184
|
+
await editor.agent.create({
|
|
185
|
+
id: 'support-agent',
|
|
186
|
+
instructions: 'You are a friendly support agent for Acme.',
|
|
187
|
+
tools: {
|
|
188
|
+
search_kb: { description: 'Search the Acme knowledge base' },
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
182
193
|
## Methods
|
|
183
194
|
|
|
184
195
|
### Provider access
|
|
@@ -225,4 +236,6 @@ Returns the configured source (`'code'` or `'db'`), or `undefined` when the edit
|
|
|
225
236
|
const source = mastra.getEditor()?.getSource()
|
|
226
237
|
```
|
|
227
238
|
|
|
228
|
-
Returns: `'code' | 'db' | undefined`
|
|
239
|
+
Returns: `'code' | 'db' | undefined`
|
|
240
|
+
|
|
241
|
+
When `source` is omitted, Editor uses the configured database storage even though `getSource()` returns `undefined`. See [Editor storage options](https://mastra.ai/docs/editor/overview) for the storage workflows and [code-source versioning](https://mastra.ai/reference/editor/versioning) for activation and Git history behavior.
|