@mastra/mcp-docs-server 1.2.12-alpha.3 → 1.2.12-alpha.4
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/models/gateways/openrouter.md +6 -6
- package/.docs/models/gateways/vercel.md +6 -6
- package/.docs/models/index.md +95 -96
- package/.docs/models/providers/baseten.md +23 -25
- package/.docs/models/providers/chutes.md +23 -25
- package/.docs/models/providers/crossmodel.md +23 -25
- package/.docs/models/providers/deepinfra.md +22 -24
- package/.docs/models/providers/hyper.md +23 -25
- package/.docs/models/providers/llmgateway.md +23 -25
- package/.docs/models/providers/wandb.md +23 -25
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
|
@@ -9,14 +9,14 @@ Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { Agent } from
|
|
12
|
+
import { Agent } from '@mastra/core/agent'
|
|
13
13
|
|
|
14
14
|
const agent = new Agent({
|
|
15
|
-
id:
|
|
16
|
-
name:
|
|
17
|
-
instructions:
|
|
18
|
-
model:
|
|
19
|
-
})
|
|
15
|
+
id: 'my-agent',
|
|
16
|
+
name: 'My Agent',
|
|
17
|
+
instructions: 'You are a helpful assistant',
|
|
18
|
+
model: 'openrouter/ai21/jamba-large-1.7',
|
|
19
|
+
})
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [OpenRouter documentation](https://openrouter.ai/models) for details.
|
|
@@ -9,14 +9,14 @@ Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-pro
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { Agent } from
|
|
12
|
+
import { Agent } from '@mastra/core/agent'
|
|
13
13
|
|
|
14
14
|
const agent = new Agent({
|
|
15
|
-
id:
|
|
16
|
-
name:
|
|
17
|
-
instructions:
|
|
18
|
-
model:
|
|
19
|
-
})
|
|
15
|
+
id: 'my-agent',
|
|
16
|
+
name: 'My Agent',
|
|
17
|
+
instructions: 'You are a helpful assistant',
|
|
18
|
+
model: 'vercel/alibaba/qwen-3-14b',
|
|
19
|
+
})
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers) for details.
|
package/.docs/models/index.md
CHANGED
|
@@ -23,65 +23,65 @@ Mastra reads the relevant environment variable (e.g. `ANTHROPIC_API_KEY`) and ro
|
|
|
23
23
|
**OpenAI**:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { Agent } from
|
|
26
|
+
import { Agent } from '@mastra/core/agent'
|
|
27
27
|
|
|
28
28
|
const agent = new Agent({
|
|
29
|
-
id:
|
|
30
|
-
name:
|
|
31
|
-
instructions:
|
|
32
|
-
model:
|
|
29
|
+
id: 'my-agent',
|
|
30
|
+
name: 'My Agent',
|
|
31
|
+
instructions: 'You are a helpful assistant',
|
|
32
|
+
model: 'openai/gpt-5.6-sol',
|
|
33
33
|
})
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
**Anthropic**:
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
import { Agent } from
|
|
39
|
+
import { Agent } from '@mastra/core/agent'
|
|
40
40
|
|
|
41
41
|
const agent = new Agent({
|
|
42
|
-
id:
|
|
43
|
-
name:
|
|
44
|
-
instructions:
|
|
45
|
-
model:
|
|
42
|
+
id: 'my-agent',
|
|
43
|
+
name: 'My Agent',
|
|
44
|
+
instructions: 'You are a helpful assistant',
|
|
45
|
+
model: 'anthropic/claude-sonnet-4-6',
|
|
46
46
|
})
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
**Google Gemini**:
|
|
50
50
|
|
|
51
51
|
```typescript
|
|
52
|
-
import { Agent } from
|
|
52
|
+
import { Agent } from '@mastra/core/agent'
|
|
53
53
|
|
|
54
54
|
const agent = new Agent({
|
|
55
|
-
id:
|
|
56
|
-
name:
|
|
57
|
-
instructions:
|
|
58
|
-
model:
|
|
55
|
+
id: 'my-agent',
|
|
56
|
+
name: 'My Agent',
|
|
57
|
+
instructions: 'You are a helpful assistant',
|
|
58
|
+
model: 'google/gemini-2.5-flash',
|
|
59
59
|
})
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
**xAI**:
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
|
-
import { Agent } from
|
|
65
|
+
import { Agent } from '@mastra/core/agent'
|
|
66
66
|
|
|
67
67
|
const agent = new Agent({
|
|
68
|
-
id:
|
|
69
|
-
name:
|
|
70
|
-
instructions:
|
|
71
|
-
model:
|
|
68
|
+
id: 'my-agent',
|
|
69
|
+
name: 'My Agent',
|
|
70
|
+
instructions: 'You are a helpful assistant',
|
|
71
|
+
model: 'xai/grok-4.3',
|
|
72
72
|
})
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
**OpenRouter**:
|
|
76
76
|
|
|
77
77
|
```typescript
|
|
78
|
-
import { Agent } from
|
|
78
|
+
import { Agent } from '@mastra/core/agent'
|
|
79
79
|
|
|
80
80
|
const agent = new Agent({
|
|
81
|
-
id:
|
|
82
|
-
name:
|
|
83
|
-
instructions:
|
|
84
|
-
model:
|
|
81
|
+
id: 'my-agent',
|
|
82
|
+
name: 'My Agent',
|
|
83
|
+
instructions: 'You are a helpful assistant',
|
|
84
|
+
model: 'openrouter/anthropic/claude-haiku-4.5',
|
|
85
85
|
})
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -103,22 +103,22 @@ Alternatively, browse and test models in [Studio](https://mastra.ai/docs/studio/
|
|
|
103
103
|
Some models are faster but less capable, while others offer larger context windows or stronger reasoning skills. Use different models from the same provider, or mix and match across providers to fit each task.
|
|
104
104
|
|
|
105
105
|
```typescript
|
|
106
|
-
import { Agent } from
|
|
106
|
+
import { Agent } from '@mastra/core/agent'
|
|
107
107
|
|
|
108
108
|
// Use a cost-effective model for document processing
|
|
109
109
|
const documentProcessor = new Agent({
|
|
110
|
-
id:
|
|
111
|
-
name:
|
|
112
|
-
instructions:
|
|
113
|
-
model:
|
|
110
|
+
id: 'document-processor',
|
|
111
|
+
name: 'Document Processor',
|
|
112
|
+
instructions: 'Extract and summarize key information from documents',
|
|
113
|
+
model: 'openai/gpt-5.6-sol',
|
|
114
114
|
})
|
|
115
115
|
|
|
116
116
|
// Use a powerful reasoning model for complex analysis
|
|
117
117
|
const reasoningAgent = new Agent({
|
|
118
|
-
id:
|
|
119
|
-
name:
|
|
120
|
-
instructions:
|
|
121
|
-
model:
|
|
118
|
+
id: 'reasoning-agent',
|
|
119
|
+
name: 'Reasoning Agent',
|
|
120
|
+
instructions: 'Analyze data and provide strategic recommendations',
|
|
121
|
+
model: 'anthropic/claude-opus-4-7',
|
|
122
122
|
})
|
|
123
123
|
```
|
|
124
124
|
|
|
@@ -128,14 +128,14 @@ Since models are just strings, you can select them dynamically based on [request
|
|
|
128
128
|
|
|
129
129
|
```typescript
|
|
130
130
|
const agent = new Agent({
|
|
131
|
-
id:
|
|
132
|
-
name:
|
|
131
|
+
id: 'dynamic-assistant',
|
|
132
|
+
name: 'Dynamic Assistant',
|
|
133
133
|
model: ({ requestContext }) => {
|
|
134
|
-
const provider = requestContext.get(
|
|
135
|
-
const model = requestContext.get(
|
|
136
|
-
return `${provider}/${model}
|
|
134
|
+
const provider = requestContext.get('provider-id')
|
|
135
|
+
const model = requestContext.get('model-id')
|
|
136
|
+
return `${provider}/${model}`
|
|
137
137
|
},
|
|
138
|
-
})
|
|
138
|
+
})
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
This enables powerful patterns:
|
|
@@ -151,31 +151,30 @@ Different model providers expose their own configuration options. With OpenAI, y
|
|
|
151
151
|
```typescript
|
|
152
152
|
// Agent level (apply to all future messages)
|
|
153
153
|
const planner = new Agent({
|
|
154
|
-
id:
|
|
155
|
-
name:
|
|
154
|
+
id: 'planner',
|
|
155
|
+
name: 'Planner',
|
|
156
156
|
instructions: {
|
|
157
|
-
role:
|
|
158
|
-
content:
|
|
157
|
+
role: 'system',
|
|
158
|
+
content: 'You are a helpful assistant.',
|
|
159
159
|
providerOptions: {
|
|
160
|
-
openai: { reasoningEffort:
|
|
161
|
-
}
|
|
160
|
+
openai: { reasoningEffort: 'low' },
|
|
161
|
+
},
|
|
162
162
|
},
|
|
163
|
-
model:
|
|
164
|
-
})
|
|
163
|
+
model: 'openai/gpt-5.6-sol',
|
|
164
|
+
})
|
|
165
165
|
|
|
166
|
-
const lowEffort =
|
|
167
|
-
await planner.generate("Plan a simple 3 item dinner menu");
|
|
166
|
+
const lowEffort = await planner.generate('Plan a simple 3 item dinner menu')
|
|
168
167
|
|
|
169
168
|
// Message level (apply only to this message)
|
|
170
169
|
const highEffort = await planner.generate([
|
|
171
170
|
{
|
|
172
|
-
role:
|
|
173
|
-
content:
|
|
171
|
+
role: 'user',
|
|
172
|
+
content: 'Plan a simple 3 item dinner menu for a celiac',
|
|
174
173
|
providerOptions: {
|
|
175
|
-
openai: { reasoningEffort:
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
])
|
|
174
|
+
openai: { reasoningEffort: 'high' },
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
])
|
|
179
178
|
```
|
|
180
179
|
|
|
181
180
|
## Custom headers
|
|
@@ -184,16 +183,16 @@ If you need to specify custom headers, such as an organization ID or other provi
|
|
|
184
183
|
|
|
185
184
|
```typescript
|
|
186
185
|
const agent = new Agent({
|
|
187
|
-
id:
|
|
188
|
-
name:
|
|
186
|
+
id: 'custom-agent',
|
|
187
|
+
name: 'Custom Agent',
|
|
189
188
|
model: {
|
|
190
|
-
id:
|
|
189
|
+
id: 'openai/gpt-5.6-sol',
|
|
191
190
|
apiKey: process.env.OPENAI_API_KEY,
|
|
192
191
|
headers: {
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
})
|
|
192
|
+
'OpenAI-Organization': 'org-abc123',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
})
|
|
197
196
|
```
|
|
198
197
|
|
|
199
198
|
> **Info:** Configuration differs by provider. See the provider pages in the left navigation for details on custom headers.
|
|
@@ -203,7 +202,7 @@ const agent = new Agent({
|
|
|
203
202
|
Relying on a single model creates a single point of failure for your application. Model fallbacks provide automatic failover between models and providers. If the primary model becomes unavailable, requests are retried against the next configured fallback until one succeeds.
|
|
204
203
|
|
|
205
204
|
```typescript
|
|
206
|
-
import { Agent } from '@mastra/core/agent'
|
|
205
|
+
import { Agent } from '@mastra/core/agent'
|
|
207
206
|
|
|
208
207
|
const agent = new Agent({
|
|
209
208
|
id: 'resilient-assistant',
|
|
@@ -211,19 +210,19 @@ const agent = new Agent({
|
|
|
211
210
|
instructions: 'You are a helpful assistant.',
|
|
212
211
|
model: [
|
|
213
212
|
{
|
|
214
|
-
model:
|
|
213
|
+
model: 'openai/gpt-5.6-sol',
|
|
215
214
|
maxRetries: 3,
|
|
216
215
|
},
|
|
217
216
|
{
|
|
218
|
-
model:
|
|
217
|
+
model: 'anthropic/claude-sonnet-4-6',
|
|
219
218
|
maxRetries: 2,
|
|
220
219
|
},
|
|
221
220
|
{
|
|
222
|
-
model:
|
|
221
|
+
model: 'google/gemini-2.5-pro',
|
|
223
222
|
maxRetries: 2,
|
|
224
223
|
},
|
|
225
224
|
],
|
|
226
|
-
})
|
|
225
|
+
})
|
|
227
226
|
```
|
|
228
227
|
|
|
229
228
|
Mastra tries your primary model first. If it encounters a 500 error, rate limit, or timeout, it automatically switches to your first fallback. If that fails too, it moves to the next. Each model gets its own retry count before moving on.
|
|
@@ -235,7 +234,7 @@ Your users never experience the disruption - the response comes back with the sa
|
|
|
235
234
|
Each fallback entry can carry its own `modelSettings`, `providerOptions`, and `headers` — useful when models in the chain need different temperatures or provider-specific knobs to produce comparable output.
|
|
236
235
|
|
|
237
236
|
```typescript
|
|
238
|
-
import { Agent } from '@mastra/core/agent'
|
|
237
|
+
import { Agent } from '@mastra/core/agent'
|
|
239
238
|
|
|
240
239
|
const agent = new Agent({
|
|
241
240
|
id: 'tuned-resilient',
|
|
@@ -255,7 +254,7 @@ const agent = new Agent({
|
|
|
255
254
|
providerOptions: { openai: { reasoningEffort: 'low' } },
|
|
256
255
|
},
|
|
257
256
|
],
|
|
258
|
-
})
|
|
257
|
+
})
|
|
259
258
|
```
|
|
260
259
|
|
|
261
260
|
**Precedence:**
|
|
@@ -278,32 +277,32 @@ Use `gateway/provider/model` when the remote behaves like a model gateway and th
|
|
|
278
277
|
For the `url` it's **important** that you use the base URL of the OpenAI-compatible endpoint with Mastra's `model` setting and not the individual chat endpoints.
|
|
279
278
|
|
|
280
279
|
```typescript
|
|
281
|
-
import { Agent } from
|
|
280
|
+
import { Agent } from '@mastra/core/agent'
|
|
282
281
|
|
|
283
282
|
const agent = new Agent({
|
|
284
|
-
id:
|
|
285
|
-
name:
|
|
286
|
-
instructions:
|
|
283
|
+
id: 'my-agent',
|
|
284
|
+
name: 'My Agent',
|
|
285
|
+
instructions: 'You are a helpful assistant',
|
|
287
286
|
model: {
|
|
288
|
-
id:
|
|
289
|
-
url:
|
|
290
|
-
}
|
|
287
|
+
id: 'custom/my-qwen3-model',
|
|
288
|
+
url: 'http://your-custom-openai-compatible-endpoint.com/v1',
|
|
289
|
+
},
|
|
291
290
|
})
|
|
292
291
|
```
|
|
293
292
|
|
|
294
293
|
If the remote behaves like a model gateway, include the gateway prefix in `id`:
|
|
295
294
|
|
|
296
295
|
```typescript
|
|
297
|
-
import { Agent } from
|
|
296
|
+
import { Agent } from '@mastra/core/agent'
|
|
298
297
|
|
|
299
298
|
const agent = new Agent({
|
|
300
|
-
id:
|
|
301
|
-
name:
|
|
302
|
-
instructions:
|
|
299
|
+
id: 'my-agent',
|
|
300
|
+
name: 'My Agent',
|
|
301
|
+
instructions: 'You are a helpful assistant',
|
|
303
302
|
model: {
|
|
304
|
-
id:
|
|
305
|
-
url:
|
|
306
|
-
}
|
|
303
|
+
id: 'mastra/google/gemini-2.5-flash',
|
|
304
|
+
url: 'http://your-custom-openai-compatible-endpoint.com/v1',
|
|
305
|
+
},
|
|
307
306
|
})
|
|
308
307
|
```
|
|
309
308
|
|
|
@@ -312,16 +311,16 @@ const agent = new Agent({
|
|
|
312
311
|
After starting the LMStudio server, the local server is available at `http://localhost:1234` and it provides endpoints like `/v1/models`, `/v1/chat/completions`, etc. The `url` will be `http://localhost:1234/v1`. For the `id` you can use (`lmstudio/${modelId}`) which will be displayed in the LMStudio interface.
|
|
313
312
|
|
|
314
313
|
```typescript
|
|
315
|
-
import { Agent } from
|
|
314
|
+
import { Agent } from '@mastra/core/agent'
|
|
316
315
|
|
|
317
316
|
const agent = new Agent({
|
|
318
|
-
id:
|
|
319
|
-
name:
|
|
320
|
-
instructions:
|
|
317
|
+
id: 'my-agent',
|
|
318
|
+
name: 'My Agent',
|
|
319
|
+
instructions: 'You are a helpful assistant',
|
|
321
320
|
model: {
|
|
322
|
-
id:
|
|
323
|
-
url:
|
|
324
|
-
}
|
|
321
|
+
id: 'lmstudio/qwen/qwen3-30b-a3b-2507',
|
|
322
|
+
url: 'http://localhost:1234/v1',
|
|
323
|
+
},
|
|
325
324
|
})
|
|
326
325
|
```
|
|
327
326
|
|
|
@@ -330,13 +329,13 @@ const agent = new Agent({
|
|
|
330
329
|
Mastra supports AI SDK provider modules, should you need to use them directly.
|
|
331
330
|
|
|
332
331
|
```typescript
|
|
333
|
-
import { groq } from '@ai-sdk/groq'
|
|
334
|
-
import { Agent } from
|
|
332
|
+
import { groq } from '@ai-sdk/groq'
|
|
333
|
+
import { Agent } from '@mastra/core/agent'
|
|
335
334
|
|
|
336
335
|
const agent = new Agent({
|
|
337
|
-
id:
|
|
338
|
-
name:
|
|
339
|
-
model: groq('gemma2-9b-it')
|
|
336
|
+
id: 'my-agent',
|
|
337
|
+
name: 'My Agent',
|
|
338
|
+
model: groq('gemma2-9b-it'),
|
|
340
339
|
})
|
|
341
340
|
```
|
|
342
341
|
|
|
@@ -11,22 +11,22 @@ BASETEN_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'baseten/MiniMaxAI/MiniMax-M2.5',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -57,30 +57,28 @@ for await (const chunk of stream) {
|
|
|
57
57
|
|
|
58
58
|
```typescript
|
|
59
59
|
const agent = new Agent({
|
|
60
|
-
id:
|
|
61
|
-
name:
|
|
60
|
+
id: 'custom-agent',
|
|
61
|
+
name: 'custom-agent',
|
|
62
62
|
model: {
|
|
63
|
-
url:
|
|
64
|
-
id:
|
|
63
|
+
url: 'https://inference.baseten.co/v1',
|
|
64
|
+
id: 'baseten/MiniMaxAI/MiniMax-M2.5',
|
|
65
65
|
apiKey: process.env.BASETEN_API_KEY,
|
|
66
66
|
headers: {
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
})
|
|
67
|
+
'X-Custom-Header': 'value',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### Dynamic model selection
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
76
|
const agent = new Agent({
|
|
77
|
-
id:
|
|
78
|
-
name:
|
|
77
|
+
id: 'dynamic-agent',
|
|
78
|
+
name: 'Dynamic Agent',
|
|
79
79
|
model: ({ requestContext }) => {
|
|
80
|
-
const useAdvanced = requestContext.task ===
|
|
81
|
-
return useAdvanced
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
});
|
|
80
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
81
|
+
return useAdvanced ? 'baseten/zai-org/GLM-5.2-Fast' : 'baseten/MiniMaxAI/MiniMax-M2.5'
|
|
82
|
+
},
|
|
83
|
+
})
|
|
86
84
|
```
|
|
@@ -11,22 +11,22 @@ CHUTES_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'chutes/MiniMaxAI/MiniMax-M2.5-TEE',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -58,30 +58,28 @@ for await (const chunk of stream) {
|
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
const agent = new Agent({
|
|
61
|
-
id:
|
|
62
|
-
name:
|
|
61
|
+
id: 'custom-agent',
|
|
62
|
+
name: 'custom-agent',
|
|
63
63
|
model: {
|
|
64
|
-
url:
|
|
65
|
-
id:
|
|
64
|
+
url: 'https://llm.chutes.ai/v1',
|
|
65
|
+
id: 'chutes/MiniMaxAI/MiniMax-M2.5-TEE',
|
|
66
66
|
apiKey: process.env.CHUTES_API_KEY,
|
|
67
67
|
headers: {
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})
|
|
68
|
+
'X-Custom-Header': 'value',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
### Dynamic model selection
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
const agent = new Agent({
|
|
78
|
-
id:
|
|
79
|
-
name:
|
|
78
|
+
id: 'dynamic-agent',
|
|
79
|
+
name: 'Dynamic Agent',
|
|
80
80
|
model: ({ requestContext }) => {
|
|
81
|
-
const useAdvanced = requestContext.task ===
|
|
82
|
-
return useAdvanced
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
});
|
|
81
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
82
|
+
return useAdvanced ? 'chutes/zai-org/GLM-5.2-TEE' : 'chutes/MiniMaxAI/MiniMax-M2.5-TEE'
|
|
83
|
+
},
|
|
84
|
+
})
|
|
87
85
|
```
|
|
@@ -11,22 +11,22 @@ CROSSMODEL_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'crossmodel/anthropic/claude-fable-5',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -89,30 +89,28 @@ for await (const chunk of stream) {
|
|
|
89
89
|
|
|
90
90
|
```typescript
|
|
91
91
|
const agent = new Agent({
|
|
92
|
-
id:
|
|
93
|
-
name:
|
|
92
|
+
id: 'custom-agent',
|
|
93
|
+
name: 'custom-agent',
|
|
94
94
|
model: {
|
|
95
|
-
url:
|
|
96
|
-
id:
|
|
95
|
+
url: 'https://api.crossmodel.ai/v1',
|
|
96
|
+
id: 'crossmodel/anthropic/claude-fable-5',
|
|
97
97
|
apiKey: process.env.CROSSMODEL_API_KEY,
|
|
98
98
|
headers: {
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
})
|
|
99
|
+
'X-Custom-Header': 'value',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
### Dynamic model selection
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
108
|
const agent = new Agent({
|
|
109
|
-
id:
|
|
110
|
-
name:
|
|
109
|
+
id: 'dynamic-agent',
|
|
110
|
+
name: 'Dynamic Agent',
|
|
111
111
|
model: ({ requestContext }) => {
|
|
112
|
-
const useAdvanced = requestContext.task ===
|
|
113
|
-
return useAdvanced
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
});
|
|
112
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
113
|
+
return useAdvanced ? 'crossmodel/z-ai/glm-5.2' : 'crossmodel/anthropic/claude-fable-5'
|
|
114
|
+
},
|
|
115
|
+
})
|
|
118
116
|
```
|
|
@@ -11,22 +11,22 @@ DEEPINFRA_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'deepinfra/MiniMaxAI/MiniMax-M2.5',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -79,31 +79,29 @@ for await (const chunk of stream) {
|
|
|
79
79
|
|
|
80
80
|
```typescript
|
|
81
81
|
const agent = new Agent({
|
|
82
|
-
id:
|
|
83
|
-
name:
|
|
82
|
+
id: 'custom-agent',
|
|
83
|
+
name: 'custom-agent',
|
|
84
84
|
model: {
|
|
85
|
-
id:
|
|
85
|
+
id: 'deepinfra/MiniMaxAI/MiniMax-M2.5',
|
|
86
86
|
apiKey: process.env.DEEPINFRA_API_KEY,
|
|
87
87
|
headers: {
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
})
|
|
88
|
+
'X-Custom-Header': 'value',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
### Dynamic model selection
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
97
|
const agent = new Agent({
|
|
98
|
-
id:
|
|
99
|
-
name:
|
|
98
|
+
id: 'dynamic-agent',
|
|
99
|
+
name: 'Dynamic Agent',
|
|
100
100
|
model: ({ requestContext }) => {
|
|
101
|
-
const useAdvanced = requestContext.task ===
|
|
102
|
-
return useAdvanced
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
});
|
|
101
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
102
|
+
return useAdvanced ? 'deepinfra/zai-org/GLM-5.2' : 'deepinfra/MiniMaxAI/MiniMax-M2.5'
|
|
103
|
+
},
|
|
104
|
+
})
|
|
107
105
|
```
|
|
108
106
|
|
|
109
107
|
## Direct provider installation
|
|
@@ -11,22 +11,22 @@ HYPER_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'hyper/deepseek-v4-flash',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -63,30 +63,28 @@ for await (const chunk of stream) {
|
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
65
|
const agent = new Agent({
|
|
66
|
-
id:
|
|
67
|
-
name:
|
|
66
|
+
id: 'custom-agent',
|
|
67
|
+
name: 'custom-agent',
|
|
68
68
|
model: {
|
|
69
|
-
url:
|
|
70
|
-
id:
|
|
69
|
+
url: 'https://hyper.charm.land/v1',
|
|
70
|
+
id: 'hyper/deepseek-v4-flash',
|
|
71
71
|
apiKey: process.env.HYPER_API_KEY,
|
|
72
72
|
headers: {
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
})
|
|
73
|
+
'X-Custom-Header': 'value',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### Dynamic model selection
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const agent = new Agent({
|
|
83
|
-
id:
|
|
84
|
-
name:
|
|
83
|
+
id: 'dynamic-agent',
|
|
84
|
+
name: 'Dynamic Agent',
|
|
85
85
|
model: ({ requestContext }) => {
|
|
86
|
-
const useAdvanced = requestContext.task ===
|
|
87
|
-
return useAdvanced
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
});
|
|
86
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
87
|
+
return useAdvanced ? 'hyper/qwen3.7-plus' : 'hyper/deepseek-v4-flash'
|
|
88
|
+
},
|
|
89
|
+
})
|
|
92
90
|
```
|
|
@@ -11,22 +11,22 @@ LLMGATEWAY_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'llmgateway/auto',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -228,30 +228,28 @@ for await (const chunk of stream) {
|
|
|
228
228
|
|
|
229
229
|
```typescript
|
|
230
230
|
const agent = new Agent({
|
|
231
|
-
id:
|
|
232
|
-
name:
|
|
231
|
+
id: 'custom-agent',
|
|
232
|
+
name: 'custom-agent',
|
|
233
233
|
model: {
|
|
234
|
-
url:
|
|
235
|
-
id:
|
|
234
|
+
url: 'https://api.llmgateway.io/v1',
|
|
235
|
+
id: 'llmgateway/auto',
|
|
236
236
|
apiKey: process.env.LLMGATEWAY_API_KEY,
|
|
237
237
|
headers: {
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
})
|
|
238
|
+
'X-Custom-Header': 'value',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
})
|
|
242
242
|
```
|
|
243
243
|
|
|
244
244
|
### Dynamic model selection
|
|
245
245
|
|
|
246
246
|
```typescript
|
|
247
247
|
const agent = new Agent({
|
|
248
|
-
id:
|
|
249
|
-
name:
|
|
248
|
+
id: 'dynamic-agent',
|
|
249
|
+
name: 'Dynamic Agent',
|
|
250
250
|
model: ({ requestContext }) => {
|
|
251
|
-
const useAdvanced = requestContext.task ===
|
|
252
|
-
return useAdvanced
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
});
|
|
251
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
252
|
+
return useAdvanced ? 'llmgateway/sonar-reasoning-pro' : 'llmgateway/auto'
|
|
253
|
+
},
|
|
254
|
+
})
|
|
257
255
|
```
|
|
@@ -11,22 +11,22 @@ WANDB_API_KEY=your-api-key
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Agent } from
|
|
14
|
+
import { Agent } from '@mastra/core/agent'
|
|
15
15
|
|
|
16
16
|
const agent = new Agent({
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
instructions:
|
|
20
|
-
model:
|
|
21
|
-
})
|
|
17
|
+
id: 'my-agent',
|
|
18
|
+
name: 'My Agent',
|
|
19
|
+
instructions: 'You are a helpful assistant',
|
|
20
|
+
model: 'wandb/JetBrains/Mellum2-12B-A2.5B-Instruct',
|
|
21
|
+
})
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
24
|
-
const response = await agent.generate(
|
|
24
|
+
const response = await agent.generate('Hello!')
|
|
25
25
|
|
|
26
26
|
// Stream a response
|
|
27
|
-
const stream = await agent.stream(
|
|
27
|
+
const stream = await agent.stream('Tell me a story')
|
|
28
28
|
for await (const chunk of stream) {
|
|
29
|
-
console.log(chunk)
|
|
29
|
+
console.log(chunk)
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
@@ -70,30 +70,28 @@ for await (const chunk of stream) {
|
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
72
|
const agent = new Agent({
|
|
73
|
-
id:
|
|
74
|
-
name:
|
|
73
|
+
id: 'custom-agent',
|
|
74
|
+
name: 'custom-agent',
|
|
75
75
|
model: {
|
|
76
|
-
url:
|
|
77
|
-
id:
|
|
76
|
+
url: 'https://api.inference.wandb.ai/v1',
|
|
77
|
+
id: 'wandb/JetBrains/Mellum2-12B-A2.5B-Instruct',
|
|
78
78
|
apiKey: process.env.WANDB_API_KEY,
|
|
79
79
|
headers: {
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
})
|
|
80
|
+
'X-Custom-Header': 'value',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
### Dynamic model selection
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
89
|
const agent = new Agent({
|
|
90
|
-
id:
|
|
91
|
-
name:
|
|
90
|
+
id: 'dynamic-agent',
|
|
91
|
+
name: 'Dynamic Agent',
|
|
92
92
|
model: ({ requestContext }) => {
|
|
93
|
-
const useAdvanced = requestContext.task ===
|
|
94
|
-
return useAdvanced
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
});
|
|
93
|
+
const useAdvanced = requestContext.task === 'complex'
|
|
94
|
+
return useAdvanced ? 'wandb/zai-org/GLM-5.2' : 'wandb/JetBrains/Mellum2-12B-A2.5B-Instruct'
|
|
95
|
+
},
|
|
96
|
+
})
|
|
99
97
|
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.12-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73)]:
|
|
8
|
+
- @mastra/core@1.55.0-alpha.3
|
|
9
|
+
|
|
3
10
|
## 1.2.12-alpha.3
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.12-alpha.
|
|
3
|
+
"version": "1.2.12-alpha.4",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.55.0-alpha.
|
|
31
|
+
"@mastra/core": "1.55.0-alpha.3",
|
|
32
32
|
"@mastra/mcp": "^1.15.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"tsx": "^4.23.1",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
47
|
"vitest": "4.1.10",
|
|
48
|
-
"@internal/lint": "0.0.118",
|
|
49
48
|
"@internal/types-builder": "0.0.93",
|
|
50
|
-
"@mastra/core": "1.55.0-alpha.
|
|
49
|
+
"@mastra/core": "1.55.0-alpha.3",
|
|
50
|
+
"@internal/lint": "0.0.118"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|