@mastra/mcp-docs-server 1.2.7-alpha.4 → 1.2.7-alpha.8

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 (78) hide show
  1. package/.docs/docs/agent-builder/overview.md +4 -3
  2. package/.docs/docs/agent-controller/overview.md +2 -1
  3. package/.docs/docs/agents/a2a.md +2 -1
  4. package/.docs/docs/agents/guardrails.md +2 -1
  5. package/.docs/docs/agents/overview.md +2 -2
  6. package/.docs/docs/agents/skills.md +1 -1
  7. package/.docs/docs/agents/supervisor-agents.md +2 -1
  8. package/.docs/docs/browser/overview.md +2 -1
  9. package/.docs/docs/capabilities/channels/discord.md +98 -0
  10. package/.docs/docs/capabilities/channels/other-adapters.md +68 -0
  11. package/.docs/docs/capabilities/channels/overview.md +257 -0
  12. package/.docs/docs/capabilities/channels/slack.md +225 -0
  13. package/.docs/docs/capabilities/channels/teams.md +100 -0
  14. package/.docs/docs/capabilities/channels/telegram.md +98 -0
  15. package/.docs/docs/capabilities/channels/whatsapp.md +99 -0
  16. package/.docs/docs/evals/datasets/overview.md +2 -1
  17. package/.docs/docs/evals/datasets/running-experiments.md +2 -0
  18. package/.docs/docs/evals/overview.md +4 -1
  19. package/.docs/docs/getting-started/file-based-agents.md +114 -0
  20. package/.docs/docs/long-running-agents/signals.md +4 -1
  21. package/.docs/docs/mastra-platform/observability.md +5 -1
  22. package/.docs/docs/memory/observational-memory.md +2 -1
  23. package/.docs/docs/memory/overview.md +2 -0
  24. package/.docs/docs/memory/semantic-recall.md +1 -1
  25. package/.docs/docs/memory/working-memory.md +3 -3
  26. package/.docs/docs/studio/overview.md +1 -1
  27. package/.docs/docs/workflows/control-flow.md +0 -2
  28. package/.docs/docs/workflows/overview.md +2 -3
  29. package/.docs/docs/workspace/overview.md +2 -1
  30. package/.docs/docs/workspace/sandbox.md +2 -0
  31. package/.docs/guides/getting-started/quickstart.md +3 -1
  32. package/.docs/guides/guide/chef-michel.md +0 -2
  33. package/.docs/guides/guide/slack-assistant.md +2 -2
  34. package/.docs/guides/guide/stock-agent.md +0 -2
  35. package/.docs/models/environment-variables.md +2 -0
  36. package/.docs/models/gateways/netlify.md +4 -1
  37. package/.docs/models/gateways/openrouter.md +7 -6
  38. package/.docs/models/gateways/vercel.md +5 -1
  39. package/.docs/models/index.md +1 -1
  40. package/.docs/models/providers/crossmodel.md +109 -0
  41. package/.docs/models/providers/llmgateway.md +185 -181
  42. package/.docs/models/providers/meta.md +101 -0
  43. package/.docs/models/providers/nano-gpt.md +2 -2
  44. package/.docs/models/providers/neon.md +40 -29
  45. package/.docs/models/providers/openai.md +5 -1
  46. package/.docs/models/providers/poolside.md +6 -5
  47. package/.docs/models/providers/routing-run.md +20 -34
  48. package/.docs/models/providers/the-grid-ai.md +3 -3
  49. package/.docs/models/providers.md +2 -0
  50. package/.docs/reference/agents/channels.md +2 -2
  51. package/.docs/reference/channels/channel-provider.md +1 -1
  52. package/.docs/reference/channels/slack-provider.md +2 -2
  53. package/.docs/reference/cli/mastra.md +1 -0
  54. package/.docs/reference/file-based-agents/config.md +97 -0
  55. package/.docs/reference/file-based-agents/instructions.md +54 -0
  56. package/.docs/reference/file-based-agents/memory.md +58 -0
  57. package/.docs/reference/file-based-agents/observability.md +32 -0
  58. package/.docs/reference/file-based-agents/processors.md +56 -0
  59. package/.docs/reference/file-based-agents/server.md +37 -0
  60. package/.docs/reference/file-based-agents/skills.md +56 -0
  61. package/.docs/reference/file-based-agents/storage.md +30 -0
  62. package/.docs/reference/file-based-agents/studio.md +56 -0
  63. package/.docs/reference/file-based-agents/subagents.md +123 -0
  64. package/.docs/reference/file-based-agents/tools.md +63 -0
  65. package/.docs/reference/file-based-agents/workflows.md +52 -0
  66. package/.docs/reference/file-based-agents/workspace.md +74 -0
  67. package/.docs/reference/index.md +13 -0
  68. package/.docs/reference/memory/memory-class.md +1 -1
  69. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  70. package/.docs/reference/project-structure.md +1 -1
  71. package/.docs/reference/pubsub/lease-provider.md +1 -1
  72. package/.docs/reference/storage/clickhouse.md +32 -0
  73. package/.docs/reference/storage/composite.md +27 -1
  74. package/.docs/reference/storage/retention.md +11 -0
  75. package/CHANGELOG.md +14 -0
  76. package/package.json +4 -4
  77. package/.docs/docs/agents/channels.md +0 -225
  78. package/.docs/docs/agents/file-based-agents.md +0 -297
