@mastra/mcp-docs-server 0.0.0-studio-deploy-20260403185613 → 0.0.0-studio-deploy-20260403235642

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 (32) hide show
  1. package/.docs/docs/agents/channels.md +170 -0
  2. package/.docs/docs/agents/overview.md +1 -0
  3. package/.docs/docs/observability/overview.md +53 -27
  4. package/.docs/docs/server/mastra-client.md +12 -10
  5. package/.docs/docs/server/mastra-server.md +13 -1
  6. package/.docs/docs/studio/observability.md +9 -1
  7. package/.docs/docs/studio/overview.md +1 -1
  8. package/.docs/guides/guide/firecrawl.md +152 -0
  9. package/.docs/models/gateways/openrouter.md +4 -2
  10. package/.docs/models/index.md +1 -1
  11. package/.docs/models/providers/anthropic.md +1 -2
  12. package/.docs/models/providers/cortecs.md +2 -1
  13. package/.docs/models/providers/openai.md +8 -4
  14. package/.docs/models/providers/opencode-go.md +3 -1
  15. package/.docs/models/providers/opencode.md +2 -4
  16. package/.docs/models/providers/poe.md +3 -1
  17. package/.docs/models/providers/the-grid-ai.md +73 -0
  18. package/.docs/models/providers/zai-coding-plan.md +3 -2
  19. package/.docs/models/providers/zai.md +3 -2
  20. package/.docs/models/providers/zhipuai-coding-plan.md +3 -2
  21. package/.docs/models/providers/zhipuai.md +3 -2
  22. package/.docs/models/providers.md +1 -0
  23. package/.docs/reference/agents/channels.md +164 -0
  24. package/.docs/reference/agents/getLLM.md +9 -3
  25. package/.docs/reference/client-js/conversations.md +135 -0
  26. package/.docs/reference/client-js/mastra-client.md +4 -0
  27. package/.docs/reference/client-js/responses.md +213 -0
  28. package/.docs/reference/index.md +3 -0
  29. package/.docs/reference/processors/token-limiter-processor.md +2 -0
  30. package/.docs/reference/server/routes.md +22 -1
  31. package/CHANGELOG.md +67 -4
  32. package/package.json +6 -6
