@mastra/mcp-docs-server 1.1.33-alpha.7 → 1.1.33
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/mcp/mcp-apps.md +304 -0
- package/.docs/docs/mcp/overview.md +7 -0
- package/.docs/docs/memory/observational-memory.md +3 -3
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/clarifai.md +2 -1
- package/.docs/models/providers/deepinfra.md +3 -1
- package/.docs/models/providers/dinference.md +4 -2
- package/.docs/models/providers/frogbot.md +96 -0
- package/.docs/models/providers.md +1 -1
- package/.docs/reference/tools/mcp-client.md +32 -0
- package/.docs/reference/tools/mcp-server.md +64 -0
- package/CHANGELOG.md +16 -0
- package/package.json +6 -6
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# MCP Apps
|
|
2
|
+
|
|
3
|
+
The [MCP Apps extension](https://github.com/modelcontextprotocol/ext-apps) allows MCP tools to serve interactive HTML UIs via `ui://` resources. When a tool has an associated app resource, Mastra Studio renders it in a sandboxed iframe alongside the tool form or inline in agent chat.
|
|
4
|
+
|
|
5
|
+
## When to use MCP Apps
|
|
6
|
+
|
|
7
|
+
Use MCP Apps when a tool result is better presented as an interactive UI rather than plain text. For example:
|
|
8
|
+
|
|
9
|
+
- A calculator that renders input fields and buttons for computation
|
|
10
|
+
- A color picker that displays swatches and hex values
|
|
11
|
+
- A form builder that captures structured user input
|
|
12
|
+
- A data visualizer that renders charts
|
|
13
|
+
|
|
14
|
+
## Quickstart
|
|
15
|
+
|
|
16
|
+
Define app resources on your `MCPServer` by providing a `ui://` URI mapped to inline HTML or an HTML file path.
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { MCPServer } from '@mastra/mcp'
|
|
20
|
+
import { createTool } from '@mastra/core/tools'
|
|
21
|
+
import { z } from 'zod'
|
|
22
|
+
|
|
23
|
+
const calculatorTool = createTool({
|
|
24
|
+
id: 'calculatorWithUI',
|
|
25
|
+
description: 'An interactive calculator',
|
|
26
|
+
inputSchema: z.object({
|
|
27
|
+
num1: z.number(),
|
|
28
|
+
num2: z.number(),
|
|
29
|
+
operation: z.enum(['add', 'subtract']),
|
|
30
|
+
}),
|
|
31
|
+
execute: async ({ num1, num2, operation }) => {
|
|
32
|
+
const result = operation === 'add' ? num1 + num2 : num1 - num2
|
|
33
|
+
return {
|
|
34
|
+
content: [{ type: 'text', text: 'An interactive calculator is displayed.' }],
|
|
35
|
+
structuredContent: { result },
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const server = new MCPServer({
|
|
41
|
+
id: 'my-app-server',
|
|
42
|
+
name: 'My App Server',
|
|
43
|
+
version: '1.0.0',
|
|
44
|
+
tools: { calculatorTool },
|
|
45
|
+
appResources: {
|
|
46
|
+
'ui://calculator/main': {
|
|
47
|
+
name: 'Interactive Calculator',
|
|
48
|
+
html: `<html>
|
|
49
|
+
<body>
|
|
50
|
+
<h2>Calculator</h2>
|
|
51
|
+
<button id="btn">Compute</button>
|
|
52
|
+
<script type="module">
|
|
53
|
+
import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm';
|
|
54
|
+
const app = new App({ name: 'Calculator', version: '1.0.0' });
|
|
55
|
+
app.ontoolinput = (params) => {
|
|
56
|
+
console.log('Tool input:', params.arguments);
|
|
57
|
+
};
|
|
58
|
+
document.getElementById('btn').addEventListener('click', async () => {
|
|
59
|
+
const result = await app.callServerTool({
|
|
60
|
+
name: 'calculatorWithUI',
|
|
61
|
+
arguments: { num1: 10, num2: 5, operation: 'add' }
|
|
62
|
+
});
|
|
63
|
+
document.body.innerHTML += '<p>Result: ' + JSON.stringify(result) + '</p>';
|
|
64
|
+
});
|
|
65
|
+
await app.connect();
|
|
66
|
+
</script>
|
|
67
|
+
</body>
|
|
68
|
+
</html>`,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Link the tool to its app resource by adding `_meta.ui.resourceUri` to the tool definition:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
calculatorTool._meta = {
|
|
78
|
+
ui: { resourceUri: 'ui://calculator/main' },
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> **Note:** Visit [MCPServer reference](https://mastra.ai/reference/tools/mcp-server) for the full `appResources` configuration.
|
|
83
|
+
|
|
84
|
+
## Connecting MCP Apps to agents
|
|
85
|
+
|
|
86
|
+
Agents consume tools — they do not need to know about MCP servers. Pass tools to the agent's `tools` config, and register the MCP server at the Mastra level so Studio can resolve app resources.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { Agent } from '@mastra/core/agent'
|
|
90
|
+
import { calculatorTool } from '../mcp/tools'
|
|
91
|
+
|
|
92
|
+
export const myAgent = new Agent({
|
|
93
|
+
id: 'my-agent',
|
|
94
|
+
name: 'My Agent',
|
|
95
|
+
instructions: 'You have access to interactive UI tools.',
|
|
96
|
+
model: 'openai/gpt-5-mini',
|
|
97
|
+
tools: { calculatorTool },
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Register the MCP server at the Mastra level. Studio scans registered MCP servers to map tools to their app resources.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
105
|
+
import { myAgent } from './agents'
|
|
106
|
+
import { myAppServer } from './mcp/server'
|
|
107
|
+
|
|
108
|
+
export const mastra = new Mastra({
|
|
109
|
+
agents: { myAgent },
|
|
110
|
+
mcpServers: { myAppServer },
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
For remote MCP servers, use `MCPClient.listTools()` to get tools and `toMCPServerProxies()` to register the server:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { MCPClient } from '@mastra/mcp'
|
|
118
|
+
|
|
119
|
+
const mcpClient = new MCPClient({
|
|
120
|
+
servers: {
|
|
121
|
+
remoteApp: { url: new URL('https://remote-mcp-server.example.com/mcp') },
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
const myAgent = new Agent({
|
|
126
|
+
id: 'my-agent',
|
|
127
|
+
name: 'My Agent',
|
|
128
|
+
model: 'openai/gpt-5-mini',
|
|
129
|
+
tools: await mcpClient.listTools(),
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
export const mastra = new Mastra({
|
|
133
|
+
agents: { myAgent },
|
|
134
|
+
mcpServers: { ...mcpClient.toMCPServerProxies() },
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
When tools come from `MCPClient.listTools()`, each tool's `_meta.ui` is automatically stamped with a `serverId` so Studio can resolve its app resources without scanning all servers.
|
|
139
|
+
|
|
140
|
+
## How MCP Apps work
|
|
141
|
+
|
|
142
|
+
MCP Apps follow a specific communication pattern between the host (Mastra Studio) and the iframe:
|
|
143
|
+
|
|
144
|
+
1. The tool executes and returns a brief summary in `content` (visible to the model) and detailed data in `structuredContent` (visible to the UI only).
|
|
145
|
+
2. The host renders the app HTML in a sandboxed iframe.
|
|
146
|
+
3. The iframe communicates with the host via a JSON-RPC postMessage protocol.
|
|
147
|
+
4. The app can call server tools using `callServerTool()` and inject messages into the chat using `sendMessage()`.
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
Agent calls tool → Tool returns brief content + structuredContent
|
|
151
|
+
→ Host renders iframe with app HTML
|
|
152
|
+
→ User interacts with UI
|
|
153
|
+
→ UI calls callServerTool() for computation
|
|
154
|
+
→ UI calls sendMessage() to inject result into chat
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Tool result format
|
|
158
|
+
|
|
159
|
+
Tools with app resources should return two fields:
|
|
160
|
+
|
|
161
|
+
- `content`: A brief text summary for the model. Keep this short so the agent does not parrot the full result.
|
|
162
|
+
- `structuredContent`: The data payload that hydrates the UI. The model does not see this field.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
execute: async ({ num1, num2, operation }) => {
|
|
166
|
+
const result = operation === 'add' ? num1 + num2 : num1 - num2
|
|
167
|
+
return {
|
|
168
|
+
content: [{ type: 'text', text: 'An interactive calculator is displayed.' }],
|
|
169
|
+
structuredContent: { result },
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## App API (guest-side)
|
|
175
|
+
|
|
176
|
+
MCP App HTML uses the standard [`App` class from `@modelcontextprotocol/ext-apps`](https://github.com/modelcontextprotocol/ext-apps) to communicate with the host. Import it via ESM CDN or bundle it.
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm'
|
|
180
|
+
const app = new App({ name: 'MyApp', version: '1.0.0' })
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### `app.callServerTool(params)`
|
|
184
|
+
|
|
185
|
+
Calls an MCP server tool from within the iframe. This is useful for interactive computation without leaving the UI.
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
const result = await app.callServerTool({
|
|
189
|
+
name: 'calculatorWithUI',
|
|
190
|
+
arguments: { num1: 42, num2: 8, operation: 'add' },
|
|
191
|
+
})
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### `app.sendMessage(params)`
|
|
195
|
+
|
|
196
|
+
Injects a user message into the agent chat, triggering a new model turn. Use this for sharing results or requesting follow-up actions.
|
|
197
|
+
|
|
198
|
+
```javascript
|
|
199
|
+
await app.sendMessage({
|
|
200
|
+
role: 'user',
|
|
201
|
+
content: [{ type: 'text', text: 'The result of 42 + 8 is 50' }],
|
|
202
|
+
})
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### `app.ontoolinput`
|
|
206
|
+
|
|
207
|
+
A callback that fires when the host delivers tool input data to the iframe, allowing pre-population of form fields. The `params.arguments` object contains the tool call arguments.
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
app.ontoolinput = params => {
|
|
211
|
+
document.getElementById('num1').value = params.arguments.num1
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
> **Preventing UI flicker:** If your app has default form values, the user may briefly see them before `ontoolinput` hydrates the correct values. To prevent this, start the body hidden and reveal it after hydration:
|
|
216
|
+
>
|
|
217
|
+
> ```html
|
|
218
|
+
> <style>
|
|
219
|
+
> body {
|
|
220
|
+
> opacity: 0;
|
|
221
|
+
> transition: opacity 0.15s;
|
|
222
|
+
> }
|
|
223
|
+
> body.ready {
|
|
224
|
+
> opacity: 1;
|
|
225
|
+
> }
|
|
226
|
+
> </style>
|
|
227
|
+
> <script type="module">
|
|
228
|
+
> import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm'
|
|
229
|
+
> const app = new App({ name: 'MyApp', version: '1.0.0' })
|
|
230
|
+
>
|
|
231
|
+
> app.ontoolinput = params => {
|
|
232
|
+
> // Hydrate form fields from params.arguments
|
|
233
|
+
> document.body.classList.add('ready')
|
|
234
|
+
> }
|
|
235
|
+
>
|
|
236
|
+
> await app.connect()
|
|
237
|
+
> // Fallback: reveal after connection if no tool input arrives
|
|
238
|
+
> setTimeout(() => document.body.classList.add('ready'), 150)
|
|
239
|
+
> </script>
|
|
240
|
+
> ```
|
|
241
|
+
|
|
242
|
+
### `app.connect()`
|
|
243
|
+
|
|
244
|
+
Establishes the connection to the host. Call this after registering all event handlers.
|
|
245
|
+
|
|
246
|
+
```javascript
|
|
247
|
+
await app.connect()
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
> **Note:** See the [`App` class API reference](https://apps.extensions.modelcontextprotocol.io/api/classes/app.App.html) for the full list of methods, callbacks, and lifecycle hooks.
|
|
251
|
+
|
|
252
|
+
## Using external MCP servers with apps
|
|
253
|
+
|
|
254
|
+
External (non-Mastra) MCP servers that implement the MCP Apps extension work with Mastra via `MCPClient`. Use `listTools()` for agent tools and `toMCPServerProxies()` to register them in Studio.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
258
|
+
import { MCPClient } from '@mastra/mcp'
|
|
259
|
+
import { Agent } from '@mastra/core/agent'
|
|
260
|
+
|
|
261
|
+
const mcpClient = new MCPClient({
|
|
262
|
+
servers: {
|
|
263
|
+
'external-server': {
|
|
264
|
+
command: 'node',
|
|
265
|
+
args: ['path/to/external-server.js'],
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
const myAgent = new Agent({
|
|
271
|
+
id: 'my-agent',
|
|
272
|
+
name: 'My Agent',
|
|
273
|
+
model: 'openai/gpt-5-mini',
|
|
274
|
+
tools: await mcpClient.listTools(),
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
export const mastra = new Mastra({
|
|
278
|
+
agents: { myAgent },
|
|
279
|
+
mcpServers: {
|
|
280
|
+
...mcpClient.toMCPServerProxies(),
|
|
281
|
+
},
|
|
282
|
+
})
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
> **Note:** Visit [MCPClient reference](https://mastra.ai/reference/tools/mcp-client) for more details on proxying external servers.
|
|
286
|
+
|
|
287
|
+
## Sandbox security
|
|
288
|
+
|
|
289
|
+
Mastra Studio uses [`@mcp-ui/client`](https://www.npmjs.com/package/@mcp-ui/client) to render MCP App iframes through a sandbox proxy. The proxy loads app HTML via `postMessage` rather than `srcDoc`, providing additional isolation.
|
|
290
|
+
|
|
291
|
+
App iframes are sandboxed with the following permissions:
|
|
292
|
+
|
|
293
|
+
- `allow-scripts`: Enables JavaScript execution
|
|
294
|
+
- `allow-forms`: Allows form submission
|
|
295
|
+
- `allow-popups`: Permits `window.open()` and link targets
|
|
296
|
+
|
|
297
|
+
The iframe does not have access to the parent page's DOM, cookies, or storage. All communication happens through the JSON-RPC postMessage protocol managed by `@mcp-ui/client`'s `AppRenderer` on the host side and `@modelcontextprotocol/ext-apps`'s `App` class on the guest side.
|
|
298
|
+
|
|
299
|
+
## Related
|
|
300
|
+
|
|
301
|
+
- [MCP overview](https://mastra.ai/docs/mcp/overview)
|
|
302
|
+
- [MCPServer reference](https://mastra.ai/reference/tools/mcp-server)
|
|
303
|
+
- [MCPClient reference](https://mastra.ai/reference/tools/mcp-client)
|
|
304
|
+
- [MCP Apps extension spec](https://github.com/modelcontextprotocol/ext-apps)
|
|
@@ -408,8 +408,15 @@ export const mcp = new MCPClient({
|
|
|
408
408
|
|
|
409
409
|
As an alternative to MCP, Ampersand's AI SDK also has an adapter for Mastra, so you can [directly import Ampersand tools](https://docs.withampersand.com/ai-sdk#use-with-mastra) for your agent to access.
|
|
410
410
|
|
|
411
|
+
## MCP Apps
|
|
412
|
+
|
|
413
|
+
MCP servers can serve interactive HTML UIs via the MCP Apps extension. Tools with associated `ui://` resources render sandboxed iframes in Studio — both on tool detail pages and inline in agent chat. The app iframe can call server tools and inject messages into the conversation.
|
|
414
|
+
|
|
415
|
+
> **Note:** Visit [MCP Apps](https://mastra.ai/docs/mcp/mcp-apps) for setup instructions and the app bridge API.
|
|
416
|
+
|
|
411
417
|
## Related
|
|
412
418
|
|
|
419
|
+
- [MCP Apps](https://mastra.ai/docs/mcp/mcp-apps)
|
|
413
420
|
- [Using Tools](https://mastra.ai/docs/agents/using-tools)
|
|
414
421
|
- [MCPClient](https://mastra.ai/reference/tools/mcp-client)
|
|
415
422
|
- [MCPServer](https://mastra.ai/reference/tools/mcp-server)
|
|
@@ -24,7 +24,7 @@ export const agent = new Agent({
|
|
|
24
24
|
})
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
That's it. The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses `google/gemini-2.5-flash` by default.
|
|
27
|
+
That's it. The agent now has humanlike long-term memory that persists across conversations. Setting `observationalMemory: true` uses `google/gemini-2.5-flash` by default. Config objects also use this model unless you set a different one. To use a different model, pass it in the config object:
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
const memory = new Memory({
|
|
@@ -44,7 +44,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
|
|
|
44
44
|
>
|
|
45
45
|
> For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/guides/build-your-ui/ai-sdk-ui).
|
|
46
46
|
|
|
47
|
-
> **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, and `@mastra/mongodb` storage adapters. It uses background agents for managing memory. When
|
|
47
|
+
> **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, and `@mastra/mongodb` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
|
|
48
48
|
|
|
49
49
|
## Temporal gap markers
|
|
50
50
|
|
|
@@ -212,7 +212,7 @@ The progress bars update live while the agent is observing or reflecting, showin
|
|
|
212
212
|
|
|
213
213
|
## Models
|
|
214
214
|
|
|
215
|
-
The Observer and Reflector run in the background. Any model that works with Mastra's [model routing](https://mastra.ai/models) (`provider/model`) can be used. When
|
|
215
|
+
The Observer and Reflector run in the background. Any model that works with Mastra's [model routing](https://mastra.ai/models) (`provider/model`) can be used. When no model is set, the default model is `google/gemini-2.5-flash`.
|
|
216
216
|
|
|
217
217
|
Generally speaking, we recommend using a model that has a large context window (128K+ tokens) and is fast enough to run in the background without slowing down your actions.
|
|
218
218
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenRouter
|
|
2
2
|
|
|
3
|
-
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
3
|
+
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 185 models through Mastra's model router.
|
|
4
4
|
|
|
5
5
|
Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
6
6
|
|
|
@@ -201,6 +201,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
201
201
|
| `x-ai/grok-4.1-fast` |
|
|
202
202
|
| `x-ai/grok-4.20-beta` |
|
|
203
203
|
| `x-ai/grok-4.20-multi-agent-beta` |
|
|
204
|
+
| `x-ai/grok-4.3` |
|
|
204
205
|
| `x-ai/grok-code-fast-1` |
|
|
205
206
|
| `xiaomi/mimo-v2-flash` |
|
|
206
207
|
| `xiaomi/mimo-v2-omni` |
|
package/.docs/models/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Model Providers
|
|
2
2
|
|
|
3
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
3
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 3875 models from 107 providers through a single API.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Clarifai
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 12 Clarifai models through Mastra's model router. Authentication is handled automatically using the `CLARIFAI_PAT` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Clarifai documentation](https://docs.clarifai.com).
|
|
6
6
|
|
|
@@ -40,6 +40,7 @@ for await (const chunk of stream) {
|
|
|
40
40
|
| `clarifai/minimaxai/chat-completion/models/MiniMax-M2_5-high-throughput` | 205K | | | | | | $0.30 | $1 |
|
|
41
41
|
| `clarifai/mistralai/completion/models/Ministral-3-14B-Reasoning-2512` | 262K | | | | | | $3 | $2 |
|
|
42
42
|
| `clarifai/mistralai/completion/models/Ministral-3-3B-Reasoning-2512` | 262K | | | | | | $1 | $0.55 |
|
|
43
|
+
| `clarifai/moonshotai/chat-completion/models/Kimi-K2_6` | 262K | | | | | | $0.95 | $4 |
|
|
43
44
|
| `clarifai/openai/chat-completion/models/gpt-oss-120b-high-throughput` | 131K | | | | | | $0.09 | $0.36 |
|
|
44
45
|
| `clarifai/openai/chat-completion/models/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.18 |
|
|
45
46
|
| `clarifai/qwen/qwenCoder/models/Qwen3-Coder-30B-A3B-Instruct` | 262K | | | | | | $0.11 | $0.75 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Deep Infra
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 35 Deep Infra models through Mastra's model router. Authentication is handled automatically using the `DEEPINFRA_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Deep Infra documentation](https://deepinfra.com/models).
|
|
6
6
|
|
|
@@ -37,6 +37,8 @@ for await (const chunk of stream) {
|
|
|
37
37
|
| `deepinfra/deepseek-ai/DeepSeek-R1-0528` | 164K | | | | | | $0.50 | $2 |
|
|
38
38
|
| `deepinfra/deepseek-ai/DeepSeek-V3.2` | 164K | | | | | | $0.26 | $0.38 |
|
|
39
39
|
| `deepinfra/deepseek-ai/DeepSeek-V4-Pro` | 66K | | | | | | $2 | $3 |
|
|
40
|
+
| `deepinfra/google/gemma-4-26B-A4B-it` | 256K | | | | | | $0.07 | $0.34 |
|
|
41
|
+
| `deepinfra/google/gemma-4-31B-it` | 256K | | | | | | $0.13 | $0.38 |
|
|
40
42
|
| `deepinfra/meta-llama/Llama-3.1-70B-Instruct` | 131K | | | | | | $0.40 | $0.40 |
|
|
41
43
|
| `deepinfra/meta-llama/Llama-3.1-70B-Instruct-Turbo` | 131K | | | | | | $0.40 | $0.40 |
|
|
42
44
|
| `deepinfra/meta-llama/Llama-3.1-8B-Instruct` | 131K | | | | | | $0.02 | $0.05 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DInference
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 5 DInference models through Mastra's model router. Authentication is handled automatically using the `DINFERENCE_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [DInference documentation](https://dinference.com).
|
|
6
6
|
|
|
@@ -36,7 +36,9 @@ for await (const chunk of stream) {
|
|
|
36
36
|
| ------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
37
|
| `dinference/glm-4.7` | 200K | | | | | | $0.45 | $2 |
|
|
38
38
|
| `dinference/glm-5` | 200K | | | | | | $0.75 | $2 |
|
|
39
|
+
| `dinference/glm-5.1` | 200K | | | | | | $1 | $4 |
|
|
39
40
|
| `dinference/gpt-oss-120b` | 131K | | | | | | $0.07 | $0.27 |
|
|
41
|
+
| `dinference/minimax-m2.5` | 200K | | | | | | $0.22 | $0.88 |
|
|
40
42
|
|
|
41
43
|
## Advanced configuration
|
|
42
44
|
|
|
@@ -66,7 +68,7 @@ const agent = new Agent({
|
|
|
66
68
|
model: ({ requestContext }) => {
|
|
67
69
|
const useAdvanced = requestContext.task === "complex";
|
|
68
70
|
return useAdvanced
|
|
69
|
-
? "dinference/
|
|
71
|
+
? "dinference/minimax-m2.5"
|
|
70
72
|
: "dinference/glm-4.7";
|
|
71
73
|
}
|
|
72
74
|
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# FrogBot
|
|
2
|
+
|
|
3
|
+
Access 26 FrogBot models through Mastra's model router. Authentication is handled automatically using the `FROGBOT_API_KEY` environment variable.
|
|
4
|
+
|
|
5
|
+
Learn more in the [FrogBot documentation](https://docs.frogbot.ai).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
FROGBOT_API_KEY=your-api-key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from "@mastra/core/agent";
|
|
13
|
+
|
|
14
|
+
const agent = new Agent({
|
|
15
|
+
id: "my-agent",
|
|
16
|
+
name: "My Agent",
|
|
17
|
+
instructions: "You are a helpful assistant",
|
|
18
|
+
model: "frogbot/claude-haiku-4-5"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Generate a response
|
|
22
|
+
const response = await agent.generate("Hello!");
|
|
23
|
+
|
|
24
|
+
// Stream a response
|
|
25
|
+
const stream = await agent.stream("Tell me a story");
|
|
26
|
+
for await (const chunk of stream) {
|
|
27
|
+
console.log(chunk);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [FrogBot documentation](https://docs.frogbot.ai) for details.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| ------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `frogbot/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
38
|
+
| `frogbot/claude-opus-4-6` | 200K | | | | | | $5 | $25 |
|
|
39
|
+
| `frogbot/claude-opus-4-7` | 200K | | | | | | $5 | $25 |
|
|
40
|
+
| `frogbot/claude-sonnet-4-6` | 200K | | | | | | $3 | $15 |
|
|
41
|
+
| `frogbot/deepseek-v4-pro` | 128K | | | | | | $2 | $3 |
|
|
42
|
+
| `frogbot/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
|
|
43
|
+
| `frogbot/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
|
|
44
|
+
| `frogbot/gemini-3-1-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
45
|
+
| `frogbot/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
|
|
46
|
+
| `frogbot/gpt-4o` | 128K | | | | | | $3 | $10 |
|
|
47
|
+
| `frogbot/gpt-5-3-codex` | 400K | | | | | | $2 | $14 |
|
|
48
|
+
| `frogbot/gpt-5-4-mini` | 400K | | | | | | $0.75 | $5 |
|
|
49
|
+
| `frogbot/gpt-5-4-nano` | 400K | | | | | | $0.20 | $1 |
|
|
50
|
+
| `frogbot/gpt-5-5` | 272K | | | | | | $3 | $15 |
|
|
51
|
+
| `frogbot/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.60 |
|
|
52
|
+
| `frogbot/gpt-oss-20b` | 131K | | | | | | $0.07 | $0.20 |
|
|
53
|
+
| `frogbot/grok-4-1-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
54
|
+
| `frogbot/grok-4-1-fast-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
55
|
+
| `frogbot/grok-4-3` | 1.0M | | | | | | $1 | $3 |
|
|
56
|
+
| `frogbot/grok-code-fast-1` | 256K | | | | | | $0.20 | $2 |
|
|
57
|
+
| `frogbot/kimi-k2-6` | 256K | | | | | | $0.95 | $4 |
|
|
58
|
+
| `frogbot/kimi-k2.5` | 256K | | | | | | $0.60 | $3 |
|
|
59
|
+
| `frogbot/minimax-m2-5` | 192K | | | | | | $0.30 | $1 |
|
|
60
|
+
| `frogbot/minimax-m2-7` | 192K | | | | | | $0.30 | $1 |
|
|
61
|
+
| `frogbot/qwen-3-6-plus` | 1.0M | | | | | | $0.50 | $3 |
|
|
62
|
+
| `frogbot/zai-glm-5-1` | 198K | | | | | | $1 | $4 |
|
|
63
|
+
|
|
64
|
+
## Advanced configuration
|
|
65
|
+
|
|
66
|
+
### Custom headers
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const agent = new Agent({
|
|
70
|
+
id: "custom-agent",
|
|
71
|
+
name: "custom-agent",
|
|
72
|
+
model: {
|
|
73
|
+
url: "https://app.frogbot.ai/api/v1",
|
|
74
|
+
id: "frogbot/claude-haiku-4-5",
|
|
75
|
+
apiKey: process.env.FROGBOT_API_KEY,
|
|
76
|
+
headers: {
|
|
77
|
+
"X-Custom-Header": "value"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Dynamic model selection
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
const agent = new Agent({
|
|
87
|
+
id: "dynamic-agent",
|
|
88
|
+
name: "Dynamic Agent",
|
|
89
|
+
model: ({ requestContext }) => {
|
|
90
|
+
const useAdvanced = requestContext.task === "complex";
|
|
91
|
+
return useAdvanced
|
|
92
|
+
? "frogbot/zai-glm-5-1"
|
|
93
|
+
: "frogbot/claude-haiku-4-5";
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
```
|
|
@@ -32,8 +32,8 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
32
32
|
- [evroc](https://mastra.ai/models/providers/evroc)
|
|
33
33
|
- [FastRouter](https://mastra.ai/models/providers/fastrouter)
|
|
34
34
|
- [Fireworks AI](https://mastra.ai/models/providers/fireworks-ai)
|
|
35
|
-
- [Firmware](https://mastra.ai/models/providers/firmware)
|
|
36
35
|
- [Friendli](https://mastra.ai/models/providers/friendli)
|
|
36
|
+
- [FrogBot](https://mastra.ai/models/providers/frogbot)
|
|
37
37
|
- [GitHub Models](https://mastra.ai/models/providers/github-models)
|
|
38
38
|
- [Helicone](https://mastra.ai/models/providers/helicone)
|
|
39
39
|
- [HPC-AI](https://mastra.ai/models/providers/hpc-ai)
|
|
@@ -126,6 +126,38 @@ Disconnects from all MCP servers and cleans up resources.
|
|
|
126
126
|
async disconnect(): Promise<void>
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
### `toMCPServerProxies()`
|
|
130
|
+
|
|
131
|
+
Returns a map of `MCPClientServerProxy` instances, one per configured server. Each proxy wraps the underlying client connection as an `MCPServerBase` instance, allowing external (non-Mastra) MCP servers to be registered in `mcpServers` and appear in Studio.
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
async toMCPServerProxies(): Promise<Record<string, MCPClientServerProxy>>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Spread the result into the `mcpServers` config on `Mastra`:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { Mastra } from '@mastra/core/mastra'
|
|
141
|
+
import { MCPClient } from '@mastra/mcp'
|
|
142
|
+
|
|
143
|
+
const mcpClient = new MCPClient({
|
|
144
|
+
servers: {
|
|
145
|
+
'color-mixer': {
|
|
146
|
+
command: 'node',
|
|
147
|
+
args: ['path/to/color-mixer-server.js'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
export const mastra = new Mastra({
|
|
153
|
+
mcpServers: {
|
|
154
|
+
...(await mcpClient.toMCPServerProxies()),
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This is useful for connecting external MCP servers that implement the MCP Apps extension or other features to Studio without wrapping them in a Mastra `MCPServer`.
|
|
160
|
+
|
|
129
161
|
### `resources` Property
|
|
130
162
|
|
|
131
163
|
The `MCPClient` instance has a `resources` property that provides access to resource-related operations.
|
|
@@ -83,6 +83,8 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
83
83
|
|
|
84
84
|
**prompts** (`MCPServerPrompts`): An object defining how the server should handle MCP prompts. See Prompt Handling section for details.
|
|
85
85
|
|
|
86
|
+
**appResources** (`AppResources`): A map of \`ui://\` URIs to app resource configurations. Each entry defines an interactive HTML UI served via the MCP Apps extension (SEP-1865). See the MCP Apps section for details.
|
|
87
|
+
|
|
86
88
|
## Exposing agents as tools
|
|
87
89
|
|
|
88
90
|
A powerful feature of `MCPServer` is its ability to automatically expose your Mastra Agents as callable tools. When you provide agents in the `agents` property of the configuration:
|
|
@@ -1263,6 +1265,68 @@ app.all('/mcp', async (req, res) => {
|
|
|
1263
1265
|
app.listen(3000)
|
|
1264
1266
|
```
|
|
1265
1267
|
|
|
1268
|
+
## MCP Apps (`appResources`)
|
|
1269
|
+
|
|
1270
|
+
The `appResources` option lets you serve interactive HTML UIs from your MCP server via the [MCP Apps extension](https://github.com/modelcontextprotocol/ext-apps). Each entry maps a `ui://` URI to an HTML app that renders in a sandboxed iframe in Mastra Studio.
|
|
1271
|
+
|
|
1272
|
+
### `AppResources` type
|
|
1273
|
+
|
|
1274
|
+
**Key (URI)** (`string`): A \`ui://\` URI that identifies the app resource (e.g., \`ui://calculator/main\`).
|
|
1275
|
+
|
|
1276
|
+
Each value is an `AppResource` object:
|
|
1277
|
+
|
|
1278
|
+
**name** (`string`): Display name for the UI resource.
|
|
1279
|
+
|
|
1280
|
+
**description** (`string`): Optional description of the UI resource.
|
|
1281
|
+
|
|
1282
|
+
**html** (`string`): Inline HTML content for the UI. Provide either \`html\` or \`htmlPath\`.
|
|
1283
|
+
|
|
1284
|
+
**htmlPath** (`string`): Path to an HTML file. Resolved at server startup. Provide either \`html\` or \`htmlPath\`.
|
|
1285
|
+
|
|
1286
|
+
**meta** (`McpUiResourceMeta`): UI resource metadata (CSP, permissions, rendering preferences) from the official ext-apps SDK.
|
|
1287
|
+
|
|
1288
|
+
### Example
|
|
1289
|
+
|
|
1290
|
+
```typescript
|
|
1291
|
+
import { MCPServer } from '@mastra/mcp'
|
|
1292
|
+
import { createTool } from '@mastra/core/tools'
|
|
1293
|
+
import { z } from 'zod'
|
|
1294
|
+
|
|
1295
|
+
const calculatorTool = createTool({
|
|
1296
|
+
id: 'calculatorWithUI',
|
|
1297
|
+
description: 'An interactive calculator',
|
|
1298
|
+
inputSchema: z.object({
|
|
1299
|
+
num1: z.number(),
|
|
1300
|
+
num2: z.number(),
|
|
1301
|
+
operation: z.enum(['add', 'subtract']),
|
|
1302
|
+
}),
|
|
1303
|
+
execute: async ({ num1, num2, operation }) => {
|
|
1304
|
+
const result = operation === 'add' ? num1 + num2 : num1 - num2
|
|
1305
|
+
return {
|
|
1306
|
+
content: [{ type: 'text', text: 'An interactive calculator is displayed.' }],
|
|
1307
|
+
structuredContent: { result },
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
})
|
|
1311
|
+
|
|
1312
|
+
const server = new MCPServer({
|
|
1313
|
+
id: 'app-server',
|
|
1314
|
+
name: 'App Server',
|
|
1315
|
+
version: '1.0.0',
|
|
1316
|
+
tools: { calculatorTool },
|
|
1317
|
+
appResources: {
|
|
1318
|
+
'ui://calculator/main': {
|
|
1319
|
+
name: 'Interactive Calculator',
|
|
1320
|
+
html: '<html><body><h2>Calculator</h2>...</body></html>',
|
|
1321
|
+
},
|
|
1322
|
+
},
|
|
1323
|
+
})
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
Link a tool to its app resource by setting `_meta.ui.resourceUri` on the tool to the matching `ui://` URI. The server auto-normalizes this metadata when registering tools.
|
|
1327
|
+
|
|
1328
|
+
> **Note:** Visit [MCP Apps](https://mastra.ai/docs/mcp/mcp-apps) for the full app bridge API and usage patterns.
|
|
1329
|
+
|
|
1266
1330
|
## Related information
|
|
1267
1331
|
|
|
1268
1332
|
- For connecting to MCP servers in Mastra, see the [MCPClient documentation](https://mastra.ai/reference/tools/mcp-client).
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.33
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`6dcd65f`](https://github.com/mastra-ai/mastra/commit/6dcd65f2a34069e6dc43ba35f1d11119b9b40bef), [`86c0298`](https://github.com/mastra-ai/mastra/commit/86c0298e647306423c842f9d5ac827bd616bd13d), [`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`ca28c23`](https://github.com/mastra-ai/mastra/commit/ca28c232a2f18801a6cf20fe053479237b4d4fb0), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`7fce309`](https://github.com/mastra-ai/mastra/commit/7fce30912b14170bfc41f0ac736cca0f39fe0cd4), [`1d64a76`](https://github.com/mastra-ai/mastra/commit/1d64a765861a0772ea187bab76e5ed37bf82d042), [`1c2dda8`](https://github.com/mastra-ai/mastra/commit/1c2dda805fbfccc0abf55d4cb20cc34402dc3f0c), [`86c0298`](https://github.com/mastra-ai/mastra/commit/86c0298e647306423c842f9d5ac827bd616bd13d), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`7997c2e`](https://github.com/mastra-ai/mastra/commit/7997c2e55ddd121562a4098cd8d2b89c68433bf1), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`a0d9b6d`](https://github.com/mastra-ai/mastra/commit/a0d9b6d6b810aeaa9e177a0dcc99a4402e609634), [`e97ccb9`](https://github.com/mastra-ai/mastra/commit/e97ccb900f8b7a390ce82c9f8eb8d6eb2c5e3777), [`c5daf48`](https://github.com/mastra-ai/mastra/commit/c5daf48556e98c46ae06caf00f92c249912007e9), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`568777e`](https://github.com/mastra-ai/mastra/commit/568777ea8af77a672270b448dfd3996f9e75a964), [`cd96779`](https://github.com/mastra-ai/mastra/commit/cd9677937f113b2856dc8b9f3d4bdabcee58bb2e), [`b0c7022`](https://github.com/mastra-ai/mastra/commit/b0c70224f80dad7c0cdbfb22cbff22e0f75c064f), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d)]:
|
|
8
|
+
- @mastra/core@1.32.0
|
|
9
|
+
- @mastra/mcp@1.7.0
|
|
10
|
+
|
|
11
|
+
## 1.1.33-alpha.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`1d64a76`](https://github.com/mastra-ai/mastra/commit/1d64a765861a0772ea187bab76e5ed37bf82d042), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`a0d9b6d`](https://github.com/mastra-ai/mastra/commit/a0d9b6d6b810aeaa9e177a0dcc99a4402e609634)]:
|
|
16
|
+
- @mastra/core@1.32.0-alpha.4
|
|
17
|
+
- @mastra/mcp@1.7.0-alpha.2
|
|
18
|
+
|
|
3
19
|
## 1.1.33-alpha.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.33
|
|
3
|
+
"version": "1.1.33",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@mastra/
|
|
33
|
-
"@mastra/
|
|
32
|
+
"@mastra/core": "1.32.0",
|
|
33
|
+
"@mastra/mcp": "^1.7.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@hono/node-server": "^1.19.11",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "4.1.5",
|
|
49
|
-
"@internal/
|
|
50
|
-
"@internal/
|
|
51
|
-
"@mastra/core": "1.32.0
|
|
49
|
+
"@internal/lint": "0.0.91",
|
|
50
|
+
"@internal/types-builder": "0.0.66",
|
|
51
|
+
"@mastra/core": "1.32.0"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|