@@ -4,10 +4,10 @@
4
4
 
5
5
  > **Note:** The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. [Contact sales](https://mastra.ai/contact) for more information.
6
6
 
7
- [YouTube video player](https://www.youtube-nocookie.com/embed/AbdgIu4Z07I)
8
-
9
7
  The Agent Builder lets you build, configure, and operate Mastra agents all within the UI. It runs inside your Mastra server, persists everything to `Mastra.storage`, and supports multi-tenant agent workflows with RBAC and channel integrations.
10
8
 
9
+ > **📹 Watch:** Watch [Mastra Agent Builder overview](https://www.youtube.com/watch?v=AbdgIu4Z07I) to see how teams create and configure agents from the UI.
10
+
11
11
  - [**Configuration**](https://mastra.ai/docs/agent-builder/configuration): Toggle UI sections and pin admin-controlled defaults for every new agent.
12
12
  - [**Model policy**](https://mastra.ai/docs/agent-builder/model-policy): Restrict which providers and models the Builder exposes, and pin a default.
13
13
  - [**Memory**](https://mastra.ai/docs/agent-builder/memory): Configure the default memory shape for every Builder-created agent.
@@ -108,4 +108,5 @@ Omitting the `builder` field has the same effect.
108
108
 
109
109
  - [Configuration](https://mastra.ai/docs/agent-builder/configuration): Toggle Builder surfaces and pin defaults for new agents.
110
110
  - [Access control](https://mastra.ai/docs/agent-builder/access-control): Gate the Builder with authentication and role-based access control.
111
- - [Deploying](https://mastra.ai/docs/agent-builder/deploying): Replace local development primitives with production-ready storage, filesystems, and sandboxes.
111
+ - [Deploying](https://mastra.ai/docs/agent-builder/deploying): Replace local development primitives with production-ready storage, filesystems, and sandboxes.
112
+ - 📹 [Mastra Agent Builder workshop](https://www.youtube.com/watch?v=p2p_wb-rUPg\&t=666s)
@@ -128,4 +128,5 @@ Your app sends commands — send a message, switch mode, approve a tool call —
128
128
  - [Threads and state](https://mastra.ai/docs/agent-controller/threads-and-state): Manage persistent conversations
129
129
  - [Subagents](https://mastra.ai/docs/agent-controller/subagents): Delegate focused subtasks
130
130
  - [Tool approvals and permissions](https://mastra.ai/docs/agent-controller/tool-approvals): Human-in-the-loop gating
131
- - [API reference](https://mastra.ai/reference/agent-controller/agent-controller-class): Full constructor and method docs
131
+ - [API reference](https://mastra.ai/reference/agent-controller/agent-controller-class): Full constructor and method docs
132
+ - 📹 [Mastra AgentController harness workshop](https://www.youtube.com/watch?v=tV1pSleP-LM)
@@ -261,4 +261,5 @@ Use this hook to enforce expected providers, expected endpoints, certificate-bou
261
261
  - [Agent reference](https://mastra.ai/reference/agents/agent)
262
262
  - [JavaScript client agents reference](https://mastra.ai/reference/client-js/agents)
263
263
  - [A2A core concepts](https://a2a-protocol.org/latest/topics/key-concepts/)
264
- - [A2A discovery guide](https://a2a-protocol.org/latest/topics/agent-discovery/)
264
+ - [A2A discovery guide](https://a2a-protocol.org/latest/topics/agent-discovery/)
265
+ - 📹 [Agent-to-agent with Mastra workshop](https://www.youtube.com/watch?v=LQDzyNGm-aw)
@@ -386,4 +386,5 @@ outputProcessors: [
386
386
 
387
387
  - [Processors](https://mastra.ai/docs/agents/processors): How processors work, execution order, custom processors, and retry mechanism
388
388
  - [`Processor` Interface](https://mastra.ai/reference/processors/processor-interface): API reference for the `Processor` interface
389
- - [Memory Processors](https://mastra.ai/docs/memory/memory-processors): Processors for message history, semantic recall, and working memory
389
+ - [Memory Processors](https://mastra.ai/docs/memory/memory-processors): Processors for message history, semantic recall, and working memory
390
+ - 📹 [Mastra processors and guardrails workshop](https://www.youtube.com/watch?v=4Vpp7xQYvl0)
@@ -119,7 +119,7 @@ console.log(response.text)
119
119
 
120
120
  Use agents when the task is open-ended and the steps aren't known in advance. An agent decides which tools to call, how many times to loop, and when to stop. You provide the goal and constraints instead of defining each step. For predetermined, multi-step processes with explicit control flow, use [workflows](https://mastra.ai/docs/workflows/overview) instead.
121
121
 
122
- > **Tip:** Watch an introduction to agents, and how they compare to workflows on [YouTube (7 minutes)](https://youtu.be/0jg2g3sNvgw).
122
+ > **📹 Watch:** Watch [Mastra agent quickstart](https://www.youtube.com/watch?v=G8tXjcseNjg) for a short walkthrough of creating and testing a Mastra agent.
123
123
 
124
124
  ## Quickstart
125
125
 
@@ -205,7 +205,7 @@ Once your agent is running, use this table to find the right page for what you w
205
205
  | Build agents that correct their work | [Rubric scorer](https://mastra.ai/docs/agents/supervisor-agents) |
206
206
  | Swap instructions or models based on request context | [Dynamic configuration](https://mastra.ai/docs/server/request-context) |
207
207
  | Add speech-to-text or text-to-speech | [Voice](https://mastra.ai/docs/voice/overview) |
208
- | Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/agents/channels) |
208
+ | Connect to Slack, Discord, or Telegram | [Channels](https://mastra.ai/docs/capabilities/channels/overview) |
209
209
 
210
210
  ## Multi-agent systems
211
211
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Skills are reusable instructions that teach agents how to perform specific tasks. They follow the [Agent Skills specification](https://agentskills.io).
6
6
 
7
- You can attach skills directly to an agent without setting up a workspace, filesystem, or sandbox. This is useful when you want portable, code-defined capabilities that travel with your agent definition.
7
+ You can attach skills directly to an agent through its `skills` config, or configure them on a [workspace](https://mastra.ai/docs/workspace/overview). Attach them to the agent when the skills belong to that specific agent and you want to define them in code with no workspace required; use a workspace when you want skills discovered from the filesystem and shared across every agent that uses it. This page covers the agent-level approach — defining skills in code, loading them from files, and resolving them per request.
8
8
 
9
9
  ## When to use agent-level skills
10
10
 
@@ -428,4 +428,5 @@ Version overrides propagate automatically through delegation. See [Subagent vers
428
428
  - [Agent.generate() reference](https://mastra.ai/reference/agents/generate)
429
429
  - [Agent approval](https://mastra.ai/docs/agents/agent-approval)
430
430
  - [Memory in multi-agent systems](https://mastra.ai/docs/memory/overview)
431
- - [Concept: Multi-agent systems](https://mastra.ai/guides/concepts/multi-agent-systems)
431
+ - [Concept: Multi-agent systems](https://mastra.ai/guides/concepts/multi-agent-systems)
432
+ - 📹 [Mastra supervisor agents workshop](https://www.youtube.com/watch?v=FNb2fL9WhQg\&t=1872s)
@@ -169,4 +169,5 @@ const browser = new AgentBrowser({
169
169
  - [Stagehand](https://mastra.ai/docs/browser/stagehand)
170
170
  - [Browser recording (alpha)](https://mastra.ai/docs/browser/recording)
171
171
  - [BrowserViewer](https://mastra.ai/docs/browser/browser-viewer)
172
- - [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
172
+ - [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
173
+ - 📹 [Mastra browser capabilities workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)
@@ -0,0 +1,98 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Discord
4
+
5
+ Discord channels let a Mastra agent receive Discord interactions and bot messages. Mastra handles the agent wiring and webhook route; the Chat SDK Discord adapter docs cover Discord application setup, bot permissions, and Gateway behavior.
6
+
7
+ ## Install the adapter
8
+
9
+ Install the Discord adapter from the Chat SDK:
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @chat-adapter/discord
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @chat-adapter/discord
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @chat-adapter/discord
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @chat-adapter/discord
33
+ ```
34
+
35
+ ## Agent configuration
36
+
37
+ Add `createDiscordAdapter()` to the agent's `channels.adapters` object:
38
+
39
+ ```typescript
40
+ import { Agent } from '@mastra/core/agent'
41
+ import { createDiscordAdapter } from '@chat-adapter/discord'
42
+
43
+ export const discordAgent = new Agent({
44
+ id: 'discord-agent',
45
+ name: 'Discord Agent',
46
+ instructions: 'Answer questions and help with tasks in Discord.',
47
+ model: 'openai/gpt-5.5',
48
+ channels: {
49
+ adapters: {
50
+ discord: createDiscordAdapter(),
51
+ },
52
+ },
53
+ })
54
+ ```
55
+
56
+ Register the agent on the Mastra instance:
57
+
58
+ ```typescript
59
+ import { Mastra } from '@mastra/core'
60
+ import { discordAgent } from './agents/discord-agent'
61
+
62
+ export const mastra = new Mastra({
63
+ agents: { discordAgent },
64
+ })
65
+ ```
66
+
67
+ ## Adapter setup
68
+
69
+ Follow the [Chat SDK Discord adapter docs](https://chat-sdk.dev/adapters/official/discord) for Discord-specific setup, including application creation, bot tokens, interaction endpoints, permissions, and Gateway behavior.
70
+
71
+ The adapter reads Discord credentials from environment variables such as:
72
+
73
+ ```bash
74
+ DISCORD_BOT_TOKEN=your-discord-bot-token
75
+ DISCORD_PUBLIC_KEY=your-discord-application-public-key
76
+ DISCORD_APPLICATION_ID=your-discord-application-id
77
+ ```
78
+
79
+ ## Webhook URL
80
+
81
+ Mastra generates the Discord webhook route from the agent ID and adapter key:
82
+
83
+ ```text
84
+ /api/agents/discord-agent/channels/discord/webhook
85
+ ```
86
+
87
+ Use your public Mastra server URL as the base URL:
88
+
89
+ ```text
90
+ https://your-app.example.com/api/agents/discord-agent/channels/discord/webhook
91
+ ```
92
+
93
+ Use this URL anywhere the Discord adapter docs ask for the interactions endpoint or webhook URL. Discord regular message events may require Gateway setup outside the generated webhook route; follow the Chat SDK adapter docs for that path.
94
+
95
+ ## Related
96
+
97
+ - [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
98
+ - [More](https://mastra.ai/docs/capabilities/channels/other-adapters)
@@ -0,0 +1,68 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # More
4
+
5
+ Mastra channels use Chat SDK adapters, so the pages in this section are not the full list of supported platforms. Use any Chat SDK platform adapter that exports an adapter factory compatible with `channels.adapters`.
6
+
7
+ ## Adapter catalog
8
+
9
+ The [Chat SDK adapter catalog](https://chat-sdk.dev/adapters) is the canonical source for available adapters. The list below is only a snapshot and may not always be up to date.
10
+
11
+ At the time of writing, Chat SDK lists adapters for:
12
+
13
+ - AgentPhone
14
+ - Baileys WhatsApp
15
+ - Discord
16
+ - Google Chat
17
+ - GitHub
18
+ - iMessage
19
+ - Kapso
20
+ - Lark / Feishu
21
+ - Linear
22
+ - Liveblocks
23
+ - Matrix
24
+ - Messenger
25
+ - Mattermost
26
+ - Novu
27
+ - Resend
28
+ - Sendblue
29
+ - Telegram
30
+ - Twilio
31
+ - Velt
32
+ - Web
33
+ - Webex
34
+ - WeChat
35
+ - WhatsApp Business Cloud
36
+ - X
37
+ - Zalo
38
+ - Zernio
39
+
40
+ Check the adapter's docs for its package name, credential variables, webhook requirements, and platform-specific behavior.
41
+
42
+ ## Use the same Mastra wiring
43
+
44
+ The Mastra side of each Chat SDK adapter is similar: install the adapter package, add its adapter factory to `channels.adapters`, configure platform credentials, and point the platform webhook to the generated Mastra route.
45
+
46
+ Use one of the platform pages in this section as a reference for the Mastra wiring:
47
+
48
+ - [Slack](https://mastra.ai/docs/capabilities/channels/slack)
49
+ - [Microsoft Teams](https://mastra.ai/docs/capabilities/channels/teams)
50
+ - [Discord](https://mastra.ai/docs/capabilities/channels/discord)
51
+ - [Telegram](https://mastra.ai/docs/capabilities/channels/telegram)
52
+ - [WhatsApp](https://mastra.ai/docs/capabilities/channels/whatsapp)
53
+
54
+ ## What to check in adapter docs
55
+
56
+ Before wiring a new adapter into Mastra, check the adapter docs for:
57
+
58
+ - Credential environment variables.
59
+ - Required platform permissions or scopes.
60
+ - Webhook verification behavior.
61
+ - Whether the platform needs separate routes for setup, events, or interactions.
62
+ - Whether regular messages require long-running listeners or polling.
63
+ - Attachment, card, and rich message support.
64
+
65
+ ## Related
66
+
67
+ - [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
68
+ - [Channels reference](https://mastra.ai/reference/agents/channels)
@@ -0,0 +1,257 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Channels overview
4
+
5
+ **Added in:** `@mastra/core@1.22.0`
6
+
7
+ Channels connect agents to messaging and collaboration platforms like Slack, Microsoft Teams, Discord, Telegram, WhatsApp, GitHub, and Linear. When a user sends a message or comment on a platform, the agent receives it, processes it through the normal agent pipeline, and streams the response back to the conversation. Mastra uses [Chat SDK](https://chat-sdk.dev/) for this channel layer.
8
+
9
+ Start with the page for your platform:
10
+
11
+ - [Slack](https://mastra.ai/docs/capabilities/channels/slack)
12
+ - [Microsoft Teams](https://mastra.ai/docs/capabilities/channels/teams)
13
+ - [Discord](https://mastra.ai/docs/capabilities/channels/discord)
14
+ - [Telegram](https://mastra.ai/docs/capabilities/channels/telegram)
15
+ - [WhatsApp](https://mastra.ai/docs/capabilities/channels/whatsapp)
16
+
17
+ [More](https://mastra.ai/docs/capabilities/channels/other-adapters) lists additional platforms. Mastra channels work with compatible [Chat SDK adapters](https://chat-sdk.dev/adapters) beyond the platforms listed here, and the same Mastra configuration pattern applies across adapters.
18
+
19
+ ## When to use channels
20
+
21
+ Use channels when an agent needs to:
22
+
23
+ - Meet users where they already talk or work.
24
+ - Respond in chat platforms like Slack, Microsoft Teams, Discord, Telegram, and WhatsApp.
25
+ - Support multiplayer agents where several people interact with the same agent in a shared channel or thread.
26
+ - Integrate with collaboration workflows like GitHub issues, pull request threads, and Linear comments.
27
+
28
+ ## Configure an agent
29
+
30
+ Channels use Chat SDK adapters and follow the same Mastra-side pattern: create a channel adapter and add it to the agent.
31
+
32
+ ```typescript
33
+ import { Agent } from '@mastra/core/agent'
34
+ import { createSlackAdapter } from '@chat-adapter/slack'
35
+
36
+ export const yourAgent = new Agent({
37
+ id: 'your-agent',
38
+ name: 'Your Agent',
39
+ instructions: 'You are a helpful assistant.',
40
+ model: 'openai/gpt-5.5',
41
+ channels: {
42
+ adapters: {
43
+ slack: createSlackAdapter(),
44
+ },
45
+ },
46
+ })
47
+ ```
48
+
49
+ > **Note:** Channel adapters require provider-specific environment variables for credentials and request verification, such as bot tokens, signing secrets, app IDs, and webhook verification tokens. Check the guide for your platform or the [Chat SDK adapter catalog](https://chat-sdk.dev/adapters) for the exact variable names.
50
+
51
+ We recommend configuring [storage](https://mastra.ai/docs/storage/overview) for channels. Storage lets Mastra persist channel state, thread subscriptions, tool approvals, and memory across restarts:
52
+
53
+ ```typescript
54
+ import { Mastra } from '@mastra/core'
55
+ import { LibSQLStore } from '@mastra/libsql'
56
+ import { yourAgent } from './agents/your-agent'
57
+
58
+ export const mastra = new Mastra({
59
+ agents: { yourAgent },
60
+ storage: new LibSQLStore({
61
+ url: process.env.DATABASE_URL,
62
+ }),
63
+ })
64
+ ```
65
+
66
+ ## Webhook routes
67
+
68
+ Platforms send channel activity to Mastra through webhooks. A webhook is an HTTP endpoint that the platform calls when something happens, such as a new message, a mention, or a user selecting "Approve" on an interactive tool approval card. This is how your agent receives a new message, starts processing it, and responds in the same channel.
69
+
70
+ Mastra registers a webhook route for each configured adapter and handles the request for you:
71
+
72
+ ```text
73
+ /api/agents/<AGENT_ID>/channels/<PLATFORM>/webhook
74
+ ```
75
+
76
+ For example, a Slack adapter on an agent with the `your-agent` ID uses:
77
+
78
+ ```text
79
+ /api/agents/your-agent/channels/slack/webhook
80
+ ```
81
+
82
+ Point the platform's webhook, event, or interactions URL to this path. Follow the guide for your platform or the [Chat SDK docs](https://chat-sdk.dev/adapters).
83
+
84
+ During local development, platform webhooks need a public URL to reach your local server. Use a tunnel like [cloudflared](https://github.com/cloudflare/cloudflared) or [ngrok](https://ngrok.com/) to expose your server, `localhost:4111` by default:
85
+
86
+ **npm**:
87
+
88
+ ```bash
89
+ npx cloudflared tunnel --url http://localhost:4111
90
+ ```
91
+
92
+ **pnpm**:
93
+
94
+ ```bash
95
+ pnpm dlx cloudflared tunnel --url http://localhost:4111
96
+ ```
97
+
98
+ **Yarn**:
99
+
100
+ ```bash
101
+ yarn dlx cloudflared tunnel --url http://localhost:4111
102
+ ```
103
+
104
+ **Bun**:
105
+
106
+ ```bash
107
+ bun x cloudflared tunnel --url http://localhost:4111
108
+ ```
109
+
110
+ Use the generated public URL as the base URL for webhook paths, for example `https://abc123.trycloudflare.com/api/agents/your-agent/channels/slack/webhook`.
111
+
112
+ > **Note:** Tunnel URLs are for local development. After you deploy the Mastra server, update the platform's webhook, event, or interactions URL to your production URL.
113
+
114
+ ## Thread context
115
+
116
+ 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.
117
+
118
+ 1. On the first mention in a thread, the agent fetches recent messages from the platform.
119
+ 2. These messages are prepended to the user's message as conversation context.
120
+ 3. After responding, the agent subscribes to the thread and has full history through Mastra memory.
121
+ 4. Subsequent messages in that thread don't re-fetch from the platform.
122
+
123
+ Set `threadContext: { maxMessages: 0 }` to disable this behavior. This only applies to non-direct message threads.
124
+
125
+ Mastra also adds a short system message that tells the agent which channel and platform the request came from, such as whether the message came from a direct message or public channel. Set `threadContext: { addSystemMessage: false }` to skip it.
126
+
127
+ ## Tool approval
128
+
129
+ Tools with `requireApproval: true` render as interactive cards with Approve and Deny buttons:
130
+
131
+ ```typescript
132
+ import { promises as fs } from 'node:fs'
133
+ import { createTool } from '@mastra/core/tools'
134
+ import { z } from 'zod'
135
+
136
+ export const deleteFile = createTool({
137
+ id: 'delete-file',
138
+ description: 'Delete a file from the system',
139
+ inputSchema: z.object({
140
+ path: z.string().describe('Path to the file to delete'),
141
+ }),
142
+ requireApproval: true,
143
+ execute: async ({ path }) => {
144
+ await fs.unlink(path)
145
+ return { deleted: path }
146
+ },
147
+ })
148
+ ```
149
+
150
+ When the agent calls this tool, users see a card with the tool name, arguments, and Approve and Deny actions. The tool only executes after approval.
151
+
152
+ Set `toolDisplay: 'text'` on an adapter to render tool calls as plain text instead of interactive cards. In `'hidden'` mode, `autoResumeSuspendedTools` can resume suspended tools when a later user message arrives on the same thread. This requires memory. Hidden mode only suppresses the approval buttons.
153
+
154
+ ## Multi-user awareness
155
+
156
+ In group conversations, Mastra prefixes each message with the sender's name and platform ID so the agent can distinguish between speakers:
157
+
158
+ ```text
159
+ [Alice (@U123ABC)]: Can you help me with this?
160
+ [Bob (@U456DEF)]: I have a question too.
161
+ ```
162
+
163
+ ## Multimodal content
164
+
165
+ Models like Gemini can process images, video, and audio natively. Combine `inlineMedia` and `inlineLinks` to let users share rich content with your agent across platforms:
166
+
167
+ ```typescript
168
+ import { Agent } from '@mastra/core/agent'
169
+ import { createDiscordAdapter } from '@chat-adapter/discord'
170
+
171
+ export const visionAgent = new Agent({
172
+ id: 'vision-agent',
173
+ name: 'Vision Agent',
174
+ instructions: 'You can see images, watch videos, and listen to audio.',
175
+ model: 'google/gemini-2.5-flash',
176
+ channels: {
177
+ adapters: {
178
+ discord: createDiscordAdapter(),
179
+ },
180
+ inlineMedia: ['image/*', 'video/*', 'audio/*'],
181
+ inlineLinks: [
182
+ { match: 'youtube.com', mimeType: 'video/*' },
183
+ { match: 'youtu.be', mimeType: 'video/*' },
184
+ 'imgur.com',
185
+ ],
186
+ },
187
+ })
188
+ ```
189
+
190
+ With this configuration:
191
+
192
+ - A user uploads a screenshot and the agent describes what it sees.
193
+ - A user uploads an `.mp4` clip and the agent summarizes the video.
194
+ - A user pastes a YouTube link and the agent watches and discusses the video.
195
+ - A user pastes an imgur link and the agent sees the image directly.
196
+
197
+ By default, only images are sent inline (`inlineMedia: ['image/*']`). Unsupported types are described as text summaries so the agent knows about the file without failing on models that reject them.
198
+
199
+ > **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.
200
+
201
+ ## Serverless deployment
202
+
203
+ On serverless platforms like Vercel, each request runs in a separate, short-lived instance. Channels need two things to work reliably in that environment: a way to keep the function alive while the agent responds, and a shared pub/sub so instances can coordinate.
204
+
205
+ ### Keep the function alive with `waitUntil`
206
+
207
+ A channel webhook returns a `200` response right away, then the agent runs in the background to post its reply. On most serverless platforms the function is frozen as soon as it responds, which stops the run before the agent answers. Pass a `waitUntil` function so the platform keeps the instance alive until the run finishes.
208
+
209
+ On Vercel, pass `waitUntil` from `@vercel/functions`:
210
+
211
+ ```typescript
212
+ import { Agent } from '@mastra/core/agent'
213
+ import { createSlackAdapter } from '@chat-adapter/slack'
214
+ import { waitUntil } from '@vercel/functions'
215
+
216
+ export const yourAgent = new Agent({
217
+ id: 'your-agent',
218
+ name: 'Your Agent',
219
+ instructions: 'You are a helpful assistant.',
220
+ model: 'openai/gpt-5.5',
221
+ channels: {
222
+ adapters: {
223
+ slack: createSlackAdapter(),
224
+ },
225
+ waitUntil,
226
+ },
227
+ })
228
+ ```
229
+
230
+ Vercel and AWS Lambda require `waitUntil`, since they freeze the function as soon as the response is sent. Cloudflare Workers and Netlify Functions are detected automatically from the request context, so they don't need it. For runtimes where `waitUntil` lives on the request context but isn't detected automatically, use `resolveWaitUntil`. See the [Channels reference](https://mastra.ai/reference/agents/channels) for details.
231
+
232
+ ### Coordinate instances with a shared pub/sub
233
+
234
+ Channels route messages through the agent's [signal pipeline](https://mastra.ai/docs/long-running-agents/signals), and each run acquires a lease on its thread so one run owns the conversation at a time. The default in-memory pub/sub can't cross instance boundaries, so on serverless a follow-up message can land on a different instance than the one running the agent. Without a shared pub/sub, that instance can't reach the active run and starts its own, leaving the original run untouched and the thread processed twice.
235
+
236
+ Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
237
+
238
+ ```typescript
239
+ import { Mastra } from '@mastra/core'
240
+ import { RedisStreamsPubSub } from '@mastra/redis-streams'
241
+ import { yourAgent } from './agents/your-agent'
242
+
243
+ export const mastra = new Mastra({
244
+ agents: { yourAgent },
245
+ pubsub: new RedisStreamsPubSub({
246
+ url: process.env.REDIS_URL,
247
+ keyPrefix: 'mastra:my-app',
248
+ }),
249
+ })
250
+ ```
251
+
252
+ Vercel's managed Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
253
+
254
+ ## Related
255
+
256
+ - [Channels reference](https://mastra.ai/reference/agents/channels)
257
+ - 📹 [Mastra channels workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)