@mastra/mcp-docs-server 1.2.14-alpha.1 → 1.2.14-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.
Files changed (127) hide show
  1. package/.docs/docs/agents/a2a.md +1 -1
  2. package/.docs/docs/agents/acp.md +1 -1
  3. package/.docs/docs/agents/agent-approval.md +1 -1
  4. package/.docs/docs/agents/networks.md +2 -2
  5. package/.docs/docs/agents/overview.md +2 -2
  6. package/.docs/docs/agents/processors.md +25 -1
  7. package/.docs/docs/agents/using-tools.md +2 -2
  8. package/.docs/docs/capabilities/channels/overview.md +1 -1
  9. package/.docs/docs/{agents/supervisor-agents.md → capabilities/subagents.md} +58 -58
  10. package/.docs/docs/deployment/sandbox.md +95 -1
  11. package/.docs/docs/getting-started/develop.md +2 -0
  12. package/.docs/docs/harness/agent-controller.md +370 -0
  13. package/.docs/docs/long-running-agents/background-tasks.md +1 -1
  14. package/.docs/docs/long-running-agents/goals.md +3 -3
  15. package/.docs/docs/mcp/overview.md +222 -281
  16. package/.docs/docs/memory/overview.md +2 -2
  17. package/.docs/docs/observability/integrations/exporters/confident-ai.md +140 -0
  18. package/.docs/docs/observability/integrations/overview.md +1 -1
  19. package/.docs/docs/observability/overview.md +122 -8
  20. package/.docs/docs/observability/tracing/overview.md +2 -2
  21. package/.docs/docs/server/mastra-client.md +1 -1
  22. package/.docs/docs/server/server-adapters.md +2 -0
  23. package/.docs/docs/storage/overview.md +2 -2
  24. package/.docs/docs/workflows/agents-and-tools.md +29 -0
  25. package/.docs/docs/workflows/stored-workflows.md +146 -0
  26. package/.docs/guides/build-your-ui/copilotkit/channels.md +49 -39
  27. package/.docs/guides/concepts/multi-agent-systems.md +7 -7
  28. package/.docs/guides/guide/coding-agent.md +2 -2
  29. package/.docs/guides/guide/research-coordinator.md +1 -1
  30. package/.docs/guides/migrations/network-to-supervisor.md +1 -1
  31. package/.docs/models/environment-variables.md +1 -1
  32. package/.docs/models/gateways/neon.md +71 -0
  33. package/.docs/models/gateways/netlify.md +6 -6
  34. package/.docs/models/gateways/openrouter.md +6 -6
  35. package/.docs/models/gateways/vercel.md +6 -6
  36. package/.docs/models/gateways.md +1 -0
  37. package/.docs/models/index.md +96 -97
  38. package/.docs/models/providers/alibaba-cn.md +23 -25
  39. package/.docs/models/providers/alibaba-token-plan-cn.md +24 -24
  40. package/.docs/models/providers/alibaba-token-plan.md +23 -25
  41. package/.docs/models/providers/alibaba.md +23 -25
  42. package/.docs/models/providers/ambient.md +23 -25
  43. package/.docs/models/providers/baseten.md +23 -25
  44. package/.docs/models/providers/chutes.md +23 -25
  45. package/.docs/models/providers/cortecs.md +23 -25
  46. package/.docs/models/providers/crof.md +23 -25
  47. package/.docs/models/providers/crossmodel.md +23 -25
  48. package/.docs/models/providers/deepinfra.md +22 -24
  49. package/.docs/models/providers/digitalocean.md +32 -34
  50. package/.docs/models/providers/empiriolabs.md +23 -25
  51. package/.docs/models/providers/fireworks-ai.md +24 -24
  52. package/.docs/models/providers/greenpt.md +23 -25
  53. package/.docs/models/providers/groq.md +23 -25
  54. package/.docs/models/providers/huggingface.md +23 -25
  55. package/.docs/models/providers/hyper.md +23 -25
  56. package/.docs/models/providers/impossibl.md +23 -25
  57. package/.docs/models/providers/infomaniak.md +24 -24
  58. package/.docs/models/providers/kilo.md +24 -26
  59. package/.docs/models/providers/llmgateway.md +24 -26
  60. package/.docs/models/providers/mistral.md +23 -25
  61. package/.docs/models/providers/modal.md +23 -25
  62. package/.docs/models/providers/modelis.md +23 -25
  63. package/.docs/models/providers/nano-gpt.md +23 -25
  64. package/.docs/models/providers/neuralwatt.md +23 -25
  65. package/.docs/models/providers/ofox.md +23 -25
  66. package/.docs/models/providers/ollama-cloud.md +23 -25
  67. package/.docs/models/providers/opencode-go.md +23 -25
  68. package/.docs/models/providers/opencode.md +25 -26
  69. package/.docs/models/providers/pioneer.md +23 -25
  70. package/.docs/models/providers/requesty.md +23 -25
  71. package/.docs/models/providers/routing-run.md +23 -25
  72. package/.docs/models/providers/scx.md +23 -25
  73. package/.docs/models/providers/tensorx.md +23 -25
  74. package/.docs/models/providers/togetherai.md +22 -24
  75. package/.docs/models/providers/umans-ai-coding-plan.md +24 -24
  76. package/.docs/models/providers/umans-ai.md +23 -25
  77. package/.docs/models/providers/wandb.md +23 -25
  78. package/.docs/models/providers/xai.md +26 -28
  79. package/.docs/models/providers/zai-coding-plan.md +23 -25
  80. package/.docs/models/providers/zhipuai-coding-plan.md +23 -25
  81. package/.docs/models/providers.md +0 -1
  82. package/.docs/reference/acp/acp-agent.md +1 -1
  83. package/.docs/reference/agent-controller/agent-controller-class.md +195 -506
  84. package/.docs/reference/agent-controller/session.md +274 -111
  85. package/.docs/reference/agents/network.md +1 -1
  86. package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
  87. package/.docs/reference/ai-sdk/network-route.md +1 -1
  88. package/.docs/reference/cli/create-mastra.md +1 -1
  89. package/.docs/reference/client-js/workflows.md +92 -0
  90. package/.docs/reference/core/addStoredWorkflow.md +62 -0
  91. package/.docs/reference/core/addStoredWorkflows.md +40 -0
  92. package/.docs/reference/editor/versioning.md +1 -1
  93. package/.docs/reference/evals/rubric.md +1 -1
  94. package/.docs/reference/file-based-agents/observability.md +2 -2
  95. package/.docs/reference/file-based-agents/storage.md +1 -1
  96. package/.docs/reference/file-based-agents/subagents.md +1 -1
  97. package/.docs/reference/file-based-agents/tools.md +1 -1
  98. package/.docs/reference/index.md +5 -0
  99. package/.docs/reference/observability/tracing/configuration.md +1 -1
  100. package/.docs/reference/observability/tracing/exporters/confident-ai.md +138 -0
  101. package/.docs/reference/observability/tracing/interfaces.md +29 -0
  102. package/.docs/reference/processors/processor-interface.md +121 -10
  103. package/.docs/reference/server/routes.md +13 -0
  104. package/.docs/reference/signals/signal-provider.md +2 -0
  105. package/.docs/reference/storage/overview.md +9 -8
  106. package/.docs/reference/streaming/workflows/observeStream.md +1 -1
  107. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  108. package/.docs/reference/streaming/workflows/stream.md +1 -1
  109. package/.docs/reference/tools/mcp-server.md +1 -1
  110. package/.docs/reference/tools/submit-plan-tool.md +1 -1
  111. package/.docs/reference/workflows/stored-workflow-definition.md +292 -0
  112. package/.docs/reference/workflows/workflow-methods/agent.md +62 -0
  113. package/.docs/reference/workflows/workflow-methods/tool.md +43 -0
  114. package/.docs/reference/workspace/railway-sandbox.md +5 -5
  115. package/CHANGELOG.md +14 -0
  116. package/package.json +4 -4
  117. package/.docs/docs/agent-controller/channels.md +0 -111
  118. package/.docs/docs/agent-controller/modes.md +0 -147
  119. package/.docs/docs/agent-controller/overview.md +0 -136
  120. package/.docs/docs/agent-controller/session.md +0 -161
  121. package/.docs/docs/agent-controller/subagents.md +0 -110
  122. package/.docs/docs/agent-controller/threads-and-state.md +0 -148
  123. package/.docs/docs/agent-controller/tool-approvals.md +0 -147
  124. package/.docs/docs/mcp/mcp-apps.md +0 -306
  125. package/.docs/docs/observability/config.md +0 -140
  126. package/.docs/docs/observability/storage.md +0 -81
  127. package/.docs/models/providers/neon.md +0 -109
