@mastra/mcp-docs-server 1.2.3-alpha.11 → 1.2.3-alpha.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/agent-builder/memory.md +4 -2
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agents/file-based-agents.md +270 -0
- package/.docs/docs/getting-started/project-structure.md +18 -14
- package/.docs/docs/observability/integrations/exporters/otel.md +23 -2
- package/.docs/reference/agent-controller/agent-controller-class.md +9 -9
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
|
@@ -25,9 +25,11 @@ Observational memory lets the agent learn long-lived facts from past conversatio
|
|
|
25
25
|
|
|
26
26
|
## Observational memory model
|
|
27
27
|
|
|
28
|
-
Observational memory runs an Observer and Reflector model on top of every conversation.
|
|
28
|
+
Observational memory runs an Observer and Reflector model on top of every conversation. For Agent Builder agents, the default model is `openai/gpt-5-mini`, which requires an `OPENAI_API_KEY` environment variable in any environment where the Builder agent will run.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
> **Note:** This default applies only to agents created through the Agent Builder. Core (non-builder) agents configured with `observationalMemory: true` keep the framework default `google/gemini-2.5-flash` (which uses `GOOGLE_API_KEY`, falling back to `GOOGLE_GENERATIVE_AI_API_KEY`).
|
|
31
|
+
|
|
32
|
+
To use a different model, set `observationalMemory.model` to any model ID supported by the Mastra model router (and provide the matching provider credentials). An explicit model always wins over the Builder default:
|
|
31
33
|
|
|
32
34
|
```typescript
|
|
33
35
|
new MastraEditor({
|
|
@@ -18,7 +18,7 @@ The AgentController gives you the runtime pieces to ship interactive agent appli
|
|
|
18
18
|
- **Let users pick the right model for each step.** Per-mode [model management](https://mastra.ai/reference/agent-controller/agent-controller-class) switches models at runtime and tracks usage, which powers copilot UIs where users trade speed for capability.
|
|
19
19
|
- **Delegate focused work to child agents.** [Subagents](https://mastra.ai/docs/agent-controller/subagents) run subtasks with constrained tools and can fork the parent conversation, so a research mode can spin off web search or code review without polluting the main thread.
|
|
20
20
|
- **Drive a live UI from agent activity.** The [event system](https://mastra.ai/docs/agent-controller/session) emits typed events and coalesced display snapshots, so your TUI or web app reflects message updates, mode changes, and pending approvals in real time.
|
|
21
|
-
- **Run long-lived autonomous agents.** Structured task lists,
|
|
21
|
+
- **Run long-lived autonomous agents.** Structured task lists, interval handlers, and observational memory keep background task runners on track and let them learn across threads.
|
|
22
22
|
|
|
23
23
|
## When to use the AgentController
|
|
24
24
|
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# File-based agents
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.48.0`
|
|
4
|
+
|
|
5
|
+
> **Beta:** This feature is in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
6
|
+
|
|
7
|
+
You can define an agent by file convention instead of constructing it in code. Mastra discovers a directory under `src/mastra/agents/<name>/`, assembles an [`Agent`](https://mastra.ai/reference/agents/agent), and registers it on your [`Mastra`](https://mastra.ai/reference/core/mastra-class) instance.
|
|
8
|
+
|
|
9
|
+
## When to use file-based agents
|
|
10
|
+
|
|
11
|
+
Use file-based agents when you want one directory per agent, with configuration, instructions, tools, skills, workspace files, and subagents grouped together.
|
|
12
|
+
|
|
13
|
+
Keep using [`new Agent()`](https://mastra.ai/reference/agents/agent) in code when you need dynamic configuration, programmatic registration, or a shared agent instance across modules. Both approaches can coexist: code-registered agents are always present, and the bundler adds file-based agents when you run through the Mastra CLI.
|
|
14
|
+
|
|
15
|
+
## Quickstart
|
|
16
|
+
|
|
17
|
+
Create a directory for the agent and add a `config.ts`. Use `agentConfig` so the partial config is typed while sibling files supply the rest.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { agentConfig } from '@mastra/core/agent'
|
|
21
|
+
|
|
22
|
+
export default agentConfig({
|
|
23
|
+
model: 'openai/gpt-5.5',
|
|
24
|
+
// instructions omitted -> taken from instructions.md
|
|
25
|
+
// tools omitted -> taken from tools/*.ts
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add the agent instructions:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
You are a helpful weather assistant. Answer questions about current conditions and forecasts.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Add a tool. The filename becomes the tool key, so this file is exposed as `get_weather`.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { createTool } from '@mastra/core/tools'
|
|
39
|
+
import { z } from 'zod'
|
|
40
|
+
|
|
41
|
+
export default createTool({
|
|
42
|
+
id: 'get_weather',
|
|
43
|
+
description: 'Get the current weather for a city',
|
|
44
|
+
inputSchema: z.object({ city: z.string() }),
|
|
45
|
+
execute: async ({ context }) => ({ city: context.city, tempC: 21 }),
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Your `src/mastra/index.ts` stays the same. The discovered agent is registered automatically when you run the app through `mastra dev` or `mastra build`.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { Mastra } from '@mastra/core'
|
|
53
|
+
import { Agent } from '@mastra/core/agent'
|
|
54
|
+
|
|
55
|
+
const supportAgent = new Agent({
|
|
56
|
+
id: 'support',
|
|
57
|
+
name: 'support',
|
|
58
|
+
instructions: 'You are a support agent.',
|
|
59
|
+
model: 'openai/gpt-5.5',
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// `support` is registered in code; `weather` is discovered from the filesystem.
|
|
63
|
+
export const mastra = new Mastra({
|
|
64
|
+
agents: { support: supportAgent },
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Start the app through the Mastra CLI:
|
|
69
|
+
|
|
70
|
+
**npm**:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx mastra dev
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**pnpm**:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pnpm dlx mastra dev
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Yarn**:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
yarn dlx mastra dev
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Bun**:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
bun x mastra dev
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Folder structure
|
|
95
|
+
|
|
96
|
+
The following table shows the supported file-based agent surface:
|
|
97
|
+
|
|
98
|
+
| File / directory | Maps to |
|
|
99
|
+
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `agents/<name>/config.ts` | Default export merged into the agent config. `id` and `name` default to `<name>`. |
|
|
101
|
+
| `agents/<name>/instructions.md` | The agent `instructions`. The file contents are inlined into generated code. |
|
|
102
|
+
| `agents/<name>/tools/*.ts` | Each default-exported [`createTool()`](https://mastra.ai/reference/tools/create-tool). The tool key defaults to the filename. |
|
|
103
|
+
| `agents/<name>/skills/*.ts` | Each default-exported [`createSkill()`](https://mastra.ai/reference/agents/createSkill), added to the agent `skills`. |
|
|
104
|
+
| `agents/<name>/skills/<skill>/SKILL.md` | A packaged skill. Frontmatter supplies `name` and `description`, the body is the instructions, and files under `references/` are inlined. |
|
|
105
|
+
| `agents/<name>/skills/<skill>.md` | A flat skill. The filename is the skill name and the body is the instructions. |
|
|
106
|
+
| `agents/<name>/workspace.ts` | Default export: a [`Workspace`](https://mastra.ai/reference/workspace/workspace-class) for the agent. |
|
|
107
|
+
| `agents/<name>/workspace/` | Seed files mirrored into the agent's default workspace at build time. |
|
|
108
|
+
| `agents/<name>/subagents/<childId>/` | A declared subagent with the same layout as an agent directory. Wired into the parent as a delegation tool named `<childId>`. |
|
|
109
|
+
|
|
110
|
+
Test files named `*.test.ts`, `*.spec.ts`, `*.test.js`, and `*.spec.js` are ignored during tool and skill discovery.
|
|
111
|
+
|
|
112
|
+
## Add skills
|
|
113
|
+
|
|
114
|
+
Add skills to a file-based agent by placing them under `agents/<name>/skills/`. Three layouts are supported, and they're inlined into the bundle at build time so the deployed agent doesn't read them from disk at runtime.
|
|
115
|
+
|
|
116
|
+
- A `.ts` file can default-export `createSkill()`:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { createSkill } from '@mastra/core/skills'
|
|
120
|
+
|
|
121
|
+
export default createSkill({
|
|
122
|
+
name: 'forecasting',
|
|
123
|
+
description: 'Use when the user asks about multi-day forecasts.',
|
|
124
|
+
instructions: 'Summarize the forecast day by day and call out precipitation.',
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> **Note:** Visit [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill) for the full API.
|
|
129
|
+
|
|
130
|
+
- A packaged `SKILL.md` directory uses frontmatter for the name and description. Files under `references/` are inlined with the skill.
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
---
|
|
134
|
+
name: severe-weather
|
|
135
|
+
description: Use when conditions include storms, flooding, or other hazards.
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
Lead with the active alert, then give safety guidance.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
- A flat `<skill>.md` file uses the filename as the skill name:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
Always report temperatures in both Celsius and Fahrenheit.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Discovered skills merge with any `skills` in `config.ts`. On a name collision, `config.skills` wins and a warning is logged. If `config.skills` is a function, discovered skills are ignored with a warning because they can't be statically merged.
|
|
148
|
+
|
|
149
|
+
## Add a workspace
|
|
150
|
+
|
|
151
|
+
When a file-based agent is discovered through `mastra dev` or `mastra build`, it gets a default workspace unless `config.workspace` or `workspace.ts` supplies one. The default workspace uses a contained filesystem and shell sandbox rooted at a per-agent `workspace/` directory in the bundle.
|
|
152
|
+
|
|
153
|
+
To customize it, add a `workspace.ts` that default-exports a [`Workspace`](https://mastra.ai/reference/workspace/workspace-class):
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace'
|
|
157
|
+
|
|
158
|
+
export default new Workspace({
|
|
159
|
+
name: 'weather-workspace',
|
|
160
|
+
filesystem: new LocalFilesystem({ basePath: './data/weather' }),
|
|
161
|
+
sandbox: new LocalSandbox({ workingDirectory: './data/weather' }),
|
|
162
|
+
})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
You can also set `workspace` directly in `config.ts`. `config.workspace` wins over `workspace.ts`, and `workspace.ts` wins over the default workspace.
|
|
166
|
+
|
|
167
|
+
### Seed files
|
|
168
|
+
|
|
169
|
+
Add a `workspace/` directory to ship files with the agent. Mastra mirrors every file under it into the agent's default workspace at build time, so the agent starts with those files on disk:
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
src/mastra/agents/weather/
|
|
173
|
+
config.ts
|
|
174
|
+
workspace/
|
|
175
|
+
README.md
|
|
176
|
+
data/cities.json
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Seed files are copied into the bundle next to the running server. Commit the starting files alongside the agent that uses them.
|
|
180
|
+
|
|
181
|
+
## Add subagents
|
|
182
|
+
|
|
183
|
+
A file-based agent can declare **subagents**, specialist child agents it can delegate to. Add a `subagents/` directory under the agent, with one directory per subagent. Each subagent directory has the same layout as a top-level agent: `config.ts`, `instructions.md`, `tools/`, `skills/`, `workspace.ts`, and `workspace/`.
|
|
184
|
+
|
|
185
|
+
```text
|
|
186
|
+
src/mastra/agents/
|
|
187
|
+
supervisor/
|
|
188
|
+
config.ts
|
|
189
|
+
instructions.md
|
|
190
|
+
subagents/
|
|
191
|
+
researcher/
|
|
192
|
+
config.ts
|
|
193
|
+
instructions.md
|
|
194
|
+
tools/
|
|
195
|
+
search.ts
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Each subagent is assembled as its own agent and wired into the parent's `agents` map. The agent loop lowers it into a model-visible delegation tool. The tool name is the bare directory name, so the example above exposes `researcher` to the supervisor.
|
|
199
|
+
|
|
200
|
+
A subagent's `config.ts` must set a non-empty `description`. The description is what the model sees when deciding whether to delegate, so the build fails if it's missing.
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
import { agentConfig } from '@mastra/core/agent'
|
|
204
|
+
|
|
205
|
+
export default agentConfig({
|
|
206
|
+
model: 'openai/gpt-5.5',
|
|
207
|
+
description: 'Researches a topic and returns cited findings.',
|
|
208
|
+
})
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Subagents are isolated. A subagent inherits nothing from its parent. Its tools, skills, and workspace come only from its own directory, and any absent slot falls back to the same framework defaults as a top-level agent.
|
|
212
|
+
|
|
213
|
+
Subagents are one level deep. A `subagents/` directory nested inside a subagent is ignored with a warning.
|
|
214
|
+
|
|
215
|
+
Naming rules:
|
|
216
|
+
|
|
217
|
+
- A subagent id that collides with one of the parent's tool keys is a build error.
|
|
218
|
+
- A duplicate subagent id under the same parent is a build error.
|
|
219
|
+
- If a subagent id also exists in the parent's `config.agents`, the `config.agents` entry wins and logs a warning.
|
|
220
|
+
- If `config.agents` is a function, discovered subagents are ignored with a warning because they can't be statically merged.
|
|
221
|
+
|
|
222
|
+
## Precedence rules
|
|
223
|
+
|
|
224
|
+
File-based and code-based agents coexist with deterministic rules:
|
|
225
|
+
|
|
226
|
+
- **Code wins on name collisions:** If an agent name exists in both code and the filesystem, the code-registered agent is kept and a warning is logged.
|
|
227
|
+
- **A folder can hold a code agent:** If `config.ts` exports `new Agent({...})`, that instance is used as-is. Sibling `instructions.md`, `tools/`, `skills/`, `workspace.ts`, and `subagents/` entries are ignored with warnings.
|
|
228
|
+
- **Instructions:** Dynamic function instructions in `config.ts` win over `instructions.md`. Otherwise, `instructions.md` wins over a static `instructions` string. If neither is present, the build fails for that agent.
|
|
229
|
+
- **Model:** A missing `model` fails the build and names the agent directory.
|
|
230
|
+
- **Tools:** Tools from `tools/*.ts` merge with `config.tools`. On a key collision, `config.tools` wins and a warning is logged. If `config.tools` is a function, discovered tools are ignored with a warning.
|
|
231
|
+
- **Skills:** Skills from `skills/` merge with `config.skills`. On a name collision, `config.skills` wins and a warning is logged. If `config.skills` is a function, discovered skills are ignored with a warning.
|
|
232
|
+
- **Workspace:** `config.workspace` wins over `workspace.ts`, which wins over the default workspace.
|
|
233
|
+
- **Subagents:** Subagents from `subagents/` merge with `config.agents`. On an id collision, `config.agents` wins and a warning is logged. A subagent id that collides with a tool key, or a duplicate subagent id, is a build error.
|
|
234
|
+
|
|
235
|
+
## What happens at build time
|
|
236
|
+
|
|
237
|
+
File-based agents are discovered by the Mastra **bundler**, the step that runs under `mastra dev` and `mastra build`.
|
|
238
|
+
|
|
239
|
+
File-based agents are registered only when your app runs through the Mastra CLI. If you import your `mastra` instance directly, `agents/<name>/` directories aren't discovered.
|
|
240
|
+
|
|
241
|
+
When you consume Mastra as a library, register those agents in code instead of relying on file discovery:
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { Mastra } from '@mastra/core'
|
|
245
|
+
import { Agent } from '@mastra/core/agent'
|
|
246
|
+
|
|
247
|
+
const weather = new Agent({
|
|
248
|
+
id: 'weather',
|
|
249
|
+
name: 'weather',
|
|
250
|
+
instructions: 'You are a helpful weather assistant.',
|
|
251
|
+
model: 'openai/gpt-5.5',
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
export const mastra = new Mastra({
|
|
255
|
+
agents: { weather },
|
|
256
|
+
})
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Related
|
|
260
|
+
|
|
261
|
+
- [Agents overview](https://mastra.ai/docs/agents/overview)
|
|
262
|
+
- [Tools](https://mastra.ai/docs/agents/using-tools)
|
|
263
|
+
- [Skills](https://mastra.ai/docs/agents/skills)
|
|
264
|
+
- [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents)
|
|
265
|
+
- [Workspace](https://mastra.ai/docs/workspace/overview)
|
|
266
|
+
- [Studio overview](https://mastra.ai/docs/studio/overview)
|
|
267
|
+
- [`Agent` reference](https://mastra.ai/reference/agents/agent)
|
|
268
|
+
- [`createTool()` reference](https://mastra.ai/reference/tools/create-tool)
|
|
269
|
+
- [`createSkill()` reference](https://mastra.ai/reference/agents/createSkill)
|
|
270
|
+
- [`Workspace` reference](https://mastra.ai/reference/workspace/workspace-class)
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Your new Mastra project, created with the `create mastra` command, comes with a predefined set of files and folders to help you get started.
|
|
4
4
|
|
|
5
|
-
Mastra is a framework, but it's **unopinionated** about how you organize or colocate your files. The CLI provides a sensible default structure that works well for most projects, but you're free to adapt it to your workflow or team conventions. You could even build your entire project in a single file if you wanted! Whatever structure you choose, keep it consistent to ensure your code stays maintainable and straightforward to navigate.
|
|
5
|
+
Mastra is a framework, but it's mostly **unopinionated** about how you organize or colocate your files. The CLI provides a sensible default structure that works well for most projects, but you're free to adapt it to your workflow or team conventions. You could even build your entire project in a single file if you wanted! Whatever structure you choose, keep it consistent to ensure your code stays maintainable and straightforward to navigate.
|
|
6
6
|
|
|
7
7
|
## Default project structure
|
|
8
8
|
|
|
9
9
|
A project created with the `create mastra` command looks like this:
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```bash
|
|
12
12
|
src/
|
|
13
13
|
├── mastra/
|
|
14
14
|
│ ├── agents/
|
|
@@ -25,21 +25,25 @@ src/
|
|
|
25
25
|
└── tsconfig.json
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Use the predefined files as templates. Duplicate and adapt them to quickly create your own agents, tools, workflows, etc.
|
|
29
29
|
|
|
30
30
|
### Folders
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
| Folder | Description
|
|
35
|
-
| ---------------------- |
|
|
36
|
-
| `src/mastra` | Entry point for all Mastra-related code and configuration.
|
|
37
|
-
| `src/mastra/agents` | Define and configure your agents - their behavior, goals, and tools.
|
|
38
|
-
| `src/mastra/workflows` | Define multi-step workflows that orchestrate agents and tools together.
|
|
39
|
-
| `src/mastra/tools` | Create reusable tools that your agents can call
|
|
40
|
-
| `src/mastra/mcp` |
|
|
41
|
-
| `src/mastra/scorers` |
|
|
42
|
-
|
|
32
|
+
Mastra recommends organizing your code into the following folders:
|
|
33
|
+
|
|
34
|
+
| Folder | Description |
|
|
35
|
+
| ---------------------- | ----------------------------------------------------------------------- |
|
|
36
|
+
| `src/mastra` | Entry point for all Mastra-related code and configuration. |
|
|
37
|
+
| `src/mastra/agents` | Define and configure your agents - their behavior, goals, and tools. |
|
|
38
|
+
| `src/mastra/workflows` | Define multi-step workflows that orchestrate agents and tools together. |
|
|
39
|
+
| `src/mastra/tools` | Create reusable tools that your agents can call |
|
|
40
|
+
| `src/mastra/mcp` | Implement custom MCP servers to share your tools with external agents |
|
|
41
|
+
| `src/mastra/scorers` | Define scorers for evaluating agent performance over time |
|
|
42
|
+
|
|
43
|
+
There are two special folder conventions in Mastra:
|
|
44
|
+
|
|
45
|
+
- `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [file-based agents](https://mastra.ai/docs/agents/file-based-agents) guide.
|
|
46
|
+
- `src/mastra/public`: Contents are copied into the `.build/output` directory during the build process, making them available for serving at runtime.
|
|
43
47
|
|
|
44
48
|
### Top-level files
|
|
45
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenTelemetry exporter
|
|
2
2
|
|
|
3
|
-
The OpenTelemetry (OTEL) exporter sends your traces and logs to any OTEL-compatible observability platform using standardized [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/). This ensures broad compatibility with platforms like Datadog, New Relic, SigNoz, MLflow, Dash0, Traceloop, Laminar, and more.
|
|
3
|
+
The OpenTelemetry (OTEL) exporter sends your traces and logs to any OTEL-compatible observability platform using standardized [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/). This ensures broad compatibility with platforms like Datadog, New Relic, SigNoz, MLflow, Latitude, Dash0, Traceloop, Laminar, and more.
|
|
4
4
|
|
|
5
5
|
> **Looking for bidirectional OTEL integration?:** If you have existing OpenTelemetry instrumentation and want Mastra traces to inherit context from active OTEL spans, see the [OpenTelemetry Bridge](https://mastra.ai/docs/observability/integrations/bridges/otel) instead.
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ The OpenTelemetry (OTEL) exporter sends your traces and logs to any OTEL-compati
|
|
|
8
8
|
|
|
9
9
|
Each provider requires specific protocol packages. Install the base exporter plus the protocol package for your provider:
|
|
10
10
|
|
|
11
|
-
### For HTTP/Protobuf Providers (SigNoz, New Relic, Laminar, MLflow)
|
|
11
|
+
### For HTTP/Protobuf Providers (SigNoz, New Relic, Laminar, MLflow, Latitude)
|
|
12
12
|
|
|
13
13
|
**npm**:
|
|
14
14
|
|
|
@@ -118,6 +118,27 @@ new OtelExporter({
|
|
|
118
118
|
})
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
### Latitude
|
|
122
|
+
|
|
123
|
+
[Latitude](https://latitude.so) is an open-source LLM observability and evaluation platform that ingests OTLP traces. Use the `custom` provider with HTTP/Protobuf, pointing at Latitude's ingestion endpoint and authenticating with your API key and project slug:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
new OtelExporter({
|
|
127
|
+
provider: {
|
|
128
|
+
custom: {
|
|
129
|
+
endpoint: 'https://ingest.latitude.so/v1/traces',
|
|
130
|
+
protocol: 'http/protobuf',
|
|
131
|
+
headers: {
|
|
132
|
+
Authorization: `Bearer ${process.env.LATITUDE_API_KEY}`,
|
|
133
|
+
'X-Latitude-Project': process.env.LATITUDE_PROJECT,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Sign up at [console.latitude.so](https://console.latitude.so/login), or self-host and point the endpoint at your own ingestion host.
|
|
141
|
+
|
|
121
142
|
### Dash0
|
|
122
143
|
|
|
123
144
|
[Dash0](https://www.dash0.com/) provides real-time observability with automatic insights.
|
|
@@ -128,7 +128,7 @@ await agentController.sendMessage({ content: 'Hello!' })
|
|
|
128
128
|
|
|
129
129
|
**disableBuiltinTools** (`BuiltinToolId[]`): Built-in tool IDs to remove from the \`controllerBuiltIn\` toolset. Valid values are \`ask\_user\`, \`submit\_plan\`, \`task\_write\`, \`task\_update\`, \`task\_complete\`, \`task\_check\`, and \`subagent\`.
|
|
130
130
|
|
|
131
|
-
**
|
|
131
|
+
**intervalHandlers** (`IntervalHandler[]`): Periodic background tasks started during \`init()\`. Use for gateway sync, cache refresh, and similar tasks.
|
|
132
132
|
|
|
133
133
|
**idGenerator** (`() => string`): Custom ID generator for AgentController-managed IDs such as threads and mode-run identifiers. (Default: `timestamp + random string`)
|
|
134
134
|
|
|
@@ -162,7 +162,7 @@ await agentController.sendMessage({ content: 'Hello!' })
|
|
|
162
162
|
|
|
163
163
|
#### `init()`
|
|
164
164
|
|
|
165
|
-
Initialize the agentController. Loads storage, initializes a static workspace (dynamic factory workspaces are resolved per-session during `createSession`), propagates memory and workspace to mode agents, and starts
|
|
165
|
+
Initialize the agentController. Loads storage, initializes a static workspace (dynamic factory workspaces are resolved per-session during `createSession`), propagates memory and workspace to mode agents, and starts interval handlers. Call this before using the agentController.
|
|
166
166
|
|
|
167
167
|
```typescript
|
|
168
168
|
await agentController.init()
|
|
@@ -220,26 +220,26 @@ const thread = await agentController.selectOrCreateThread()
|
|
|
220
220
|
|
|
221
221
|
#### `destroy()`
|
|
222
222
|
|
|
223
|
-
Stop all
|
|
223
|
+
Stop all interval handlers and clean up resources.
|
|
224
224
|
|
|
225
225
|
```typescript
|
|
226
226
|
await agentController.destroy()
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
#### `
|
|
229
|
+
#### `removeInterval({ id })`
|
|
230
230
|
|
|
231
|
-
Remove a specific
|
|
231
|
+
Remove a specific interval handler by ID. Calls the handler's `shutdown()` callback if defined.
|
|
232
232
|
|
|
233
233
|
```typescript
|
|
234
|
-
await agentController.
|
|
234
|
+
await agentController.removeInterval({ id: 'gateway-sync' })
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
#### `
|
|
237
|
+
#### `stopIntervals()`
|
|
238
238
|
|
|
239
|
-
Stop and remove all
|
|
239
|
+
Stop and remove all interval handlers.
|
|
240
240
|
|
|
241
241
|
```typescript
|
|
242
|
-
await agentController.
|
|
242
|
+
await agentController.stopIntervals()
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
#### `getCurrentAgent()`
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.3-alpha.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`8be63b0`](https://github.com/mastra-ai/mastra/commit/8be63b015fb8d72cea1220f05e7dc3bb997cc249), [`345eecc`](https://github.com/mastra-ai/mastra/commit/345eecce6ba519b5d987f0e10b5de4c8e5734580), [`ee14cae`](https://github.com/mastra-ai/mastra/commit/ee14cae244805783bde518a6142de28b744b169c)]:
|
|
8
|
+
- @mastra/core@1.48.0-alpha.7
|
|
9
|
+
|
|
10
|
+
## 1.2.3-alpha.12
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`b33c77d`](https://github.com/mastra-ai/mastra/commit/b33c77d5293f14a794f3ec38dc947a6676de2764), [`1009f77`](https://github.com/mastra-ai/mastra/commit/1009f772aa40016b49267c8566d0c29f6a16aa3c), [`23c31de`](https://github.com/mastra-ai/mastra/commit/23c31de96ed8153402dcf092ac84b27a0c3638c1), [`0368766`](https://github.com/mastra-ai/mastra/commit/0368766744c7ea3df4d6059e2cc15f7bdf55f5a6), [`65a66db`](https://github.com/mastra-ai/mastra/commit/65a66dbe249a0d92d828c605b955e73a983cf3b0), [`2866f04`](https://github.com/mastra-ai/mastra/commit/2866f04953edb78c1637fa45cc53abe24122edcb)]:
|
|
15
|
+
- @mastra/core@1.48.0-alpha.6
|
|
16
|
+
- @mastra/mcp@1.12.1-alpha.0
|
|
17
|
+
|
|
3
18
|
## 1.2.3-alpha.10
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.3-alpha.
|
|
3
|
+
"version": "1.2.3-alpha.13",
|
|
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/core": "1.48.0-alpha.7",
|
|
32
|
+
"@mastra/mcp": "^1.12.1-alpha.0"
|
|
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/types-builder": "0.0.84",
|
|
49
49
|
"@internal/lint": "0.0.109",
|
|
50
|
-
"@mastra/core": "1.48.0-alpha.
|
|
50
|
+
"@mastra/core": "1.48.0-alpha.7"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|