@@ -0,0 +1,170 @@
1
+ # Channels
2
+
3
+ **Added in:** `@mastra/core@1.22.0`
4
+
5
+ Channels connect your agents to messaging platforms like Slack, Discord, and Telegram. When a user sends a message on a platform, the agent receives it, processes it through the normal agent pipeline, and streams the response back to the conversation.
6
+
7
+ ## When to use channels
8
+
9
+ Use channels when you want your agent to:
10
+
11
+ - Respond to messages in Slack workspaces, Discord servers, or Telegram chats
12
+ - Handle both direct messages and mentions in group conversations
13
+
14
+ ## Quickstart
15
+
16
+ Configure channels directly on your agent using adapters from the [Chat SDK](https://chat-sdk.dev/adapters):
17
+
18
+ ```typescript
19
+ import { Agent } from '@mastra/core/agent'
20
+ import { createSlackAdapter } from '@chat-adapter/slack'
21
+
22
+ export const supportAgent = new Agent({
23
+ id: 'support-agent',
24
+ name: 'Support Agent',
25
+ instructions: 'You are a helpful support assistant.',
26
+ model: 'openai/gpt-5.4',
27
+ channels: {
28
+ adapters: {
29
+ slack: createSlackAdapter(),
30
+ },
31
+ },
32
+ })
33
+ ```
34
+
35
+ Register the agent in your Mastra instance with storage so channel state persists across restarts:
36
+
37
+ ```typescript
38
+ import { Mastra } from '@mastra/core'
39
+ import { LibSQLStore } from '@mastra/libsql'
40
+ import { supportAgent } from './agents/support-agent'
41
+
42
+ export const mastra = new Mastra({
43
+ agents: { supportAgent },
44
+ storage: new LibSQLStore({
45
+ url: process.env.DATABASE_URL,
46
+ }),
47
+ })
48
+ ```
49
+
50
+ Each adapter reads credentials from environment variables by default.
51
+
52
+ ## Platform setup
53
+
54
+ Each platform requires credentials and event configuration. See the Chat SDK adapter docs for full setup: [Slack](https://chat-sdk.dev/adapters/slack), [Discord](https://chat-sdk.dev/adapters/discord), [Telegram](https://chat-sdk.dev/adapters/telegram).
55
+
56
+ Mastra generates a webhook route for each platform at:
57
+
58
+ ```text
59
+ /api/agents/{agentId}/channels/{platform}/webhook
60
+ ```
61
+
62
+ For example: `/api/agents/support-agent/channels/slack/webhook`
63
+
64
+ Point your platform's webhook or interactions URL to this path.
65
+
66
+ ### Local development
67
+
68
+ Platform webhooks need a public URL to reach your local server. Use a tunnel to expose `localhost:4111`:
69
+
70
+ ```bash
71
+ # ngrok
72
+ ngrok http 4111
73
+
74
+ # cloudflared
75
+ cloudflared tunnel --url http://localhost:4111
76
+ ```
77
+
78
+ Copy the generated URL and use it as the base for your webhook paths (e.g. `https://abc123.ngrok.io/api/agents/support-agent/channels/slack/webhook`).
79
+
80
+ ## Thread context
81
+
82
+ When a user mentions the agent mid-conversation in a channel thread, the agent may not have prior context. By default, Mastra fetches the last 10 messages from the platform on the first mention.
83
+
84
+ 1. On the **first mention** in a thread, the agent fetches recent messages from the platform.
85
+ 2. These messages are prepended to the user's message as conversation context.
86
+ 3. After responding, the agent subscribes to the thread and has full history via Mastra's memory.
87
+ 4. Subsequent messages in that thread do **not** re-fetch from the platform.
88
+
89
+ Set `threadContext: { maxMessages: 0 }` to disable this behavior. This only applies to non-DM threads.
90
+
91
+ ## Tool approval
92
+
93
+ Tools with `requireApproval: true` render as interactive cards with Approve and Deny buttons:
94
+
95
+ ```typescript
96
+ import { createTool } from '@mastra/core/tools'
97
+ import { z } from 'zod'
98
+
99
+ const deleteFile = createTool({
100
+ id: 'delete-file',
101
+ description: 'Delete a file from the system',
102
+ inputSchema: z.object({
103
+ path: z.string().describe('Path to the file to delete'),
104
+ }),
105
+ requireApproval: true,
106
+ execute: async ({ path }) => {
107
+ await fs.unlink(path)
108
+ return { deleted: path }
109
+ },
110
+ })
111
+ ```
112
+
113
+ When the agent calls this tool, users see a card with the tool name, arguments, and Approve/Deny buttons. The tool only executes after approval.
114
+
115
+ Set `cards: false` on an adapter to render tool calls as plain text instead of interactive cards. When cards are disabled and a tool requires approval, the agent uses `autoResumeSuspendedTools` to let the LLM decide based on the conversation context.
116
+
117
+ ## Multi-user awareness
118
+
119
+ In group conversations, Mastra automatically prefixes each message with the sender's name and platform ID so the agent can distinguish between speakers:
120
+
121
+ ```text
122
+ [Alice (@U123ABC)]: Can you help me with this?
123
+ [Bob (@U456DEF)]: I have a question too.
124
+ ```
125
+
126
+ ## Multimodal content
127
+
128
+ Models like Gemini can natively process images, video, and audio. Combine `inlineMedia` and `inlineLinks` to let users share rich content with your agent across platforms:
129
+
130
+ ```typescript
131
+ import { Agent } from '@mastra/core/agent'
132
+ import { createDiscordAdapter } from '@chat-adapter/discord'
133
+ import { google } from '@ai-sdk/google'
134
+
135
+ export const visionAgent = new Agent({
136
+ name: 'Vision Agent',
137
+ instructions: 'You can see images, watch videos, and listen to audio.',
138
+ model: google('gemini-3.1-flash-image-preview'),
139
+ channels: {
140
+ adapters: {
141
+ discord: createDiscordAdapter(),
142
+ },
143
+ inlineMedia: ['image/*', 'video/*', 'audio/*'],
144
+ inlineLinks: [
145
+ // Gemini treats YouTube URLs as native video file parts
146
+ { match: 'youtube.com', mimeType: 'video/*' },
147
+ { match: 'youtu.be', mimeType: 'video/*' },
148
+ 'imgur.com', // HEAD-check imgur links; inline as file part if mimeType matches inlineMedia
149
+ ],
150
+ },
151
+ })
152
+ ```
153
+
154
+ With this configuration:
155
+
156
+ - A user uploads a screenshot and the agent describes what it sees
157
+ - A user uploads an `.mp4` clip and the agent summarizes the video
158
+ - A user pastes a YouTube link and the agent watches and discusses the video
159
+ - A user pastes an imgur link and the agent sees the image directly
160
+
161
+ By default, only images are sent inline (`inlineMedia: ['image/*']`). Unsupported types are described as text summaries so the agent knows about the file without crashing models that reject them.
162
+
163
+ > **Note:** See [Channels reference](https://mastra.ai/reference/agents/channels) for all `inlineMedia` patterns and [inlineLinks reference](https://mastra.ai/reference/agents/channels) for domain matching, HEAD detection, and forced mime types.
164
+
165
+ ## Related
166
+
167
+ - [Agent overview](https://mastra.ai/docs/agents/overview)
168
+ - [Tool approval](https://mastra.ai/docs/agents/agent-approval)
169
+ - [Channels reference](https://mastra.ai/reference/agents/channels)
170
+ - [Chat SDK adapters](https://chat-sdk.dev/adapters)
@@ -87,6 +87,7 @@ Once your agent is running, use this table to find the right page for what you w
87
87
  | Keep your agent safe | [Guardrails](https://mastra.ai/docs/agents/guardrails) |
88
88
  | Swap instructions or models based on request context | [Dynamic configuration](https://mastra.ai/docs/server/request-context) |
89
89
  | Add speech-to-text or text-to-speech | [Voice](https://mastra.ai/docs/agents/adding-voice) |
90
+ | Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/agents/channels) |
90
91
 
91
92
  ## Multi-agent systems
92
93
 
@@ -1,35 +1,61 @@
1
1
  # Observability overview
2
2
 
3
- Mastra provides observability features for AI applications. Monitor LLM operations, trace agent decisions, and debug complex workflows with tools that understand AI-specific patterns.
3
+ Mastra's observability system gives you visibility into every agent run, workflow step, tool call, and model interaction. It captures three complementary signals that work together to help you understand what your application is doing and why.
4
4
 
5
- ## Key features
5
+ - [**Tracing**](https://mastra.ai/docs/observability/tracing/overview): Records every operation as a hierarchical timeline of spans, capturing inputs, outputs, token usage, and timing.
6
+ - [**Logging**](https://mastra.ai/docs/observability/logging): Forwards structured log entries from your application and Mastra internals to observability storage, correlated to traces automatically.
7
+ - [**Metrics**](https://mastra.ai/docs/observability/metrics/overview): Extracts duration, token usage, and cost data from traces automatically, with no additional instrumentation required.
6
8
 
7
- ### Tracing
9
+ ## When to use observability
8
10
 
9
- Specialized tracing for AI operations that captures:
11
+ - Debug unexpected agent behavior by inspecting the full decision path, tool calls, and model responses.
12
+ - Monitor latency across agents, workflows, and tools to identify bottlenecks.
13
+ - Track token consumption and estimated cost over time to control spending.
14
+ - Diagnose workflow failures by tracing execution through each step.
15
+ - Compare agent performance before and after prompt or model changes.
10
16
 
11
- - **Model interactions**: Token usage, latency, prompts, and completions
12
- - **Agent execution**: Decision paths, tool calls, and memory operations
13
- - **Workflow steps**: Branching logic, parallel execution, and step outputs
14
- - **Automatic instrumentation**: Tracing with decorators
17
+ ## How the pieces fit together
15
18
 
16
- ### Logging
19
+ Tracing is the foundation. When observability is configured, every agent run, workflow execution, tool call, and model interaction produces a [span](https://opentelemetry.io/docs/concepts/signals/traces/#spans). Spans are organized into traces that show the full request lifecycle as a hierarchical timeline.
17
20
 
18
- All logger calls from your application and Mastra's internal components are automatically forwarded to observability storage when observability is configured. You can [control the log level and disable forwarding](https://mastra.ai/docs/observability/logging) independently from your console logger.
21
+ Metrics are derived from traces automatically. When a span ends, Mastra extracts duration, token counts, and cost estimates without any extra code. These metrics power the dashboards in [Studio](https://mastra.ai/docs/studio/observability).
19
22
 
20
- ## Storage requirements
23
+ Logs are correlated to traces automatically. Every `logger.info()`, `logger.warn()`, or `logger.error()` call within a traced context is tagged with the current trace and span IDs. You can navigate from a log entry directly to the trace that produced it.
21
24
 
22
- The `DefaultExporter` persists traces to your configured storage backend. Not all storage providers support observability—for the full list, see [Storage Provider Support](https://mastra.ai/docs/observability/tracing/exporters/default).
25
+ All three signals share correlation IDs (trace ID, span ID, entity type, entity name), so you can jump between a metric spike, the traces behind it, and the logs within those traces.
23
26
 
24
- For production environments with high traffic, we recommend using **ClickHouse** for the observability domain via [composite storage](https://mastra.ai/reference/storage/composite). See [Production Recommendations](https://mastra.ai/docs/observability/tracing/exporters/default) for details.
27
+ ## Get started
25
28
 
26
- ## Quickstart
29
+ Install `@mastra/observability` and a storage backend:
27
30
 
28
- Configure Observability in your Mastra instance:
31
+ **npm**:
32
+
33
+ ```bash
34
+ npm install @mastra/observability @mastra/libsql @mastra/duckdb
35
+ ```
36
+
37
+ **pnpm**:
38
+
39
+ ```bash
40
+ pnpm add @mastra/observability @mastra/libsql @mastra/duckdb
41
+ ```
42
+
43
+ **Yarn**:
44
+
45
+ ```bash
46
+ yarn add @mastra/observability @mastra/libsql @mastra/duckdb
47
+ ```
48
+
49
+ **Bun**:
50
+
51
+ ```bash
52
+ bun add @mastra/observability @mastra/libsql @mastra/duckdb
53
+ ```
54
+
55
+ Then configure observability in your Mastra instance. The following example uses composite storage to route observability data to DuckDB (which supports metrics aggregation) while keeping everything else in LibSQL:
29
56
 
30
57
  ```ts
31
58
  import { Mastra } from '@mastra/core/mastra'
32
- import { PinoLogger } from '@mastra/loggers'
33
59
  import { LibSQLStore } from '@mastra/libsql'
34
60
  import { DuckDBStore } from '@mastra/duckdb'
35
61
  import { MastraCompositeStore } from '@mastra/core/storage'
@@ -41,7 +67,6 @@ import {
41
67
  } from '@mastra/observability'
42
68
 
43
69
  export const mastra = new Mastra({
44
- logger: new PinoLogger(),
45
70
  storage: new MastraCompositeStore({
46
71
  id: 'composite-storage',
47
72
  default: new LibSQLStore({
@@ -60,9 +85,6 @@ export const mastra = new Mastra({
60
85
  new DefaultExporter(), // Persists traces to storage for Mastra Studio
61
86
  new CloudExporter(), // Sends traces to Mastra Cloud (if MASTRA_CLOUD_ACCESS_TOKEN is set)
62
87
  ],
63
- logging: {
64
- level: 'info', // Minimum log level forwarded to storage (default: 'debug')
65
- },
66
88
  spanOutputProcessors: [
67
89
  new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
68
90
  ],
@@ -72,14 +94,18 @@ export const mastra = new Mastra({
72
94
  })
73
95
  ```
74
96
 
75
- > **Serverless environments:** The `file:./mastra.db` storage URL uses the local filesystem, which doesn't work in serverless environments like Vercel, AWS Lambda, or Cloudflare Workers. For serverless deployments, use external storage. See the [Vercel deployment guide](https://mastra.ai/guides/deployment/vercel) for a complete example.
97
+ This enables tracing, log forwarding, and metrics. Mastra also supports external tracing providers like Langfuse, Datadog, and any OpenTelemetry-compatible platform. See [Tracing](https://mastra.ai/docs/observability/tracing/overview) for configuration details.
98
+
99
+ ## Storage
76
100
 
77
- With this basic setup, you will see Traces and Logs in both Studio and in Mastra Cloud.
101
+ Not all storage backends support every signal. Traces and logs work with most backends, but metrics require an OLAP-capable store like DuckDB (development) or ClickHouse (production). For the full compatibility list, see [storage provider support](https://mastra.ai/docs/observability/tracing/exporters/default).
78
102
 
79
- We also support various external tracing providers like MLflow, Langfuse, Braintrust, and any OpenTelemetry-compatible platform (Datadog, New Relic, SigNoz, etc.). See more about this in the [Tracing](https://mastra.ai/docs/observability/tracing/overview) documentation.
103
+ For production environments with high traffic, use composite storage to route the observability domain to a dedicated backend. See [production recommendations](https://mastra.ai/docs/observability/tracing/exporters/default) for details.
80
104
 
81
- ## What's next?
105
+ ## Next steps
82
106
 
83
- - **[Set up Tracing](https://mastra.ai/docs/observability/tracing/overview)**: Configure tracing for your application
84
- - **[Configure Logging](https://mastra.ai/docs/observability/logging)**: Add structured logging
85
- - **[API Reference](https://mastra.ai/reference/observability/tracing/instances)**: Detailed configuration options
107
+ - [Tracing](https://mastra.ai/docs/observability/tracing/overview)
108
+ - [Logging](https://mastra.ai/docs/observability/logging)
109
+ - [Metrics](https://mastra.ai/docs/observability/metrics/overview)
110
+ - [Mastra Studio](https://mastra.ai/docs/studio/observability)
111
+ - [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics)
@@ -4,7 +4,7 @@ The Mastra Client SDK provides a concise and type-safe interface for interacting
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- To ensure smooth local development, make sure you have:
7
+ Before you start local development, have:
8
8
 
9
9
  - Node.js `v22.13.0` or later
10
10
  - TypeScript `v4.7` or higher (if using TypeScript)
@@ -54,15 +54,17 @@ export const mastraClient = new MastraClient({
54
54
 
55
55
  ## Core APIs
56
56
 
57
- The Mastra Client SDK exposes all resources served by the Mastra Server
57
+ The Mastra Client SDK exposes all resources served by the Mastra Server.
58
58
 
59
59
  - **[Agents](https://mastra.ai/reference/client-js/agents)**: Generate responses and stream conversations.
60
60
  - **[Memory](https://mastra.ai/reference/client-js/memory)**: Manage conversation threads and message history.
61
61
  - **[Tools](https://mastra.ai/reference/client-js/tools)**: Executed and managed tools.
62
62
  - **[Workflows](https://mastra.ai/reference/client-js/workflows)**: Trigger workflows and track their execution.
63
63
  - **[Vectors](https://mastra.ai/reference/client-js/vectors)**: Use vector embeddings for semantic search.
64
+ - **[Responses](https://mastra.ai/reference/client-js/responses)**: Call the OpenAI Responses API through Mastra agents. This API is currently experimental.
65
+ - **[Conversations](https://mastra.ai/reference/client-js/conversations)**: Work with OpenAI Responses API conversations and their stored item history. This API is currently experimental.
64
66
  - **[Logs](https://mastra.ai/reference/client-js/logs)**: View logs and debug system behavior.
65
- - **[Telemetry](https://mastra.ai/reference/client-js/telemetry)**: Monitor app performance and trace activity.
67
+ - **[Telemetry](https://mastra.ai/reference/client-js/telemetry)**: View app performance and trace activity.
66
68
 
67
69
  ## Generating responses
68
70
 
@@ -133,7 +135,7 @@ export const mastraClient = new MastraClient({
133
135
 
134
136
  ## Credentials and session cookies
135
137
 
136
- **Authenticate Mastra API calls with session cookies** when your UI and Mastra API are not on the same origin—different host, subdomain, or port (for example Mastra Studio on one port and a custom server on another). Add **`credentials: 'include'`** to `MastraClient` so each request carries the cookies the user already has after sign-in. Skip this and you will often get **`401`** responses from Mastra even though login succeeded in the browser.
138
+ **Authenticate Mastra API calls with session cookies** when your UI and Mastra API aren't on the same origin—different host, subdomain, or port (for example Mastra Studio on one port and a custom server on another). Add **`credentials: 'include'`** to `MastraClient` so each request carries the cookies the user already has after sign-in. Skip this and you will often get **`401`** responses from Mastra even though login succeeded in the browser.
137
139
 
138
140
  ```typescript
139
141
  import { MastraClient } from '@mastra/client-js'
@@ -146,7 +148,7 @@ export const mastraClient = new MastraClient({
146
148
 
147
149
  **Allow credentialed cross-origin requests on your server**—see [CORS: requests with credentials](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#requests_with_credentials). You need a concrete `Access-Control-Allow-Origin` (not `*`) and `Access-Control-Allow-Credentials: true`, or the browser will block the call before it reaches Mastra.
148
150
 
149
- **Using `@mastra/react`?** Wrap your app with `MastraReactProvider`, set `baseUrl` and `apiPrefix` to match your server, and rely on the default `credentials: 'include'`. Change `credentials` only when you deliberately want `same-origin` or `omit` behavior.
151
+ **Using `@mastra/react`?** Wrap your app with `MastraReactProvider`, set `baseUrl` and `apiPrefix` to match your server, and rely on the default `credentials: 'include'`. Change `credentials` only when you want `same-origin` or `omit` behavior.
150
152
 
151
153
  ## Adding request cancelling
152
154
 
@@ -219,7 +221,7 @@ const handleClientTool = async () => {
219
221
  }
220
222
  ```
221
223
 
222
- ### Client tool's agent
224
+ ### Client tool agent
223
225
 
224
226
  This is a standard Mastra [agent](https://mastra.ai/docs/agents/overview) configured to return hex color codes, intended to work with the browser-based client tool defined above.
225
227
 
@@ -236,9 +238,9 @@ export const colorAgent = new Agent({
236
238
  })
237
239
  ```
238
240
 
239
- ## Server-side environments
241
+ ## Use MastraClient on the server
240
242
 
241
- You can also use `MastraClient` in server-side environments such as API routes, serverless functions or actions. The usage will broadly remain the same but you may need to recreate the response to your client:
243
+ You can also use `MastraClient` in server-side environments such as API routes, serverless functions, or actions. The usage remains the same, but you may need to recreate the response for your client:
242
244
 
243
245
  ```typescript
244
246
  export async function action() {
@@ -252,7 +254,7 @@ export async function action() {
252
254
 
253
255
  ## Best practices
254
256
 
255
- 1. **Error Handling**: Implement proper [error handling](https://mastra.ai/reference/client-js/error-handling) for development scenarios.
257
+ 1. **Error Handling**: Use [error handling](https://mastra.ai/reference/client-js/error-handling) for development scenarios.
256
258
  2. **Environment Variables**: Use environment variables for configuration.
257
259
  3. **Debugging**: Enable detailed [logging](https://mastra.ai/reference/client-js/logs) when needed.
258
- 4. **Performance**: Monitor application performance, [telemetry](https://mastra.ai/reference/client-js/telemetry) and traces.
260
+ 4. **Performance**: Track application performance, [telemetry](https://mastra.ai/reference/client-js/telemetry), and traces.
@@ -12,7 +12,7 @@ The server provides:
12
12
 
13
13
  - API endpoints for all registered agents and workflows
14
14
  - Custom API routes and middleware
15
- - Authentication with multiple providers
15
+ - Authentication across providers
16
16
  - Request context for dynamic configuration
17
17
  - Stream data redaction for secure responses
18
18
 
@@ -51,6 +51,18 @@ To explore the API interactively, visit the Swagger UI at <http://localhost:4111
51
51
 
52
52
  > **Note:** The OpenAPI and Swagger endpoints are disabled in production by default. To enable them, set [`server.build.openAPIDocs`](https://mastra.ai/reference/configuration) and [`server.build.swaggerUI`](https://mastra.ai/reference/configuration) to `true` respectively.
53
53
 
54
+ ## OpenAI Responses API
55
+
56
+ Mastra exposes OpenAI-compatible Responses and Conversations routes. These routes are agent-backed adapters over Mastra agents, memory, and storage, so requests run through the selected Mastra agent instead of acting as a raw provider proxy.
57
+
58
+ These APIs are currently experimental.
59
+
60
+ Use `agent_id` to select the Mastra agent that should handle the request. Initial requests target an agent directly, and stored follow-up turns can continue with `previous_response_id`. You can also pass `model` to override the agent's configured model for a single request. If you omit `model`, Mastra uses the model already configured on the agent.
61
+
62
+ The Responses routes support streaming, function calling (tools), stored continuations with `previous_response_id`, conversation threads through `conversation_id`, provider-specific passthrough with `providerOptions`, and JSON output through `text.format`.
63
+
64
+ For the full request and response contract, see the [Responses API reference](https://mastra.ai/reference/client-js/responses) and [Conversations API reference](https://mastra.ai/reference/client-js/conversations). For the complete list of HTTP routes, see [server routes](https://mastra.ai/reference/server/routes).
65
+
54
66
  ## Stream data redaction
55
67
 
56
68
  When streaming agent responses, the HTTP layer redacts system prompts, tool definitions, API keys, and similar data from each chunk before sending it to clients. This is enabled by default.
@@ -4,6 +4,7 @@ Studio includes these observability views:
4
4
 
5
5
  - **Metrics** for aggregate performance data
6
6
  - **Traces** for individual request inspection
7
+ - **Logs** for browsing internal and application logs
7
8
 
8
9
  All require an [observability storage backend](#quickstart) to be configured.
9
10
 
@@ -21,6 +22,12 @@ When you run an agent or workflow, the Observability tab displays traces that hi
21
22
 
22
23
  Tracing filters out low-level framework details so your traces stay focused and readable. Visit the [tracing overview](https://mastra.ai/docs/observability/tracing/overview) for more details.
23
24
 
25
+ ## Logs
26
+
27
+ Browse internal Mastra logs forwarded to your observability storage. Logs provide full-text search (across message content, entity names, and trace IDs), date presets (last 24 hours to 30 days), and multi-select filters for level, entity type, and entity name. Selecting a log opens a detail panel showing the full message, structured data, and metadata. If the log is correlated with a trace, you can navigate directly to the trace and span timeline.
28
+
29
+ Log forwarding is enabled by default when you configure observability. See [logging](https://mastra.ai/docs/observability/logging) for level configuration, query examples, and customization details.
30
+
24
31
  ## Quickstart
25
32
 
26
33
  For detailed instructions, follow the [observability instructions](https://mastra.ai/docs/observability/overview). To get up and running quickly, add the `@mastra/observability` package to your project and configure it with [LibSQL](https://mastra.ai/reference/storage/libsql) and [DuckDB](https://mastra.ai/reference/vectors/duckdb) for a local development setup that supports both traces and metrics.
@@ -95,4 +102,5 @@ export const mastra = new Mastra({
95
102
 
96
103
  - [Observability overview](https://mastra.ai/docs/observability/overview)
97
104
  - [Metrics overview](https://mastra.ai/docs/observability/metrics/overview)
98
- - [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
105
+ - [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
106
+ - [Logging](https://mastra.ai/docs/observability/logging)
@@ -124,4 +124,4 @@ Mastra also supports HTTPS development through the [`--https`](https://mastra.ai
124
124
 
125
125
  - Learn how to [deploy Studio](https://mastra.ai/docs/studio/deployment) for production use.
126
126
  - Add [authentication](https://mastra.ai/docs/studio/auth) to control access to your deployed Studio.
127
- - Explore [Studio observability](https://mastra.ai/docs/studio/observability) to monitor agent performance and gain insights through metrics, logs, and traces.
127
+ - Explore [Studio observability](https://mastra.ai/docs/studio/observability) to monitor agent performance through metrics, traces, and logs.
@@ -0,0 +1,152 @@
1
+ # Web scraping with Firecrawl
2
+
3
+ Firecrawl is a web data API that turns websites into clean markdown or structured JSON. In this guide, you will wire Firecrawl into Mastra tools so your agents and workflows can search and scrape live web data on demand.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js `v22.13.0` or later installed
8
+ - A Firecrawl API key (get one at <https://firecrawl.dev>)
9
+ - An API key from a supported [Model Provider](https://mastra.ai/models)
10
+ - An existing Mastra project (Follow the [installation guide](https://mastra.ai/guides/getting-started/quickstart) to set up a new project)
11
+
12
+ ## Installation
13
+
14
+ Install the Firecrawl SDK:
15
+
16
+ **npm**:
17
+
18
+ ```bash
19
+ npm install @mendable/firecrawl-js
20
+ ```
21
+
22
+ **pnpm**:
23
+
24
+ ```bash
25
+ pnpm add @mendable/firecrawl-js
26
+ ```
27
+
28
+ **Yarn**:
29
+
30
+ ```bash
31
+ yarn add @mendable/firecrawl-js
32
+ ```
33
+
34
+ **Bun**:
35
+
36
+ ```bash
37
+ bun add @mendable/firecrawl-js
38
+ ```
39
+
40
+ ## Configure environment variables
41
+
42
+ Create a `.env` file in your project root:
43
+
44
+ ```bash
45
+ FIRECRAWL_API_KEY=fc-your-api-key
46
+ # Optional: FIRECRAWL_API_URL=http://localhost:3002
47
+ ```
48
+
49
+ ## Build the Firecrawl tools
50
+
51
+ Create a tool file that exposes Firecrawl search and scrape to Mastra.
52
+
53
+ 1. Create `src/mastra/tools/firecrawl.ts` and set up Firecrawl:
54
+
55
+ ```ts
56
+ import Firecrawl from '@mendable/firecrawl-js'
57
+ import { createTool } from '@mastra/core/tools'
58
+ import { z } from 'zod'
59
+
60
+ const firecrawl = new Firecrawl({ apiKey: process.env.FIRECRAWL_API_KEY! })
61
+
62
+ export const firecrawlSearch = createTool({
63
+ id: 'firecrawl-search',
64
+ description: 'Search the web and return top results.',
65
+ inputSchema: z.object({ query: z.string().min(1) }),
66
+ outputSchema: z.object({
67
+ results: z.array(
68
+ z.object({
69
+ title: z.string().nullable(),
70
+ url: z.string(),
71
+ }),
72
+ ),
73
+ }),
74
+ execute: async ({ query }) => {
75
+ const results = await firecrawl.search(query, { limit: 3 })
76
+ return {
77
+ results: (results.web ?? []).map(item => ({
78
+ title: item.title ?? null,
79
+ url: item.url,
80
+ })),
81
+ }
82
+ },
83
+ })
84
+
85
+ export const firecrawlScrape = createTool({
86
+ id: 'firecrawl-scrape',
87
+ description: 'Scrape a URL and return markdown content.',
88
+ inputSchema: z.object({ url: z.string().url() }),
89
+ outputSchema: z.object({ markdown: z.string() }),
90
+ execute: async ({ url }) => {
91
+ const result = await firecrawl.scrape(url, {
92
+ formats: ['markdown'],
93
+ onlyMainContent: true,
94
+ })
95
+ return { markdown: result.markdown ?? '' }
96
+ },
97
+ })
98
+ ```
99
+
100
+ 2. Create a new agent at `src/mastra/agents/web-agent.ts`:
101
+
102
+ ```ts
103
+ import { Agent } from '@mastra/core/agent'
104
+ import { firecrawlSearch, firecrawlScrape } from '../tools/firecrawl'
105
+
106
+ export const webAgent = new Agent({
107
+ id: 'web-agent',
108
+ name: 'Web Agent',
109
+ instructions: 'Use Firecrawl tools to search and scrape web pages, then summarize the results.',
110
+ model: 'openai/gpt-5.4',
111
+ tools: { firecrawlSearch, firecrawlScrape },
112
+ })
113
+ ```
114
+
115
+ 3. Register the newly created agent in `src/mastra/index.ts` on your Mastra instance:
116
+
117
+ ```ts
118
+ import { Mastra } from '@mastra/core'
119
+ import { webAgent } from './agents/web-agent'
120
+
121
+ export const mastra = new Mastra({
122
+ agents: { webAgent },
123
+ })
124
+ ```
125
+
126
+ ## Test in Studio
127
+
128
+ Run the dev server and open [Studio](https://mastra.ai/docs/studio/overview):
129
+
130
+ ```bash
131
+ mastra dev
132
+ ```
133
+
134
+ In Studio, open the **Web Agent** and try:
135
+
136
+ - "Find the latest Mastra changelog and summarize the last release."
137
+ - "Search for Firecrawl pricing and extract the plan tiers."
138
+
139
+ ## Self-hosted Firecrawl
140
+
141
+ If you run Firecrawl locally, set `FIRECRAWL_API_URL` or pass `apiUrl` in the client:
142
+
143
+ ```ts
144
+ const firecrawl = new Firecrawl({
145
+ apiKey: process.env.FIRECRAWL_API_KEY!,
146
+ apiUrl: process.env.FIRECRAWL_API_URL,
147
+ })
148
+ ```
149
+
150
+ ## Related
151
+
152
+ - [Firecrawl documentation](https://docs.firecrawl.dev)
@@ -1,6 +1,6 @@
1
1
  # ![OpenRouter logo](https://models.dev/logos/openrouter.svg)OpenRouter
2
2
 
3
- OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 166 models through Mastra's model router.
3
+ OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 168 models through Mastra's model router.
4
4
 
5
5
  Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
6
6
 
@@ -173,6 +173,7 @@ ANTHROPIC_API_KEY=ant-...
173
173
  | `qwen/qwen3.5-397b-a17b` |
174
174
  | `qwen/qwen3.5-plus-02-15` |
175
175
  | `qwen/qwen3.6-plus-preview:free` |
176
+ | `qwen/qwen3.6-plus:free` |
176
177
  | `sourceful/riverflow-v2-fast-preview` |
177
178
  | `sourceful/riverflow-v2-max-preview` |
178
179
  | `sourceful/riverflow-v2-standard-preview` |
@@ -199,4 +200,5 @@ ANTHROPIC_API_KEY=ant-...
199
200
  | `z-ai/glm-4.6:exacto` |
200
201
  | `z-ai/glm-4.7` |
201
202
  | `z-ai/glm-4.7-flash` |
202
- | `z-ai/glm-5` |
203
+ | `z-ai/glm-5` |
204
+ | `z-ai/glm-5-turbo` |
@@ -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 3566 models from 94 providers through a single API.
3
+ Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 3581 models from 95 providers through a single API.
4
4
 
5
5
  ## Features
6
6
 
@@ -1,6 +1,6 @@
1
1
  # ![Anthropic logo](https://models.dev/logos/anthropic.svg)Anthropic
2
2
 
3
- Access 23 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
3
+ Access 22 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
4
4
 
5
5
  Learn more in the [Anthropic documentation](https://docs.anthropic.com/en/docs/about-claude/models).
6
6
 
@@ -37,7 +37,6 @@ for await (const chunk of stream) {
37
37
  | `anthropic/claude-3-5-sonnet-20240620` | 200K | | | | | | $3 | $15 |
38
38
  | `anthropic/claude-3-5-sonnet-20241022` | 200K | | | | | | $3 | $15 |
39
39
  | `anthropic/claude-3-7-sonnet-20250219` | 200K | | | | | | $3 | $15 |
40
- | `anthropic/claude-3-7-sonnet-latest` | 200K | | | | | | $3 | $15 |
41
40
  | `anthropic/claude-3-haiku-20240307` | 200K | | | | | | $0.25 | $1 |
42
41
  | `anthropic/claude-3-opus-20240229` | 200K | | | | | | $15 | $75 |
43
42
  | `anthropic/claude-3-sonnet-20240229` | 200K | | | | | | $3 | $15 |