@@ -1,306 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # MCP Apps
4
-
5
- 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.
6
-
7
- ## When to use MCP Apps
8
-
9
- Use MCP Apps when a tool result is better presented as an interactive UI rather than plain text. For example:
10
-
11
- - A calculator that renders input fields and buttons for computation
12
- - A color picker that displays swatches and hex values
13
- - A form builder that captures structured user input
14
- - A data visualizer that renders charts
15
-
16
- ## Quickstart
17
-
18
- Define app resources on your `MCPServer` by providing a `ui://` URI mapped to inline HTML or an HTML file path.
19
-
20
- ```typescript
21
- import { MCPServer } from '@mastra/mcp'
22
- import { createTool } from '@mastra/core/tools'
23
- import { z } from 'zod'
24
-
25
- const calculatorTool = createTool({
26
- id: 'calculatorWithUI',
27
- description: 'An interactive calculator',
28
- inputSchema: z.object({
29
- num1: z.number(),
30
- num2: z.number(),
31
- operation: z.enum(['add', 'subtract']),
32
- }),
33
- execute: async ({ num1, num2, operation }) => {
34
- const result = operation === 'add' ? num1 + num2 : num1 - num2
35
- return {
36
- content: [{ type: 'text', text: 'An interactive calculator is displayed.' }],
37
- structuredContent: { result },
38
- }
39
- },
40
- })
41
-
42
- const server = new MCPServer({
43
- id: 'my-app-server',
44
- name: 'My App Server',
45
- version: '1.0.0',
46
- tools: { calculatorTool },
47
- appResources: {
48
- 'ui://calculator/main': {
49
- name: 'Interactive Calculator',
50
- html: `<html>
51
- <body>
52
- <h2>Calculator</h2>
53
- <button id="btn">Compute</button>
54
- <script type="module">
55
- import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm';
56
- const app = new App({ name: 'Calculator', version: '1.0.0' });
57
- app.ontoolinput = (params) => {
58
- console.log('Tool input:', params.arguments);
59
- };
60
- document.getElementById('btn').addEventListener('click', async () => {
61
- const result = await app.callServerTool({
62
- name: 'calculatorWithUI',
63
- arguments: { num1: 10, num2: 5, operation: 'add' }
64
- });
65
- document.body.innerHTML += '<p>Result: ' + JSON.stringify(result) + '</p>';
66
- });
67
- await app.connect();
68
- </script>
69
- </body>
70
- </html>`,
71
- },
72
- },
73
- })
74
- ```
75
-
76
- Link the tool to its app resource by adding `_meta.ui.resourceUri` to the tool definition:
77
-
78
- ```typescript
79
- calculatorTool._meta = {
80
- ui: { resourceUri: 'ui://calculator/main' },
81
- }
82
- ```
83
-
84
- Visit [MCPServer reference](https://mastra.ai/reference/tools/mcp-server) for the full `appResources` configuration.
85
-
86
- ## Connecting MCP Apps to agents
87
-
88
- Agents consume tools, they don't 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.
89
-
90
- ```typescript
91
- import { Agent } from '@mastra/core/agent'
92
- import { calculatorTool } from '../mcp/tools'
93
-
94
- export const myAgent = new Agent({
95
- id: 'my-agent',
96
- name: 'My Agent',
97
- instructions: 'You have access to interactive UI tools.',
98
- model: 'openai/gpt-5-mini',
99
- tools: { calculatorTool },
100
- })
101
- ```
102
-
103
- Register the MCP server at the Mastra level. Studio scans registered MCP servers to map tools to their app resources.
104
-
105
- ```typescript
106
- import { Mastra } from '@mastra/core/mastra'
107
- import { myAgent } from './agents'
108
- import { myAppServer } from './mcp/server'
109
-
110
- export const mastra = new Mastra({
111
- agents: { myAgent },
112
- mcpServers: { myAppServer },
113
- })
114
- ```
115
-
116
- For remote MCP servers, use `MCPClient.listTools()` to get tools and `toMCPServerProxies()` to register the server:
117
-
118
- ```typescript
119
- import { MCPClient } from '@mastra/mcp'
120
-
121
- const mcpClient = new MCPClient({
122
- servers: {
123
- remoteApp: { url: new URL('https://remote-mcp-server.example.com/mcp') },
124
- },
125
- })
126
-
127
- const myAgent = new Agent({
128
- id: 'my-agent',
129
- name: 'My Agent',
130
- model: 'openai/gpt-5-mini',
131
- tools: await mcpClient.listTools(),
132
- })
133
-
134
- export const mastra = new Mastra({
135
- agents: { myAgent },
136
- mcpServers: { ...mcpClient.toMCPServerProxies() },
137
- })
138
- ```
139
-
140
- 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.
141
-
142
- ## How MCP Apps work
143
-
144
- MCP Apps follow a specific communication pattern between the host (Mastra Studio) and the iframe:
145
-
146
- 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).
147
- 2. The host renders the app HTML in a sandboxed iframe.
148
- 3. The iframe communicates with the host via a JSON-RPC postMessage protocol.
149
- 4. The app can call server tools using `callServerTool()` and inject messages into the chat using `sendMessage()`.
150
-
151
- ```text
152
- Agent calls tool → Tool returns brief content + structuredContent
153
- → Host renders iframe with app HTML
154
- → User interacts with UI
155
- → UI calls callServerTool() for computation
156
- → UI calls sendMessage() to inject result into chat
157
- ```
158
-
159
- ## Tool result format
160
-
161
- Tools with app resources should return two fields:
162
-
163
- - `content`: A brief text summary for the model. Keep this short so the agent doesn't parrot the full result.
164
- - `structuredContent`: The data payload that hydrates the UI. The model doesn't see this field.
165
-
166
- ```typescript
167
- execute: async ({ num1, num2, operation }) => {
168
- const result = operation === 'add' ? num1 + num2 : num1 - num2
169
- return {
170
- content: [{ type: 'text', text: 'An interactive calculator is displayed.' }],
171
- structuredContent: { result },
172
- }
173
- }
174
- ```
175
-
176
- ## App API (guest-side)
177
-
178
- 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.
179
-
180
- ```javascript
181
- import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm'
182
- const app = new App({ name: 'MyApp', version: '1.0.0' })
183
- ```
184
-
185
- ### `app.callServerTool(params)`
186
-
187
- Calls an MCP server tool from within the iframe. This is useful for interactive computation without leaving the UI.
188
-
189
- ```javascript
190
- const result = await app.callServerTool({
191
- name: 'calculatorWithUI',
192
- arguments: { num1: 42, num2: 8, operation: 'add' },
193
- })
194
- ```
195
-
196
- ### `app.sendMessage(params)`
197
-
198
- Injects a user message into the agent chat, triggering a new model turn. Use this for sharing results or requesting follow-up actions.
199
-
200
- ```javascript
201
- await app.sendMessage({
202
- role: 'user',
203
- content: [{ type: 'text', text: 'The result of 42 + 8 is 50' }],
204
- })
205
- ```
206
-
207
- ### `app.ontoolinput`
208
-
209
- 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.
210
-
211
- ```javascript
212
- app.ontoolinput = params => {
213
- document.getElementById('num1').value = params.arguments.num1
214
- }
215
- ```
216
-
217
- > **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:
218
- >
219
- > ```html
220
- > <style>
221
- > body {
222
- > opacity: 0;
223
- > transition: opacity 0.15s;
224
- > }
225
- > body.ready {
226
- > opacity: 1;
227
- > }
228
- > </style>
229
- > <script type="module">
230
- > import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm'
231
- > const app = new App({ name: 'MyApp', version: '1.0.0' })
232
- >
233
- > app.ontoolinput = params => {
234
- > // Hydrate form fields from params.arguments
235
- > document.body.classList.add('ready')
236
- > }
237
- >
238
- > await app.connect()
239
- > // Fallback: reveal after connection if no tool input arrives
240
- > setTimeout(() => document.body.classList.add('ready'), 150)
241
- > </script>
242
- > ```
243
-
244
- ### `app.connect()`
245
-
246
- Establishes the connection to the host. Call this after registering all event handlers.
247
-
248
- ```javascript
249
- await app.connect()
250
- ```
251
-
252
- 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.
253
-
254
- ## Using external MCP servers with apps
255
-
256
- 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.
257
-
258
- ```typescript
259
- import { Mastra } from '@mastra/core/mastra'
260
- import { MCPClient } from '@mastra/mcp'
261
- import { Agent } from '@mastra/core/agent'
262
-
263
- const mcpClient = new MCPClient({
264
- servers: {
265
- 'external-server': {
266
- command: 'node',
267
- args: ['path/to/external-server.js'],
268
- },
269
- },
270
- })
271
-
272
- const myAgent = new Agent({
273
- id: 'my-agent',
274
- name: 'My Agent',
275
- model: 'openai/gpt-5-mini',
276
- tools: await mcpClient.listTools(),
277
- })
278
-
279
- export const mastra = new Mastra({
280
- agents: { myAgent },
281
- mcpServers: {
282
- ...mcpClient.toMCPServerProxies(),
283
- },
284
- })
285
- ```
286
-
287
- Visit [MCPClient reference](https://mastra.ai/reference/tools/mcp-client) for more details on proxying external servers.
288
-
289
- ## Sandbox security
290
-
291
- 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.
292
-
293
- App iframes are sandboxed with the following permissions:
294
-
295
- - `allow-scripts`: Enables JavaScript execution
296
- - `allow-forms`: Allows form submission
297
- - `allow-popups`: Permits `window.open()` and link targets
298
-
299
- The iframe doesn't 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.
300
-
301
- ## Related
302
-
303
- - [MCP overview](https://mastra.ai/docs/mcp/overview)
304
- - [MCPServer reference](https://mastra.ai/reference/tools/mcp-server)
305
- - [MCPClient reference](https://mastra.ai/reference/tools/mcp-client)
306
- - [MCP Apps extension spec](https://github.com/modelcontextprotocol/ext-apps)
@@ -1,140 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Configuration
4
-
5
- Observability is configured once on your Mastra instance and applies across traces, logs, and metrics.
6
-
7
- ## When to use configuration
8
-
9
- - Set up a default observability pipeline for local development.
10
- - Route different environments or request types to different observability configs.
11
- - Keep Mastra Studio and Mastra platform access enabled while also sending data to external providers.
12
-
13
- ## Quickstart
14
-
15
- The following example demonstrates the standard starter setup: composite storage with DuckDB for the observability domain, plus Mastra storage, Mastra platform, and sensitive-data redaction.
16
-
17
- ```ts
18
- import { Mastra } from '@mastra/core/mastra'
19
- import { MastraCompositeStore } from '@mastra/core/storage'
20
- import { DuckDBStore } from '@mastra/duckdb'
21
- import { LibSQLStore } from '@mastra/libsql'
22
- import {
23
- Observability,
24
- MastraStorageExporter,
25
- MastraPlatformExporter,
26
- SensitiveDataFilter,
27
- } from '@mastra/observability'
28
-
29
- export const mastra = new Mastra({
30
- storage: new MastraCompositeStore({
31
- id: 'composite-storage',
32
- default: new LibSQLStore({
33
- id: 'mastra-storage',
34
- url: 'file:./mastra.db',
35
- }),
36
- domains: {
37
- observability: await new DuckDBStore().getStore('observability'),
38
- },
39
- }),
40
- observability: new Observability({
41
- configs: {
42
- default: {
43
- serviceName: 'mastra',
44
- exporters: [new MastraStorageExporter(), new MastraPlatformExporter()],
45
- spanOutputProcessors: [new SensitiveDataFilter()],
46
- logging: {
47
- enabled: true,
48
- level: 'info',
49
- },
50
- },
51
- },
52
- }),
53
- })
54
- ```
55
-
56
- ## Basic config
57
-
58
- An observability config usually contains:
59
-
60
- - `serviceName`: The service identifier attached to exported observability data.
61
- - `exporters`: One or more destinations for traces, logs, and derived metrics.
62
- - `spanOutputProcessors`: Transformations that run before spans are exported.
63
- - `logging`: Log forwarding settings for observability storage.
64
-
65
- For destinations and processors, see [Integrations overview](https://mastra.ai/docs/observability/integrations/overview).
66
-
67
- ## Maintaining Studio access
68
-
69
- When you add external exporters, keep `MastraStorageExporter` for Studio observability and/or `MastraPlatformExporter` for hosted Mastra platform observability.
70
-
71
- This example shows only the observability config. Configure storage separately.
72
-
73
- ```ts
74
- import { Observability, MastraStorageExporter, MastraPlatformExporter } from '@mastra/observability'
75
- import { ArizeExporter } from '@mastra/arize'
76
-
77
- export const observability = new Observability({
78
- configs: {
79
- production: {
80
- serviceName: 'my-service',
81
- exporters: [
82
- new ArizeExporter({
83
- endpoint: process.env.PHOENIX_COLLECTOR_ENDPOINT,
84
- apiKey: process.env.PHOENIX_API_KEY,
85
- }),
86
- new MastraStorageExporter(),
87
- new MastraPlatformExporter(),
88
- ],
89
- },
90
- },
91
- })
92
- ```
93
-
94
- ## Flushing in serverless environments
95
-
96
- In serverless environments, flush observability exporters before the runtime pauses or exits:
97
-
98
- ```ts
99
- await mastra.observability.flush()
100
- ```
101
-
102
- Use external storage in serverless environments instead of local file storage. For storage selection and routing, see [Storage](https://mastra.ai/docs/observability/storage).
103
-
104
- ## Multi-config setup
105
-
106
- Use multiple configs when different environments or request types need different exporters or sampling behavior. Select the active config at runtime with `configSelector`.
107
-
108
- ```ts
109
- import { Mastra } from '@mastra/core'
110
- import { Observability, MastraStorageExporter } from '@mastra/observability'
111
- import { LangfuseExporter } from '@mastra/langfuse'
112
-
113
- const storageExporter = new MastraStorageExporter()
114
- const langfuseExporter = new LangfuseExporter()
115
-
116
- export const mastra = new Mastra({
117
- observability: new Observability({
118
- configs: {
119
- development: {
120
- serviceName: 'my-service-dev',
121
- exporters: [storageExporter],
122
- },
123
- production: {
124
- serviceName: 'my-service-prod',
125
- exporters: [storageExporter, langfuseExporter],
126
- },
127
- },
128
- configSelector: () => process.env.NODE_ENV || 'development',
129
- }),
130
- })
131
- ```
132
-
133
- For trace sampling, see [Tracing](https://mastra.ai/docs/observability/tracing/overview).
134
-
135
- ## Related
136
-
137
- - [Observability overview](https://mastra.ai/docs/observability/overview)
138
- - [Storage](https://mastra.ai/docs/observability/storage)
139
- - [Tracing](https://mastra.ai/docs/observability/tracing/overview)
140
- - [Integrations overview](https://mastra.ai/docs/observability/integrations/overview)
@@ -1,81 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Storage
4
-
5
- Storage determines which observability signals persist, which queries are available, and whether metrics aggregation works. Use a dedicated observability store instead of your primary application store.
6
-
7
- ## When to use storage
8
-
9
- - Keep traces, logs, and metrics available in Mastra Studio during development.
10
- - Enable metrics with an OLAP-capable observability store.
11
- - Route the observability domain to a dedicated production backend.
12
-
13
- ## Quickstart
14
-
15
- The following example demonstrates the recommended local testing setup: route observability data to DuckDB while keeping the rest of your application on LibSQL.
16
-
17
- ```ts
18
- import { Mastra } from '@mastra/core/mastra'
19
- import { LibSQLStore } from '@mastra/libsql'
20
- import { DuckDBStore } from '@mastra/duckdb'
21
- import { MastraCompositeStore } from '@mastra/core/storage'
22
- import { Observability, MastraStorageExporter } from '@mastra/observability'
23
-
24
- export const mastra = new Mastra({
25
- storage: new MastraCompositeStore({
26
- id: 'composite-storage',
27
- default: new LibSQLStore({
28
- id: 'mastra-storage',
29
- url: 'file:./mastra.db',
30
- }),
31
- domains: {
32
- observability: await new DuckDBStore().getStore('observability'),
33
- },
34
- }),
35
- observability: new Observability({
36
- configs: {
37
- default: {
38
- serviceName: 'mastra',
39
- exporters: [new MastraStorageExporter()],
40
- },
41
- },
42
- }),
43
- })
44
- ```
45
-
46
- ## Signal support
47
-
48
- Mastra storage-backed observability currently depends on an OLAP-capable backend for full signal support:
49
-
50
- - DuckDB: Recommended for local testing and development.
51
- - ClickHouse: Recommended for production observability.
52
- - Mastra platform: Use `MastraPlatformExporter` if you want hosted observability without managing the backend yourself.
53
-
54
- Primary application stores such as LibSQL or PostgreSQL shouldn't be used as the observability store. Route the `observability` domain separately with composite storage when you use `MastraStorageExporter`.
55
-
56
- ## Local development
57
-
58
- For local development, the recommended setup is:
59
-
60
- - `LibSQLStore` for primary application storage
61
- - `DuckDBStore` for the `observability` domain
62
- - `MastraStorageExporter` for local Studio access
63
-
64
- This setup is for local testing and development. It gives you persisted traces, logs, and metrics without introducing external infrastructure.
65
-
66
- ## Production deployment
67
-
68
- Observability traffic is usually more write-heavy than the rest of the application. In production:
69
-
70
- - Use `MastraStorageExporter` with ClickHouse for the `observability` domain when you keep observability in your own storage.
71
- - Use `MastraPlatformExporter` if you want hosted Mastra platform observability instead of managing the backend yourself.
72
- - Don't route observability to your primary application store.
73
-
74
- For backend compatibility details and exporter batching behavior, see [Mastra Storage exporter](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage).
75
-
76
- ## Next steps
77
-
78
- - [Configuration](https://mastra.ai/docs/observability/config)
79
- - [Logging](https://mastra.ai/docs/observability/logging)
80
- - [Metrics overview](https://mastra.ai/docs/observability/metrics/overview)
81
- - [Mastra Storage exporter](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage)
@@ -1,109 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # ![Neon logo](https://models.dev/logos/neon.svg)Neon
4
-
5
- Access 36 Neon models through Mastra's model router. Authentication is handled automatically using the `NEON_AI_GATEWAY_TOKEN` environment variable. Configure `NEON_AI_GATEWAY_BASE_URL` as well.
6
-
7
- Learn more in the [Neon documentation](https://neon.com/docs).
8
-
9
- ```bash
10
- NEON_AI_GATEWAY_BASE_URL=your-value
11
- NEON_AI_GATEWAY_TOKEN=your-api-token
12
- ```
13
-
14
- ```typescript
15
- import { Agent } from "@mastra/core/agent";
16
-
17
- const agent = new Agent({
18
- id: "my-agent",
19
- name: "My Agent",
20
- instructions: "You are a helpful assistant",
21
- model: "neon/claude-haiku-4-5"
22
- });
23
-
24
- // Generate a response
25
- const response = await agent.generate("Hello!");
26
-
27
- // Stream a response
28
- const stream = await agent.stream("Tell me a story");
29
- for await (const chunk of stream) {
30
- console.log(chunk);
31
- }
32
- ```
33
-
34
- > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Neon documentation](https://neon.com/docs) for details.
35
-
36
- ## Models
37
-
38
- | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
39
- | ---------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
40
- | `neon/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
41
- | `neon/claude-opus-4-1` | 200K | | | | | | $15 | $75 |
42
- | `neon/claude-opus-4-5` | 200K | | | | | | $5 | $25 |
43
- | `neon/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
44
- | `neon/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
45
- | `neon/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
46
- | `neon/claude-sonnet-4` | 200K | | | | | | $3 | $15 |
47
- | `neon/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
48
- | `neon/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
49
- | `neon/gemini-2-5-flash` | 1.0M | | | | | | $0.30 | $3 |
50
- | `neon/gemini-2-5-pro` | 1.0M | | | | | | $1 | $10 |
51
- | `neon/gemini-3-1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
52
- | `neon/gemini-3-1-pro` | 1.0M | | | | | | $2 | $12 |
53
- | `neon/gemini-3-5-flash` | 1.0M | | | | | | $2 | $9 |
54
- | `neon/gemini-3-flash` | 1.0M | | | | | | $0.50 | $3 |
55
- | `neon/gemini-3-pro` | 1.0M | | | | | | $2 | $12 |
56
- | `neon/gemma-3-12b` | 131K | | | | | | $0.15 | $0.50 |
57
- | `neon/gpt-5` | 400K | | | | | | $1 | $10 |
58
- | `neon/gpt-5-1` | 400K | | | | | | $1 | $10 |
59
- | `neon/gpt-5-1-codex-max` | 400K | | | | | | $1 | $10 |
60
- | `neon/gpt-5-1-codex-mini` | 400K | | | | | | $0.25 | $2 |
61
- | `neon/gpt-5-2` | 400K | | | | | | $2 | $14 |
62
- | `neon/gpt-5-2-codex` | 400K | | | | | | $2 | $14 |
63
- | `neon/gpt-5-3-codex` | 400K | | | | | | $2 | $14 |
64
- | `neon/gpt-5-4` | 1.1M | | | | | | $3 | $15 |
65
- | `neon/gpt-5-4-mini` | 400K | | | | | | $0.75 | $5 |
66
- | `neon/gpt-5-4-nano` | 400K | | | | | | $0.20 | $1 |
67
- | `neon/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
68
- | `neon/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
69
- | `neon/gpt-oss-120b` | 131K | | | | | | $0.07 | $0.28 |
70
- | `neon/gpt-oss-20b` | 131K | | | | | | $0.05 | $0.20 |
71
- | `neon/llama-4-maverick` | 1.0M | | | | | | $0.50 | $2 |
72
- | `neon/meta-llama-3-1-8b-instruct` | 131K | | | | | | $0.15 | $0.45 |
73
- | `neon/meta-llama-3-3-70b-instruct` | 128K | | | | | | $0.50 | $2 |
74
- | `neon/qwen3-next-80b-a3b-instruct` | 131K | | | | | | $0.15 | $1 |
75
- | `neon/qwen35-122b-a10b` | 262K | | | | | | $0.22 | $2 |
76
-
77
- ## Advanced configuration
78
-
79
- ### Custom headers
80
-
81
- ```typescript
82
- const agent = new Agent({
83
- id: "custom-agent",
84
- name: "custom-agent",
85
- model: {
86
- url: "${NEON_AI_GATEWAY_BASE_URL}/v1",
87
- id: "neon/claude-haiku-4-5",
88
- apiKey: process.env.NEON_AI_GATEWAY_TOKEN,
89
- headers: {
90
- "X-Custom-Header": "value"
91
- }
92
- }
93
- });
94
- ```
95
-
96
- ### Dynamic model selection
97
-
98
- ```typescript
99
- const agent = new Agent({
100
- id: "dynamic-agent",
101
- name: "Dynamic Agent",
102
- model: ({ requestContext }) => {
103
- const useAdvanced = requestContext.task === "complex";
104
- return useAdvanced
105
- ? "neon/qwen35-122b-a10b"
106
- : "neon/claude-haiku-4-5";
107
- }
108
- });
109
- ```