@mastra/mcp-docs-server 1.2.7-alpha.1 → 1.2.7-alpha.10

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 (198) hide show
  1. package/.docs/docs/agent-builder/integrations.md +1 -1
  2. package/.docs/docs/agent-builder/overview.md +4 -3
  3. package/.docs/docs/agent-builder/skill-registries.md +1 -3
  4. package/.docs/docs/agent-controller/modes.md +1 -1
  5. package/.docs/docs/agent-controller/overview.md +4 -3
  6. package/.docs/docs/agent-controller/session.md +3 -5
  7. package/.docs/docs/agents/a2a.md +2 -1
  8. package/.docs/docs/agents/agent-approval.md +2 -2
  9. package/.docs/docs/agents/code-mode.md +1 -1
  10. package/.docs/docs/agents/guardrails.md +10 -9
  11. package/.docs/docs/agents/networks.md +1 -1
  12. package/.docs/docs/agents/overview.md +5 -5
  13. package/.docs/docs/agents/skills.md +3 -5
  14. package/.docs/docs/agents/structured-output.md +1 -1
  15. package/.docs/docs/agents/supervisor-agents.md +3 -4
  16. package/.docs/docs/agents/using-tools.md +2 -4
  17. package/.docs/docs/browser/agent-browser.md +1 -3
  18. package/.docs/docs/browser/browser-viewer.md +1 -3
  19. package/.docs/docs/browser/overview.md +2 -1
  20. package/.docs/docs/browser/recording.md +1 -1
  21. package/.docs/docs/browser/stagehand.md +1 -1
  22. package/.docs/docs/capabilities/channels/discord.md +98 -0
  23. package/.docs/docs/capabilities/channels/other-adapters.md +68 -0
  24. package/.docs/docs/capabilities/channels/overview.md +255 -0
  25. package/.docs/docs/capabilities/channels/slack.md +225 -0
  26. package/.docs/docs/capabilities/channels/teams.md +100 -0
  27. package/.docs/docs/capabilities/channels/telegram.md +98 -0
  28. package/.docs/docs/capabilities/channels/whatsapp.md +99 -0
  29. package/.docs/docs/deployment/mastra-server.md +2 -4
  30. package/.docs/docs/editor/overview.md +2 -6
  31. package/.docs/docs/editor/prompts.md +1 -1
  32. package/.docs/docs/editor/tools.md +1 -3
  33. package/.docs/docs/evals/built-in-scorers.md +2 -2
  34. package/.docs/docs/evals/custom-scorers.md +1 -3
  35. package/.docs/docs/evals/datasets/overview.md +4 -5
  36. package/.docs/docs/evals/datasets/running-experiments.md +10 -8
  37. package/.docs/docs/evals/evals-with-memory.md +1 -3
  38. package/.docs/docs/evals/gates-and-verdicts.md +2 -4
  39. package/.docs/docs/evals/overview.md +4 -1
  40. package/.docs/docs/evals/quick-checks.md +3 -5
  41. package/.docs/docs/getting-started/file-based-agents.md +114 -0
  42. package/.docs/docs/getting-started/manual-install.md +17 -4
  43. package/.docs/docs/index.md +1 -1
  44. package/.docs/docs/long-running-agents/background-tasks.md +3 -3
  45. package/.docs/docs/long-running-agents/durable-agents.md +5 -7
  46. package/.docs/docs/long-running-agents/goals.md +5 -7
  47. package/.docs/docs/long-running-agents/schedules.md +1 -1
  48. package/.docs/docs/long-running-agents/signal-providers.md +1 -3
  49. package/.docs/docs/long-running-agents/signals.md +12 -23
  50. package/.docs/docs/mastra-platform/database.md +2 -2
  51. package/.docs/docs/mastra-platform/github.md +1 -1
  52. package/.docs/docs/mastra-platform/observability.md +5 -1
  53. package/.docs/docs/mcp/mcp-apps.md +3 -3
  54. package/.docs/docs/mcp/overview.md +6 -10
  55. package/.docs/docs/memory/memory-processors.md +67 -0
  56. package/.docs/docs/memory/message-history.md +56 -2
  57. package/.docs/docs/memory/observational-memory.md +5 -4
  58. package/.docs/docs/memory/overview.md +8 -6
  59. package/.docs/docs/memory/semantic-recall.md +36 -2
  60. package/.docs/docs/memory/working-memory.md +3 -3
  61. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -3
  62. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
  63. package/.docs/docs/observability/logging.md +1 -1
  64. package/.docs/docs/observability/tracing/overview.md +1 -1
  65. package/.docs/docs/rag/vector-databases.md +7 -2
  66. package/.docs/docs/server/auth/auth0.md +1 -1
  67. package/.docs/docs/server/auth/better-auth.md +2 -2
  68. package/.docs/docs/server/auth/clerk.md +1 -1
  69. package/.docs/docs/server/auth/firebase.md +1 -1
  70. package/.docs/docs/server/auth/google.md +3 -3
  71. package/.docs/docs/server/auth/jwt.md +2 -2
  72. package/.docs/docs/server/auth/okta.md +2 -2
  73. package/.docs/docs/server/auth/workos.md +1 -1
  74. package/.docs/docs/server/mastra-client.md +1 -1
  75. package/.docs/docs/server/mastra-server.md +1 -1
  76. package/.docs/docs/server/pubsub.md +1 -1
  77. package/.docs/docs/server/request-context.md +4 -4
  78. package/.docs/docs/server/server-adapters.md +8 -8
  79. package/.docs/docs/storage/overview.md +214 -0
  80. package/.docs/docs/studio/auth.md +1 -3
  81. package/.docs/docs/studio/overview.md +1 -1
  82. package/.docs/docs/voice/livekit.md +101 -4
  83. package/.docs/docs/workflows/agents-and-tools.md +3 -5
  84. package/.docs/docs/workflows/control-flow.md +1 -3
  85. package/.docs/docs/workflows/overview.md +6 -7
  86. package/.docs/docs/workflows/snapshots.md +1 -1
  87. package/.docs/docs/workspace/overview.md +2 -1
  88. package/.docs/docs/workspace/sandbox.md +2 -0
  89. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  90. package/.docs/guides/build-your-ui/copilotkit/channels.md +1 -1
  91. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +2 -2
  92. package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
  93. package/.docs/guides/concepts/streaming.md +3 -3
  94. package/.docs/guides/getting-started/quickstart.md +4 -2
  95. package/.docs/guides/guide/chef-michel.md +0 -2
  96. package/.docs/guides/guide/slack-assistant.md +2 -2
  97. package/.docs/guides/guide/stock-agent.md +0 -2
  98. package/.docs/models/embeddings.md +119 -0
  99. package/.docs/models/environment-variables.md +3 -0
  100. package/.docs/models/gateways/netlify.md +4 -1
  101. package/.docs/models/gateways/openrouter.md +10 -6
  102. package/.docs/models/gateways/vercel.md +7 -1
  103. package/.docs/models/index.md +1 -1
  104. package/.docs/models/providers/crossmodel.md +109 -0
  105. package/.docs/models/providers/google.md +2 -1
  106. package/.docs/models/providers/llmgateway.md +184 -181
  107. package/.docs/models/providers/meta.md +101 -0
  108. package/.docs/models/providers/nano-gpt.md +2 -2
  109. package/.docs/models/providers/neon.md +40 -29
  110. package/.docs/models/providers/openai.md +5 -1
  111. package/.docs/models/providers/opencode.md +2 -1
  112. package/.docs/models/providers/poolside.md +6 -5
  113. package/.docs/models/providers/routing-run.md +20 -34
  114. package/.docs/models/providers/the-grid-ai.md +3 -3
  115. package/.docs/models/providers/wandb.md +21 -14
  116. package/.docs/models/providers/xai.md +2 -1
  117. package/.docs/models/providers/zenifra.md +73 -0
  118. package/.docs/models/providers.md +3 -0
  119. package/.docs/reference/agent-controller/agent-controller-class.md +3 -3
  120. package/.docs/reference/agent-controller/session.md +4 -4
  121. package/.docs/reference/agents/agent.md +1 -1
  122. package/.docs/reference/agents/channels.md +2 -2
  123. package/.docs/reference/agents/inngest-agent.md +1 -1
  124. package/.docs/reference/agents/listSkills.md +1 -1
  125. package/.docs/reference/agents/listSuspendedRuns.md +3 -3
  126. package/.docs/reference/auth/google.md +5 -5
  127. package/.docs/reference/channels/channel-provider.md +1 -1
  128. package/.docs/reference/channels/slack-provider.md +3 -3
  129. package/.docs/reference/cli/mastra.md +119 -12
  130. package/.docs/reference/code-sdk/mount-agent-controller.md +76 -0
  131. package/.docs/reference/coding-agent/create-coding-agent.md +1 -1
  132. package/.docs/reference/configuration.md +1 -1
  133. package/.docs/reference/evals/checks.md +4 -4
  134. package/.docs/reference/evals/create-scorer.md +8 -0
  135. package/.docs/reference/file-based-agents/config.md +97 -0
  136. package/.docs/reference/file-based-agents/instructions.md +54 -0
  137. package/.docs/reference/file-based-agents/memory.md +58 -0
  138. package/.docs/reference/file-based-agents/observability.md +32 -0
  139. package/.docs/reference/file-based-agents/processors.md +56 -0
  140. package/.docs/reference/file-based-agents/server.md +37 -0
  141. package/.docs/reference/file-based-agents/skills.md +56 -0
  142. package/.docs/reference/file-based-agents/storage.md +30 -0
  143. package/.docs/reference/file-based-agents/studio.md +56 -0
  144. package/.docs/reference/file-based-agents/subagents.md +123 -0
  145. package/.docs/reference/file-based-agents/tools.md +63 -0
  146. package/.docs/reference/file-based-agents/workflows.md +52 -0
  147. package/.docs/reference/file-based-agents/workspace.md +74 -0
  148. package/.docs/reference/index.md +16 -0
  149. package/.docs/reference/memory/memory-class.md +1 -1
  150. package/.docs/reference/memory/observational-memory.md +1 -1
  151. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  152. package/.docs/reference/memory/summarizeConversation.md +99 -0
  153. package/.docs/reference/memory/summarizeThread.md +93 -0
  154. package/.docs/{docs/getting-started → reference}/project-structure.md +3 -10
  155. package/.docs/reference/pubsub/lease-provider.md +5 -5
  156. package/.docs/reference/server/express-adapter.md +1 -3
  157. package/.docs/reference/server/fastify-adapter.md +1 -3
  158. package/.docs/reference/server/hono-adapter.md +1 -3
  159. package/.docs/reference/server/koa-adapter.md +1 -3
  160. package/.docs/reference/server/nestjs-adapter.md +1 -3
  161. package/.docs/reference/signals/task-signal-provider.md +1 -1
  162. package/.docs/reference/storage/clickhouse.md +34 -2
  163. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  164. package/.docs/reference/storage/composite.md +64 -6
  165. package/.docs/reference/storage/convex.md +1 -1
  166. package/.docs/reference/storage/dynamodb.md +1 -1
  167. package/.docs/reference/storage/mongodb.md +46 -46
  168. package/.docs/reference/storage/retention.md +74 -6
  169. package/.docs/reference/tools/create-tool.md +2 -2
  170. package/.docs/reference/tools/mcp-client.md +22 -0
  171. package/.docs/reference/tools/mcp-server.md +161 -4
  172. package/.docs/reference/vectors/mongodb.md +93 -4
  173. package/.docs/reference/voice/livekit.md +272 -8
  174. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +1 -3
  175. package/.docs/reference/workspace/agentfs-filesystem.md +1 -3
  176. package/.docs/reference/workspace/apple-container-sandbox.md +6 -8
  177. package/.docs/reference/workspace/archil-filesystem.md +1 -3
  178. package/.docs/reference/workspace/azure-blob-filesystem.md +1 -3
  179. package/.docs/reference/workspace/blaxel-sandbox.md +1 -3
  180. package/.docs/reference/workspace/daytona-sandbox.md +1 -3
  181. package/.docs/reference/workspace/docker-sandbox.md +1 -3
  182. package/.docs/reference/workspace/e2b-sandbox.md +1 -3
  183. package/.docs/reference/workspace/files-sdk-filesystem.md +1 -3
  184. package/.docs/reference/workspace/gcs-filesystem.md +1 -3
  185. package/.docs/reference/workspace/google-drive-filesystem.md +1 -3
  186. package/.docs/reference/workspace/local-filesystem.md +1 -3
  187. package/.docs/reference/workspace/local-sandbox.md +1 -3
  188. package/.docs/reference/workspace/mesa-filesystem.md +4 -4
  189. package/.docs/reference/workspace/modal-sandbox.md +1 -3
  190. package/.docs/reference/workspace/railway-sandbox.md +2 -4
  191. package/.docs/reference/workspace/s3-filesystem.md +1 -3
  192. package/.docs/reference/workspace/vercel-sandbox.md +5 -7
  193. package/.docs/reference/workspace/vercel-serverless.md +2 -4
  194. package/CHANGELOG.md +29 -0
  195. package/package.json +5 -5
  196. package/.docs/docs/agents/channels.md +0 -225
  197. package/.docs/docs/agents/file-based-agents.md +0 -297
  198. package/.docs/docs/memory/storage.md +0 -267
@@ -0,0 +1,255 @@
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. 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.
198
+
199
+ ## Serverless deployment
200
+
201
+ 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.
202
+
203
+ ### Keep the function alive with `waitUntil`
204
+
205
+ 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.
206
+
207
+ On Vercel, pass `waitUntil` from `@vercel/functions`:
208
+
209
+ ```typescript
210
+ import { Agent } from '@mastra/core/agent'
211
+ import { createSlackAdapter } from '@chat-adapter/slack'
212
+ import { waitUntil } from '@vercel/functions'
213
+
214
+ export const yourAgent = new Agent({
215
+ id: 'your-agent',
216
+ name: 'Your Agent',
217
+ instructions: 'You are a helpful assistant.',
218
+ model: 'openai/gpt-5.5',
219
+ channels: {
220
+ adapters: {
221
+ slack: createSlackAdapter(),
222
+ },
223
+ waitUntil,
224
+ },
225
+ })
226
+ ```
227
+
228
+ 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.
229
+
230
+ ### Coordinate instances with a shared pub/sub
231
+
232
+ 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.
233
+
234
+ Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
235
+
236
+ ```typescript
237
+ import { Mastra } from '@mastra/core'
238
+ import { RedisStreamsPubSub } from '@mastra/redis-streams'
239
+ import { yourAgent } from './agents/your-agent'
240
+
241
+ export const mastra = new Mastra({
242
+ agents: { yourAgent },
243
+ pubsub: new RedisStreamsPubSub({
244
+ url: process.env.REDIS_URL,
245
+ keyPrefix: 'mastra:my-app',
246
+ }),
247
+ })
248
+ ```
249
+
250
+ 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).
251
+
252
+ ## Related
253
+
254
+ - [Channels reference](https://mastra.ai/reference/agents/channels)
255
+ - 📹 [Mastra channels workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)
@@ -0,0 +1,225 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Slack
4
+
5
+ Add your agent to Slack so people can message it in shared channel threads or direct messages. When someone sends a message, Mastra runs your agent through the normal agent pipeline and streams the response back to Slack. The Slack adapter handles Slack AI indicators and interactive cards for you.
6
+
7
+ ## Installation
8
+
9
+ Install the Slack adapter from the Chat SDK:
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @chat-adapter/slack
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @chat-adapter/slack
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @chat-adapter/slack
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @chat-adapter/slack
33
+ ```
34
+
35
+ Add `createSlackAdapter()` to the agent's `channels.adapters` object:
36
+
37
+ ```typescript
38
+ import { Agent } from '@mastra/core/agent'
39
+ import { createSlackAdapter } from '@chat-adapter/slack'
40
+
41
+ export const yourAgent = new Agent({
42
+ id: 'your-agent',
43
+ name: 'Your Agent',
44
+ instructions: 'Help people plan tasks, answer questions, and coordinate work in Slack.',
45
+ model: 'anthropic/claude-opus-4-7',
46
+ channels: {
47
+ adapters: {
48
+ slack: createSlackAdapter(),
49
+ },
50
+ },
51
+ })
52
+ ```
53
+
54
+ ## Create a Slack app
55
+
56
+ To connect your agent, create a Slack app in the workspace where you want it to run. The Slack app controls how your agent appears in Slack, what it can do, and which events it receives.
57
+
58
+ This guide uses a [manifest](https://docs.slack.dev/app-manifests/configuring-apps-with-app-manifests/#creating_manifests): a configuration file that creates the Slack app settings for you. This is the fastest path when you are adding your agent to your own workspace. It doesn't cover the platform OAuth flow where other workspaces install your agent.
59
+
60
+ Create the Slack app from a manifest:
61
+
62
+ 1. Open [api.slack.com/apps](https://api.slack.com/apps).
63
+ 2. Select **Create an app**.
64
+ 3. Select **From a manifest**.
65
+ 4. Choose the workspace where the agent should run.
66
+ 5. Paste this manifest, then select **Create**:
67
+
68
+ ```yaml
69
+ display_information:
70
+ name: mastra-agent
71
+ features:
72
+ app_home:
73
+ home_tab_enabled: false
74
+ messages_tab_enabled: true
75
+ messages_tab_read_only_enabled: false
76
+ bot_user:
77
+ display_name: mastra-agent
78
+ always_online: true
79
+ oauth_config:
80
+ scopes:
81
+ bot:
82
+ - im:write
83
+ - app_mentions:read
84
+ - channels:history
85
+ - channels:read
86
+ - chat:write
87
+ - users:read
88
+ - im:read
89
+ - im:history
90
+ pkce_enabled: false
91
+ settings:
92
+ event_subscriptions:
93
+ request_url: https://<YOUR-PUBLIC-URL>/api/agents/<YOUR-AGENT-ID>/channels/slack/webhook
94
+ bot_events:
95
+ - app_mention
96
+ - message.channels
97
+ - message.im
98
+ interactivity:
99
+ is_enabled: true
100
+ request_url: https://<YOUR-PUBLIC-URL>/api/agents/<YOUR-AGENT-ID>/channels/slack/webhook
101
+ org_deploy_enabled: false
102
+ socket_mode_enabled: false
103
+ token_rotation_enabled: false
104
+ is_mcp_enabled: false
105
+ ```
106
+
107
+ This manifest configures:
108
+
109
+ - `display_information.name` and `features.bot_user.display_name`: Set your agent's name in Slack. You can update it at any time; remember to reinstall the app after changing names or permissions.
110
+ - `app_home.messages_tab_enabled` and `app_home.messages_tab_read_only_enabled`: Enable direct messages from the Slack app's **Messages** tab.
111
+ - `always_online`: Shows the Slack bot user as always available.
112
+ - `oauth_config.scopes.bot`: Grants the bot permission to post messages, read channel messages where it is present, read mentions, read and write direct messages, and look up users.
113
+ - `event_subscriptions`: Tells Slack which message events to send to the webhook.
114
+ - `interactivity`: Enables interactive cards and tells Slack where to send card actions.
115
+
116
+ After the app is created, open **Install App**, select **Install to Workspace**, and approve the requested scopes.
117
+
118
+ ## Set Slack credentials
119
+
120
+ Set the Slack credentials in Mastra so it can verify Slack requests and send messages back to Slack.
121
+
122
+ In the Slack app settings, copy these values:
123
+
124
+ - **Basic Information** > **App Credentials** > **Signing Secret**
125
+ - **OAuth & Permissions** > **Bot User OAuth Token**
126
+
127
+ Set them in your Mastra environment:
128
+
129
+ ```bash
130
+ SLACK_SIGNING_SECRET=your-signing-secret
131
+ SLACK_BOT_TOKEN=xoxb-your-bot-token
132
+ ```
133
+
134
+ Mastra reads these environment variables automatically.
135
+
136
+ ## Configure the webhook route
137
+
138
+ Slack sends channel activity to Mastra through webhooks. A webhook is an HTTP endpoint Slack calls when something happens, such as a new message, a mention, or a user selecting an interactive card.
139
+
140
+ Mastra automatically registers a Slack webhook route for your agent:
141
+
142
+ ```text
143
+ /api/agents/<YOUR-AGENT-ID>/channels/slack/webhook
144
+ ```
145
+
146
+ Build the webhook URL from your public Mastra server URL and the generated route:
147
+
148
+ ```text
149
+ https://<YOUR-PUBLIC-URL>/api/agents/<YOUR-AGENT-ID>/channels/slack/webhook
150
+ ```
151
+
152
+ Slack can't send events to `localhost`. For local development, keep the Mastra dev server running and expose `http://localhost:4111` with a tunnel before you save the request URL in Slack.
153
+
154
+ Use a tunnel such as `cloudflared` or `ngrok` for local development:
155
+
156
+ **npm**:
157
+
158
+ ```bash
159
+ npx cloudflared tunnel --url http://localhost:4111
160
+ ```
161
+
162
+ **pnpm**:
163
+
164
+ ```bash
165
+ pnpm dlx cloudflared tunnel --url http://localhost:4111
166
+ ```
167
+
168
+ **Yarn**:
169
+
170
+ ```bash
171
+ yarn dlx cloudflared tunnel --url http://localhost:4111
172
+ ```
173
+
174
+ **Bun**:
175
+
176
+ ```bash
177
+ bun x cloudflared tunnel --url http://localhost:4111
178
+ ```
179
+
180
+ Use the generated tunnel host as `<YOUR-PUBLIC-URL>`, for example:
181
+
182
+ ```text
183
+ https://abc123.trycloudflare.com/api/agents/your-agent/channels/slack/webhook
184
+ ```
185
+
186
+ Update the request URLs in Slack:
187
+
188
+ 1. In the Slack app settings, open **Event Subscriptions**.
189
+ 2. Replace **Request URL** with the final webhook URL.
190
+ 3. Select **Save Changes**.
191
+ 4. Open **Interactivity & Shortcuts**.
192
+ 5. Replace **Request URL** with the same webhook URL.
193
+ 6. Select **Save Changes**.
194
+ 7. If Slack asks you to reinstall the app, open **OAuth & Permissions** and select **Reinstall to Workspace**.
195
+
196
+ ## Try it in Slack
197
+
198
+ Open a direct message with the Slack bot user and send a message. Direct messages work because the manifest includes the `message.im` event and `im:*` scopes.
199
+
200
+ To use the agent in a channel, invite the Slack bot user first:
201
+
202
+ ```text
203
+ /invite @your-bot-name
204
+ ```
205
+
206
+ Mention the bot in the channel:
207
+
208
+ ```text
209
+ @your-bot-name What can you help me with?
210
+ ```
211
+
212
+ The agent responds in the thread. Response content depends on the model, instructions, memory, and tools configured on the agent.
213
+
214
+ ## Production deployment
215
+
216
+ When you deploy the Mastra server, update both request URLs in the Slack app settings to the production webhook URL. The tunnel URL used for local development is temporary and changes when the tunnel restarts.
217
+
218
+ Channels on serverless platforms may need `waitUntil` and shared pub/sub configuration so background responses and thread leases work across short-lived instances. See [serverless deployment](https://mastra.ai/docs/capabilities/channels/overview) in the channels overview.
219
+
220
+ ## Related
221
+
222
+ - [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
223
+ - [More](https://mastra.ai/docs/capabilities/channels/other-adapters)
224
+ - [Channels reference](https://mastra.ai/reference/agents/channels)
225
+ - [Deployment overview](https://mastra.ai/docs/deployment/overview)
@@ -0,0 +1,100 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Microsoft Teams
4
+
5
+ Microsoft Teams channels let a Mastra agent receive mentions and conversation events from Teams. Mastra handles the agent wiring and webhook route; the Chat SDK Teams adapter docs cover Teams app setup, authentication, and permissions.
6
+
7
+ ## Install the adapter
8
+
9
+ Install the Teams adapter from the Chat SDK:
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @chat-adapter/teams
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @chat-adapter/teams
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @chat-adapter/teams
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @chat-adapter/teams
33
+ ```
34
+
35
+ ## Agent configuration
36
+
37
+ Add `createTeamsAdapter()` to the agent's `channels.adapters` object:
38
+
39
+ ```typescript
40
+ import { Agent } from '@mastra/core/agent'
41
+ import { createTeamsAdapter } from '@chat-adapter/teams'
42
+
43
+ export const teamsAgent = new Agent({
44
+ id: 'teams-agent',
45
+ name: 'Teams Agent',
46
+ instructions: 'Answer questions and help with tasks in Microsoft Teams.',
47
+ model: 'openai/gpt-5.5',
48
+ channels: {
49
+ adapters: {
50
+ teams: createTeamsAdapter({
51
+ appType: 'SingleTenant',
52
+ }),
53
+ },
54
+ },
55
+ })
56
+ ```
57
+
58
+ Register the agent on the Mastra instance:
59
+
60
+ ```typescript
61
+ import { Mastra } from '@mastra/core'
62
+ import { teamsAgent } from './agents/teams-agent'
63
+
64
+ export const mastra = new Mastra({
65
+ agents: { teamsAgent },
66
+ })
67
+ ```
68
+
69
+ ## Adapter setup
70
+
71
+ Follow the [Chat SDK Teams adapter docs](https://chat-sdk.dev/adapters/official/teams) for Teams-specific setup, including Azure bot registration, Teams CLI usage, authentication options, and required permissions.
72
+
73
+ The adapter reads Teams credentials from environment variables such as:
74
+
75
+ ```bash
76
+ TEAMS_APP_ID=your-azure-bot-app-id
77
+ TEAMS_APP_PASSWORD=your-azure-bot-app-password
78
+ TEAMS_APP_TENANT_ID=your-azure-tenant-id
79
+ ```
80
+
81
+ ## Webhook URL
82
+
83
+ Mastra generates the Teams webhook route from the agent ID and adapter key:
84
+
85
+ ```text
86
+ /api/agents/teams-agent/channels/teams/webhook
87
+ ```
88
+
89
+ Use your public Mastra server URL as the base URL:
90
+
91
+ ```text
92
+ https://your-app.example.com/api/agents/teams-agent/channels/teams/webhook
93
+ ```
94
+
95
+ Use this URL anywhere the Teams adapter docs ask for the bot endpoint or webhook URL. For local development, expose the Mastra dev server with a tunnel and use the tunnel URL as the base URL.
96
+
97
+ ## Related
98
+
99
+ - [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
100
+ - [More](https://mastra.ai/docs/capabilities/channels/other-adapters)
@@ -0,0 +1,98 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Telegram
4
+
5
+ Telegram channels let a Mastra agent receive direct messages, group messages, and bot mentions from Telegram. Mastra handles the agent wiring and webhook route; the Chat SDK Telegram adapter docs cover bot setup, webhook registration, and polling behavior.
6
+
7
+ ## Install the adapter
8
+
9
+ Install the Telegram adapter from the Chat SDK:
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @chat-adapter/telegram
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @chat-adapter/telegram
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @chat-adapter/telegram
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @chat-adapter/telegram
33
+ ```
34
+
35
+ ## Agent configuration
36
+
37
+ Add `createTelegramAdapter()` to the agent's `channels.adapters` object:
38
+
39
+ ```typescript
40
+ import { Agent } from '@mastra/core/agent'
41
+ import { createTelegramAdapter } from '@chat-adapter/telegram'
42
+
43
+ export const telegramAgent = new Agent({
44
+ id: 'telegram-agent',
45
+ name: 'Telegram Agent',
46
+ instructions: 'Answer questions and help with tasks in Telegram.',
47
+ model: 'openai/gpt-5.5',
48
+ channels: {
49
+ adapters: {
50
+ telegram: createTelegramAdapter(),
51
+ },
52
+ },
53
+ })
54
+ ```
55
+
56
+ Register the agent on the Mastra instance:
57
+
58
+ ```typescript
59
+ import { Mastra } from '@mastra/core'
60
+ import { telegramAgent } from './agents/telegram-agent'
61
+
62
+ export const mastra = new Mastra({
63
+ agents: { telegramAgent },
64
+ })
65
+ ```
66
+
67
+ ## Adapter setup
68
+
69
+ Follow the [Chat SDK Telegram adapter docs](https://chat-sdk.dev/adapters/official/telegram) for Telegram-specific setup, including BotFather, webhook registration, secret tokens, and polling mode.
70
+
71
+ The adapter reads Telegram credentials from environment variables such as:
72
+
73
+ ```bash
74
+ TELEGRAM_BOT_TOKEN=your-telegram-bot-token
75
+ TELEGRAM_WEBHOOK_SECRET_TOKEN=your-webhook-secret-token
76
+ TELEGRAM_BOT_USERNAME=your_bot_username
77
+ ```
78
+
79
+ ## Webhook URL
80
+
81
+ Mastra generates the Telegram webhook route from the agent ID and adapter key:
82
+
83
+ ```text
84
+ /api/agents/telegram-agent/channels/telegram/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/telegram-agent/channels/telegram/webhook
91
+ ```
92
+
93
+ Use this URL anywhere the Telegram adapter docs ask for the webhook URL. Telegram also supports polling mode; follow the Chat SDK adapter docs if you want to use polling for local development.
94
+
95
+ ## Related
96
+
97
+ - [Channels overview](https://mastra.ai/docs/capabilities/channels/overview)
98
+ - [More](https://mastra.ai/docs/capabilities/channels/other-adapters)