@mastra/mcp-docs-server 0.0.0-error-handler-fix-20251020202607 → 0.0.0-esbuild-bundle-worker-20260807182016

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 (1526) hide show
  1. package/.docs/course/01-first-agent/04-project-structure.md +19 -0
  2. package/.docs/course/01-first-agent/05-running-playground.md +19 -0
  3. package/.docs/course/01-first-agent/07-creating-your-agent.md +50 -0
  4. package/.docs/course/01-first-agent/08-exporting-your-agent.md +34 -0
  5. package/.docs/course/01-first-agent/09-testing-your-agent.md +12 -0
  6. package/.docs/course/01-first-agent/11-creating-transactions-tool.md +41 -0
  7. package/.docs/course/01-first-agent/12-connecting-tool-to-agent.md +29 -0
  8. package/.docs/course/01-first-agent/13-testing-your-tool.md +15 -0
  9. package/.docs/course/01-first-agent/15-installing-memory.md +13 -0
  10. package/.docs/course/01-first-agent/16-adding-memory-to-agent.md +33 -0
  11. package/.docs/course/01-first-agent/17-testing-memory.md +15 -0
  12. package/.docs/course/02-agent-tools-mcp/03-setting-up-mcp-configuration.md +21 -0
  13. package/.docs/course/02-agent-tools-mcp/04-initializing-mcp-tools.md +11 -0
  14. package/.docs/course/02-agent-tools-mcp/05-updating-your-agent.md +20 -0
  15. package/.docs/course/02-agent-tools-mcp/07-what-is-zapier-mcp.md +23 -0
  16. package/.docs/course/02-agent-tools-mcp/08-getting-zapier-mcp-url.md +21 -0
  17. package/.docs/course/02-agent-tools-mcp/09-updating-mcp-config-zapier.md +29 -0
  18. package/.docs/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +29 -0
  19. package/.docs/course/02-agent-tools-mcp/12-troubleshooting-zapier.md +19 -0
  20. package/.docs/course/02-agent-tools-mcp/13-what-is-github-mcp.md +14 -0
  21. package/.docs/course/02-agent-tools-mcp/14-getting-github-mcp-url.md +40 -0
  22. package/.docs/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +36 -0
  23. package/.docs/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +33 -0
  24. package/.docs/course/02-agent-tools-mcp/18-troubleshooting-github.md +17 -0
  25. package/.docs/course/02-agent-tools-mcp/20-updating-mcp-config-hackernews.md +36 -0
  26. package/.docs/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +38 -0
  27. package/.docs/course/02-agent-tools-mcp/26-updating-mcp-config-filesystem.md +43 -0
  28. package/.docs/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +45 -0
  29. package/.docs/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +78 -0
  30. package/.docs/course/02-agent-tools-mcp/32-conclusion.md +17 -0
  31. package/.docs/course/03-agent-memory/03-installing-memory.md +13 -0
  32. package/.docs/course/03-agent-memory/04-creating-basic-memory-agent.md +36 -0
  33. package/.docs/course/03-agent-memory/05-updating-mastra-export.md +18 -0
  34. package/.docs/course/03-agent-memory/07-understanding-memory-threads.md +49 -0
  35. package/.docs/course/03-agent-memory/08-configuring-conversation-history.md +36 -0
  36. package/.docs/course/03-agent-memory/09-using-memory-in-application.md +19 -0
  37. package/.docs/course/03-agent-memory/10-storage-configuration.md +29 -0
  38. package/.docs/course/03-agent-memory/12-handling-memory-frontend.md +62 -0
  39. package/.docs/course/03-agent-memory/13-vector-store-configuration.md +29 -0
  40. package/.docs/course/03-agent-memory/16-configuring-semantic-recall.md +42 -0
  41. package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +73 -0
  42. package/.docs/course/03-agent-memory/21-configuring-working-memory.md +64 -0
  43. package/.docs/course/03-agent-memory/22-custom-working-memory-templates.md +89 -0
  44. package/.docs/course/03-agent-memory/25-combining-memory-features.md +80 -0
  45. package/.docs/course/03-agent-memory/26-updating-mastra-export-comprehensive.md +0 -0
  46. package/.docs/course/03-agent-memory/27-creating-learning-assistant.md +103 -0
  47. package/.docs/course/04-workflows/01-introduction-to-workflows.md +44 -0
  48. package/.docs/course/04-workflows/02-understanding-steps.md +53 -0
  49. package/.docs/course/04-workflows/03-creating-your-first-step.md +57 -0
  50. package/.docs/course/04-workflows/04-creating-a-second-step.md +58 -0
  51. package/.docs/course/04-workflows/05-chaining-steps-together.md +57 -0
  52. package/.docs/course/04-workflows/06-registering-with-mastra.md +24 -0
  53. package/.docs/course/04-workflows/07-using-playground.md +58 -0
  54. package/.docs/course/04-workflows/08-running-workflows-programmatically.md +73 -0
  55. package/.docs/course/04-workflows/09-adding-a-third-step.md +68 -0
  56. package/.docs/course/04-workflows/10-updating-the-workflow.md +55 -0
  57. package/.docs/course/04-workflows/11-creating-an-ai-agent.md +66 -0
  58. package/.docs/course/04-workflows/12-using-agent-in-workflow.md +89 -0
  59. package/.docs/course/04-workflows/13-creating-ai-enhanced-workflow.md +72 -0
  60. package/.docs/course/04-workflows/14-understanding-parallel-execution.md +38 -0
  61. package/.docs/course/04-workflows/15-creating-parallel-steps.md +111 -0
  62. package/.docs/course/04-workflows/16-building-parallel-workflow.md +100 -0
  63. package/.docs/course/04-workflows/17-testing-parallel-performance.md +36 -0
  64. package/.docs/course/04-workflows/18-understanding-conditional-branching.md +61 -0
  65. package/.docs/course/04-workflows/19-creating-conditional-steps.md +124 -0
  66. package/.docs/course/04-workflows/20-building-conditional-workflow.md +55 -0
  67. package/.docs/course/04-workflows/21-testing-conditional-logic.md +58 -0
  68. package/.docs/docs/agents/a2a.md +340 -0
  69. package/.docs/docs/agents/acp.md +156 -0
  70. package/.docs/docs/agents/agent-approval.md +664 -0
  71. package/.docs/docs/agents/code-mode.md +172 -0
  72. package/.docs/docs/agents/guardrails.md +390 -0
  73. package/.docs/docs/agents/networks.md +184 -0
  74. package/.docs/docs/agents/overview.md +220 -0
  75. package/.docs/docs/agents/processors.md +982 -0
  76. package/.docs/docs/agents/sdk-agents.md +427 -0
  77. package/.docs/docs/agents/skills.md +186 -0
  78. package/.docs/docs/agents/structured-output.md +338 -0
  79. package/.docs/docs/agents/using-tools.md +624 -0
  80. package/.docs/docs/browser/agent-browser.md +110 -0
  81. package/.docs/docs/browser/browser-viewer.md +151 -0
  82. package/.docs/docs/browser/firecrawl.md +129 -0
  83. package/.docs/docs/browser/overview.md +187 -0
  84. package/.docs/docs/browser/recording.md +120 -0
  85. package/.docs/docs/browser/stagehand.md +172 -0
  86. package/.docs/docs/capabilities/channels/discord.md +98 -0
  87. package/.docs/docs/capabilities/channels/imessage.md +181 -0
  88. package/.docs/docs/capabilities/channels/other-adapters.md +68 -0
  89. package/.docs/docs/capabilities/channels/overview.md +262 -0
  90. package/.docs/docs/capabilities/channels/slack.md +335 -0
  91. package/.docs/docs/capabilities/channels/teams.md +100 -0
  92. package/.docs/docs/capabilities/channels/telegram.md +98 -0
  93. package/.docs/docs/capabilities/channels/whatsapp.md +99 -0
  94. package/.docs/docs/capabilities/subagents.md +454 -0
  95. package/.docs/docs/connections/overview.md +94 -0
  96. package/.docs/docs/datasets/overview.md +209 -0
  97. package/.docs/docs/datasets/running-experiments.md +455 -0
  98. package/.docs/docs/deployment/cloud-providers.md +23 -0
  99. package/.docs/docs/deployment/mastra-server.md +157 -0
  100. package/.docs/docs/deployment/monorepo.md +140 -0
  101. package/.docs/docs/deployment/overview.md +79 -0
  102. package/.docs/docs/deployment/sandbox.md +373 -0
  103. package/.docs/docs/deployment/web-framework.md +54 -0
  104. package/.docs/docs/deployment/workers.md +137 -0
  105. package/.docs/docs/deployment/workflow-runners.md +17 -0
  106. package/.docs/docs/editor/overview.md +349 -0
  107. package/.docs/docs/evals/built-in-scorers.md +66 -0
  108. package/.docs/docs/evals/custom-scorers.md +579 -0
  109. package/.docs/docs/evals/evals-with-memory.md +146 -0
  110. package/.docs/docs/evals/gates-and-verdicts.md +157 -0
  111. package/.docs/docs/evals/multi-turn.md +178 -0
  112. package/.docs/docs/evals/overview.md +163 -0
  113. package/.docs/docs/evals/quick-checks.md +137 -0
  114. package/.docs/docs/evals/running-in-ci.md +121 -0
  115. package/.docs/docs/getting-started/develop.md +198 -0
  116. package/.docs/docs/harness/agent-controller.md +376 -0
  117. package/.docs/docs/harness/overview.md +26 -0
  118. package/.docs/docs/index.md +246 -0
  119. package/.docs/docs/license.md +66 -0
  120. package/.docs/docs/long-running-agents/background-tasks.md +382 -0
  121. package/.docs/docs/long-running-agents/durable-agents.md +273 -0
  122. package/.docs/docs/long-running-agents/goals.md +118 -0
  123. package/.docs/docs/long-running-agents/schedules.md +201 -0
  124. package/.docs/docs/long-running-agents/signal-providers.md +224 -0
  125. package/.docs/docs/long-running-agents/signals.md +426 -0
  126. package/.docs/docs/mastra-platform/configuration.md +69 -0
  127. package/.docs/docs/mastra-platform/database.md +203 -0
  128. package/.docs/docs/mastra-platform/deploy.md +155 -0
  129. package/.docs/docs/mastra-platform/environments.md +108 -0
  130. package/.docs/docs/mastra-platform/github.md +135 -0
  131. package/.docs/docs/mastra-platform/observability.md +127 -0
  132. package/.docs/docs/mastra-platform/overview.md +43 -0
  133. package/.docs/docs/mastra-platform/regions.md +73 -0
  134. package/.docs/docs/mastra-platform/server.md +260 -0
  135. package/.docs/docs/mastra-platform/studio.md +87 -0
  136. package/.docs/docs/mastra-platform/trace-intelligence.md +123 -0
  137. package/.docs/docs/mastra-platform/workspaces.md +152 -0
  138. package/.docs/docs/mcp/overview.md +371 -0
  139. package/.docs/docs/memory/memory-processors.md +385 -0
  140. package/.docs/docs/memory/message-history.md +348 -0
  141. package/.docs/docs/memory/multi-user-threads.md +208 -0
  142. package/.docs/docs/memory/observational-memory.md +835 -0
  143. package/.docs/docs/memory/overview.md +266 -0
  144. package/.docs/docs/memory/semantic-recall.md +401 -0
  145. package/.docs/docs/memory/working-memory.md +431 -0
  146. package/.docs/docs/observability/feedback.md +156 -0
  147. package/.docs/docs/observability/integrations/bridges/datadog.md +219 -0
  148. package/.docs/docs/observability/integrations/bridges/otel.md +234 -0
  149. package/.docs/docs/observability/integrations/exporters/arize.md +274 -0
  150. package/.docs/docs/observability/integrations/exporters/arthur.md +165 -0
  151. package/.docs/docs/observability/integrations/exporters/braintrust.md +197 -0
  152. package/.docs/docs/observability/integrations/exporters/confident-ai.md +140 -0
  153. package/.docs/docs/observability/integrations/exporters/datadog.md +321 -0
  154. package/.docs/docs/observability/integrations/exporters/laminar.md +110 -0
  155. package/.docs/docs/observability/integrations/exporters/langfuse.md +279 -0
  156. package/.docs/docs/observability/integrations/exporters/langsmith.md +200 -0
  157. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +201 -0
  158. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +246 -0
  159. package/.docs/docs/observability/integrations/exporters/otel.md +596 -0
  160. package/.docs/docs/observability/integrations/exporters/posthog.md +166 -0
  161. package/.docs/docs/observability/integrations/exporters/sentry.md +210 -0
  162. package/.docs/docs/observability/integrations/overview.md +47 -0
  163. package/.docs/docs/observability/integrations/processors/sensitive-data-filter.md +302 -0
  164. package/.docs/docs/observability/logging.md +158 -0
  165. package/.docs/docs/observability/metrics/overview.md +119 -0
  166. package/.docs/docs/observability/metrics/querying.md +314 -0
  167. package/.docs/docs/observability/overview.md +240 -0
  168. package/.docs/docs/observability/tracing/overview.md +898 -0
  169. package/.docs/docs/server/auth/auth0.md +262 -0
  170. package/.docs/docs/server/auth/better-auth.md +222 -0
  171. package/.docs/docs/server/auth/clerk.md +154 -0
  172. package/.docs/docs/server/auth/composite-auth.md +230 -0
  173. package/.docs/docs/server/auth/custom-auth-provider.md +513 -0
  174. package/.docs/docs/server/auth/fga.md +303 -0
  175. package/.docs/docs/server/auth/firebase.md +294 -0
  176. package/.docs/docs/server/auth/google.md +283 -0
  177. package/.docs/docs/server/auth/jwt.md +116 -0
  178. package/.docs/docs/server/auth/okta.md +227 -0
  179. package/.docs/docs/server/auth/simple-auth.md +174 -0
  180. package/.docs/docs/server/auth/supabase.md +139 -0
  181. package/.docs/docs/server/auth/workers.md +135 -0
  182. package/.docs/docs/server/auth/workos.md +271 -0
  183. package/.docs/docs/server/auth.md +43 -0
  184. package/.docs/docs/server/custom-adapters.md +382 -0
  185. package/.docs/docs/server/custom-api-routes.md +340 -0
  186. package/.docs/docs/server/mastra-client.md +323 -0
  187. package/.docs/docs/server/mastra-server.md +105 -0
  188. package/.docs/docs/server/middleware.md +243 -0
  189. package/.docs/docs/server/pubsub.md +129 -0
  190. package/.docs/docs/server/request-context.md +486 -0
  191. package/.docs/docs/server/server-adapters.md +649 -0
  192. package/.docs/docs/storage/overview.md +214 -0
  193. package/.docs/docs/studio/auth.md +162 -0
  194. package/.docs/docs/studio/deployment.md +266 -0
  195. package/.docs/docs/studio/observability.md +119 -0
  196. package/.docs/docs/studio/overview.md +139 -0
  197. package/.docs/docs/workflows/agents-and-tools.md +192 -0
  198. package/.docs/docs/workflows/control-flow.md +864 -0
  199. package/.docs/docs/workflows/error-handling.md +362 -0
  200. package/.docs/docs/workflows/human-in-the-loop.md +217 -0
  201. package/.docs/docs/workflows/overview.md +549 -0
  202. package/.docs/docs/workflows/scheduled-workflows.md +185 -0
  203. package/.docs/docs/workflows/snapshots.md +240 -0
  204. package/.docs/docs/workflows/stored-workflows.md +146 -0
  205. package/.docs/docs/workflows/suspend-and-resume.md +234 -0
  206. package/.docs/docs/workflows/time-travel.md +313 -0
  207. package/.docs/docs/workflows/workflow-state.md +183 -0
  208. package/.docs/docs/workspace/filesystem.md +238 -0
  209. package/.docs/docs/workspace/lsp.md +190 -0
  210. package/.docs/docs/workspace/overview.md +415 -0
  211. package/.docs/docs/workspace/sandbox.md +246 -0
  212. package/.docs/docs/workspace/search.md +284 -0
  213. package/.docs/docs/workspace/skills.md +204 -0
  214. package/.docs/guides/agent-frameworks/ai-sdk.md +142 -0
  215. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1571 -0
  216. package/.docs/guides/build-your-ui/assistant-ui.md +158 -0
  217. package/.docs/guides/build-your-ui/copilotkit/channels.md +86 -0
  218. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +174 -0
  219. package/.docs/guides/build-your-ui/copilotkit/overview.md +411 -0
  220. package/.docs/guides/build-your-ui/openui.md +291 -0
  221. package/.docs/guides/concepts/multi-agent-systems.md +77 -0
  222. package/.docs/guides/concepts/streaming.md +319 -0
  223. package/.docs/guides/deployment/amazon-ec2.md +132 -0
  224. package/.docs/guides/deployment/aws-bedrock-agentcore.md +434 -0
  225. package/.docs/guides/deployment/aws-lambda.md +161 -0
  226. package/.docs/guides/deployment/azure-app-services.md +93 -0
  227. package/.docs/guides/deployment/cloudflare.md +101 -0
  228. package/.docs/guides/deployment/digital-ocean.md +170 -0
  229. package/.docs/guides/deployment/inngest.md +805 -0
  230. package/.docs/guides/deployment/kubernetes.md +300 -0
  231. package/.docs/guides/deployment/mastra-workers.md +576 -0
  232. package/.docs/guides/deployment/netlify.md +94 -0
  233. package/.docs/guides/deployment/temporal.md +234 -0
  234. package/.docs/guides/deployment/vercel.md +123 -0
  235. package/.docs/guides/getting-started/astro.md +400 -0
  236. package/.docs/guides/getting-started/electron.md +506 -0
  237. package/.docs/guides/getting-started/express.md +253 -0
  238. package/.docs/guides/getting-started/hono.md +192 -0
  239. package/.docs/guides/getting-started/manual-install.md +250 -0
  240. package/.docs/guides/getting-started/nestjs.md +240 -0
  241. package/.docs/guides/getting-started/next-js.md +345 -0
  242. package/.docs/guides/getting-started/nuxt.md +499 -0
  243. package/.docs/guides/getting-started/quickstart.md +88 -0
  244. package/.docs/guides/getting-started/sveltekit.md +298 -0
  245. package/.docs/guides/getting-started/vite-react.md +427 -0
  246. package/.docs/guides/guide/ai-recruiter.md +228 -0
  247. package/.docs/guides/guide/chef-michel.md +211 -0
  248. package/.docs/guides/guide/code-review-bot.md +228 -0
  249. package/.docs/guides/guide/coding-agent.md +392 -0
  250. package/.docs/guides/guide/dev-assistant.md +309 -0
  251. package/.docs/guides/guide/docs-manager.md +240 -0
  252. package/.docs/guides/guide/firecrawl.md +154 -0
  253. package/.docs/guides/guide/github-actions-pr-description.md +238 -0
  254. package/.docs/guides/guide/notes-mcp-server.md +418 -0
  255. package/.docs/guides/guide/publishing-mcp-server.md +137 -0
  256. package/.docs/guides/guide/research-assistant.md +350 -0
  257. package/.docs/guides/guide/research-coordinator.md +418 -0
  258. package/.docs/guides/guide/signal-provider.md +221 -0
  259. package/.docs/guides/guide/slack-assistant.md +193 -0
  260. package/.docs/guides/guide/stock-agent.md +132 -0
  261. package/.docs/guides/guide/web-search.md +322 -0
  262. package/.docs/guides/guide/whatsapp-chat-bot.md +407 -0
  263. package/.docs/guides/index.md +24 -0
  264. package/.docs/guides/migrations/agentnetwork.md +100 -0
  265. package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +114 -0
  266. package/.docs/guides/migrations/mastra-cloud.md +389 -0
  267. package/.docs/guides/migrations/network-to-supervisor.md +263 -0
  268. package/.docs/guides/migrations/upgrade-to-v1/agent.md +429 -0
  269. package/.docs/guides/migrations/upgrade-to-v1/cli.md +59 -0
  270. package/.docs/guides/migrations/upgrade-to-v1/client.md +339 -0
  271. package/.docs/guides/migrations/upgrade-to-v1/deployment.md +50 -0
  272. package/.docs/guides/migrations/upgrade-to-v1/evals.md +241 -0
  273. package/.docs/guides/migrations/upgrade-to-v1/mastra.md +145 -0
  274. package/.docs/guides/migrations/upgrade-to-v1/mcp.md +99 -0
  275. package/.docs/guides/migrations/upgrade-to-v1/memory.md +288 -0
  276. package/.docs/guides/migrations/upgrade-to-v1/overview.md +125 -0
  277. package/.docs/guides/migrations/upgrade-to-v1/processors.md +70 -0
  278. package/.docs/guides/migrations/upgrade-to-v1/rag.md +44 -0
  279. package/.docs/guides/migrations/upgrade-to-v1/storage.md +555 -0
  280. package/.docs/guides/migrations/upgrade-to-v1/tools.md +182 -0
  281. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +420 -0
  282. package/.docs/guides/migrations/upgrade-to-v1/vectors.md +89 -0
  283. package/.docs/guides/migrations/upgrade-to-v1/voice.md +33 -0
  284. package/.docs/guides/migrations/upgrade-to-v1/workflows.md +343 -0
  285. package/.docs/guides/migrations/vnext-to-standard-apis.md +362 -0
  286. package/.docs/guides/rag/chunking-and-embedding.md +185 -0
  287. package/.docs/guides/rag/graph-rag.md +217 -0
  288. package/.docs/guides/rag/overview.md +74 -0
  289. package/.docs/guides/rag/retrieval.md +520 -0
  290. package/.docs/guides/rag/vector-databases.md +669 -0
  291. package/.docs/guides/voice/overview.md +1257 -0
  292. package/.docs/guides/voice/realtime-voice.md +430 -0
  293. package/.docs/guides/voice/speech-to-speech.md +279 -0
  294. package/.docs/guides/voice/speech-to-text.md +99 -0
  295. package/.docs/guides/voice/text-to-speech.md +105 -0
  296. package/.docs/models/embeddings.md +281 -0
  297. package/.docs/models/environment-variables.md +176 -0
  298. package/.docs/models/gateways/azure-openai.md +240 -0
  299. package/.docs/models/gateways/custom-gateways.md +609 -0
  300. package/.docs/models/gateways/mastra.md +74 -0
  301. package/.docs/models/gateways/neon.md +74 -0
  302. package/.docs/models/gateways/netlify.md +106 -0
  303. package/.docs/models/gateways/openrouter.md +377 -0
  304. package/.docs/models/gateways/vercel.md +360 -0
  305. package/.docs/models/gateways.md +18 -0
  306. package/.docs/models/index.md +342 -0
  307. package/.docs/models/providers/302ai.md +169 -0
  308. package/.docs/models/providers/abacus.md +167 -0
  309. package/.docs/models/providers/abliteration-ai.md +74 -0
  310. package/.docs/models/providers/agentrouter.md +92 -0
  311. package/.docs/models/providers/ai-router.md +77 -0
  312. package/.docs/models/providers/aiand.md +80 -0
  313. package/.docs/models/providers/aihubmix.md +35 -0
  314. package/.docs/models/providers/aki-io.md +78 -0
  315. package/.docs/models/providers/alibaba-cn.md +158 -0
  316. package/.docs/models/providers/alibaba-coding-plan-cn.md +84 -0
  317. package/.docs/models/providers/alibaba-coding-plan.md +84 -0
  318. package/.docs/models/providers/alibaba-token-plan-cn.md +96 -0
  319. package/.docs/models/providers/alibaba-token-plan.md +96 -0
  320. package/.docs/models/providers/alibaba.md +124 -0
  321. package/.docs/models/providers/amazon-bedrock.md +35 -0
  322. package/.docs/models/providers/ambient.md +82 -0
  323. package/.docs/models/providers/anthropic.md +160 -0
  324. package/.docs/models/providers/anyapi.md +101 -0
  325. package/.docs/models/providers/atomic-chat.md +77 -0
  326. package/.docs/models/providers/auriko.md +87 -0
  327. package/.docs/models/providers/azure.md +35 -0
  328. package/.docs/models/providers/bailing.md +74 -0
  329. package/.docs/models/providers/baseten.md +88 -0
  330. package/.docs/models/providers/berget.md +81 -0
  331. package/.docs/models/providers/blueclaw.md +74 -0
  332. package/.docs/models/providers/cerebras.md +102 -0
  333. package/.docs/models/providers/chutes.md +85 -0
  334. package/.docs/models/providers/clarifai.md +84 -0
  335. package/.docs/models/providers/claudinio.md +74 -0
  336. package/.docs/models/providers/cline-pass.md +83 -0
  337. package/.docs/models/providers/cloudferro-sherlock.md +77 -0
  338. package/.docs/models/providers/cloudflare-ai-gateway.md +35 -0
  339. package/.docs/models/providers/cloudflare-workers-ai.md +95 -0
  340. package/.docs/models/providers/cohere.md +35 -0
  341. package/.docs/models/providers/cortecs.md +175 -0
  342. package/.docs/models/providers/crof.md +98 -0
  343. package/.docs/models/providers/crossmodel.md +122 -0
  344. package/.docs/models/providers/daoxe.md +81 -0
  345. package/.docs/models/providers/databricks.md +103 -0
  346. package/.docs/models/providers/deepinfra.md +145 -0
  347. package/.docs/models/providers/deepseek.md +96 -0
  348. package/.docs/models/providers/digitalocean.md +155 -0
  349. package/.docs/models/providers/dinference.md +78 -0
  350. package/.docs/models/providers/drun.md +75 -0
  351. package/.docs/models/providers/ebcloud.md +76 -0
  352. package/.docs/models/providers/empiriolabs.md +112 -0
  353. package/.docs/models/providers/evroc.md +88 -0
  354. package/.docs/models/providers/fastrouter.md +119 -0
  355. package/.docs/models/providers/firepass.md +73 -0
  356. package/.docs/models/providers/fireworks-ai.md +89 -0
  357. package/.docs/models/providers/firmware.md +98 -0
  358. package/.docs/models/providers/freemodel.md +110 -0
  359. package/.docs/models/providers/friendli.md +77 -0
  360. package/.docs/models/providers/frogbot.md +98 -0
  361. package/.docs/models/providers/github-models.md +127 -0
  362. package/.docs/models/providers/gmicloud.md +85 -0
  363. package/.docs/models/providers/google-vertex.md +35 -0
  364. package/.docs/models/providers/google.md +183 -0
  365. package/.docs/models/providers/greenpt.md +107 -0
  366. package/.docs/models/providers/groq.md +115 -0
  367. package/.docs/models/providers/helicone.md +162 -0
  368. package/.docs/models/providers/hetzner.md +73 -0
  369. package/.docs/models/providers/hpc-ai.md +81 -0
  370. package/.docs/models/providers/huggingface.md +132 -0
  371. package/.docs/models/providers/hyper.md +94 -0
  372. package/.docs/models/providers/iflowcn.md +86 -0
  373. package/.docs/models/providers/impossibl.md +148 -0
  374. package/.docs/models/providers/inception.md +74 -0
  375. package/.docs/models/providers/inceptron.md +78 -0
  376. package/.docs/models/providers/inference.md +81 -0
  377. package/.docs/models/providers/inferx.md +78 -0
  378. package/.docs/models/providers/infomaniak.md +83 -0
  379. package/.docs/models/providers/io-intelligence.md +89 -0
  380. package/.docs/models/providers/io-net.md +89 -0
  381. package/.docs/models/providers/jiekou.md +133 -0
  382. package/.docs/models/providers/kenari.md +110 -0
  383. package/.docs/models/providers/kilo.md +417 -0
  384. package/.docs/models/providers/kimi-for-coding.md +104 -0
  385. package/.docs/models/providers/kiro.md +112 -0
  386. package/.docs/models/providers/kuae-cloud-coding-plan.md +73 -0
  387. package/.docs/models/providers/lilac.md +76 -0
  388. package/.docs/models/providers/llama.md +79 -0
  389. package/.docs/models/providers/llmgateway.md +258 -0
  390. package/.docs/models/providers/llmtr.md +78 -0
  391. package/.docs/models/providers/lmstudio.md +75 -0
  392. package/.docs/models/providers/longcat.md +73 -0
  393. package/.docs/models/providers/lucidquery.md +76 -0
  394. package/.docs/models/providers/lynkr.md +73 -0
  395. package/.docs/models/providers/meganova.md +91 -0
  396. package/.docs/models/providers/meta.md +103 -0
  397. package/.docs/models/providers/minimax-cn-coding-plan.md +107 -0
  398. package/.docs/models/providers/minimax-cn.md +107 -0
  399. package/.docs/models/providers/minimax-coding-plan.md +107 -0
  400. package/.docs/models/providers/minimax.md +109 -0
  401. package/.docs/models/providers/mistral.md +125 -0
  402. package/.docs/models/providers/mixlayer.md +77 -0
  403. package/.docs/models/providers/moark.md +74 -0
  404. package/.docs/models/providers/modal.md +74 -0
  405. package/.docs/models/providers/model-oracle-ai.md +87 -0
  406. package/.docs/models/providers/modelis.md +81 -0
  407. package/.docs/models/providers/modelscope.md +79 -0
  408. package/.docs/models/providers/moonshotai-cn.md +82 -0
  409. package/.docs/models/providers/moonshotai.md +82 -0
  410. package/.docs/models/providers/morph.md +75 -0
  411. package/.docs/models/providers/nano-gpt.md +688 -0
  412. package/.docs/models/providers/nearai.md +109 -0
  413. package/.docs/models/providers/nebius.md +94 -0
  414. package/.docs/models/providers/neuralwatt.md +93 -0
  415. package/.docs/models/providers/nova.md +74 -0
  416. package/.docs/models/providers/novita-ai.md +179 -0
  417. package/.docs/models/providers/nvidia.md +168 -0
  418. package/.docs/models/providers/ofox.md +141 -0
  419. package/.docs/models/providers/ollama-cloud.md +92 -0
  420. package/.docs/models/providers/ollama.md +35 -0
  421. package/.docs/models/providers/openai.md +204 -0
  422. package/.docs/models/providers/opencode-go.md +88 -0
  423. package/.docs/models/providers/opencode.md +130 -0
  424. package/.docs/models/providers/orcarouter.md +153 -0
  425. package/.docs/models/providers/ovhcloud.md +86 -0
  426. package/.docs/models/providers/perplexity-agent.md +120 -0
  427. package/.docs/models/providers/perplexity.md +103 -0
  428. package/.docs/models/providers/pioneer.md +174 -0
  429. package/.docs/models/providers/poe.md +198 -0
  430. package/.docs/models/providers/poolside.md +75 -0
  431. package/.docs/models/providers/privatemode-ai.md +77 -0
  432. package/.docs/models/providers/qihang-ai.md +81 -0
  433. package/.docs/models/providers/qiniu-ai.md +163 -0
  434. package/.docs/models/providers/regolo-ai.md +85 -0
  435. package/.docs/models/providers/requesty.md +119 -0
  436. package/.docs/models/providers/routing-run.md +87 -0
  437. package/.docs/models/providers/sakana.md +75 -0
  438. package/.docs/models/providers/sarvam.md +74 -0
  439. package/.docs/models/providers/scaleway.md +86 -0
  440. package/.docs/models/providers/scx.md +74 -0
  441. package/.docs/models/providers/siliconflow-cn.md +119 -0
  442. package/.docs/models/providers/siliconflow.md +121 -0
  443. package/.docs/models/providers/snowflake-cortex.md +94 -0
  444. package/.docs/models/providers/stackit.md +80 -0
  445. package/.docs/models/providers/stepfun-ai-step-plan.md +75 -0
  446. package/.docs/models/providers/stepfun-ai.md +80 -0
  447. package/.docs/models/providers/stepfun-step-plan.md +76 -0
  448. package/.docs/models/providers/stepfun.md +80 -0
  449. package/.docs/models/providers/subconscious.md +102 -0
  450. package/.docs/models/providers/submodel.md +81 -0
  451. package/.docs/models/providers/synthetic.md +80 -0
  452. package/.docs/models/providers/tencent-coding-plan.md +80 -0
  453. package/.docs/models/providers/tencent-token-plan.md +73 -0
  454. package/.docs/models/providers/tencent-tokenhub.md +74 -0
  455. package/.docs/models/providers/tensorx.md +97 -0
  456. package/.docs/models/providers/the-grid-ai.md +81 -0
  457. package/.docs/models/providers/thinkingmachines.md +102 -0
  458. package/.docs/models/providers/tinfoil.md +79 -0
  459. package/.docs/models/providers/togetherai.md +122 -0
  460. package/.docs/models/providers/trustedrouter.md +79 -0
  461. package/.docs/models/providers/umans-ai-coding-plan.md +80 -0
  462. package/.docs/models/providers/umans-ai.md +79 -0
  463. package/.docs/models/providers/unorouter.md +95 -0
  464. package/.docs/models/providers/upstage.md +76 -0
  465. package/.docs/models/providers/venice.md +97 -0
  466. package/.docs/models/providers/vivgrid.md +117 -0
  467. package/.docs/models/providers/vultr.md +82 -0
  468. package/.docs/models/providers/wafer.ai.md +77 -0
  469. package/.docs/models/providers/wandb.md +99 -0
  470. package/.docs/models/providers/xai.md +135 -0
  471. package/.docs/models/providers/xiaomi-token-plan-ams.md +78 -0
  472. package/.docs/models/providers/xiaomi-token-plan-cn.md +78 -0
  473. package/.docs/models/providers/xiaomi-token-plan-sgp.md +78 -0
  474. package/.docs/models/providers/xiaomi.md +75 -0
  475. package/.docs/models/providers/xpersona.md +85 -0
  476. package/.docs/models/providers/zai-coding-plan.md +76 -0
  477. package/.docs/models/providers/zai.md +86 -0
  478. package/.docs/models/providers/zeldoc.md +73 -0
  479. package/.docs/models/providers/zenifra.md +73 -0
  480. package/.docs/models/providers/zenmux.md +192 -0
  481. package/.docs/models/providers/zhipuai-coding-plan.md +79 -0
  482. package/.docs/models/providers/zhipuai.md +85 -0
  483. package/.docs/models/providers.md +168 -0
  484. package/.docs/reference/acp/acp-agent.md +232 -0
  485. package/.docs/reference/acp/create-acp-tool.md +161 -0
  486. package/.docs/reference/agent-controller/agent-controller-class.md +427 -0
  487. package/.docs/reference/agent-controller/session.md +772 -0
  488. package/.docs/reference/agents/agent.md +571 -0
  489. package/.docs/reference/agents/channels.md +385 -0
  490. package/.docs/reference/agents/createSkill.md +80 -0
  491. package/.docs/reference/agents/durable-agent.md +380 -0
  492. package/.docs/reference/agents/generate.md +477 -0
  493. package/.docs/reference/agents/generateLegacy.md +225 -0
  494. package/.docs/reference/agents/getDefaultGenerateOptions.md +36 -0
  495. package/.docs/reference/agents/getDefaultOptions.md +34 -0
  496. package/.docs/reference/agents/getDefaultStreamOptions.md +36 -0
  497. package/.docs/reference/agents/getDescription.md +23 -0
  498. package/.docs/reference/agents/getInstructions.md +34 -0
  499. package/.docs/reference/agents/getLLM.md +43 -0
  500. package/.docs/reference/agents/getMemory.md +34 -0
  501. package/.docs/reference/agents/getMetadata.md +63 -0
  502. package/.docs/reference/agents/getModel.md +34 -0
  503. package/.docs/reference/agents/getSkill.md +60 -0
  504. package/.docs/reference/agents/getTools.md +29 -0
  505. package/.docs/reference/agents/getVoice.md +34 -0
  506. package/.docs/reference/agents/inngest-agent.md +370 -0
  507. package/.docs/reference/agents/listAgents.md +35 -0
  508. package/.docs/reference/agents/listScorers.md +34 -0
  509. package/.docs/reference/agents/listSkills.md +55 -0
  510. package/.docs/reference/agents/listSuspendedRuns.md +93 -0
  511. package/.docs/reference/agents/listTools.md +34 -0
  512. package/.docs/reference/agents/listWorkflows.md +34 -0
  513. package/.docs/reference/agents/network.md +222 -0
  514. package/.docs/reference/ai-sdk/chat-route.md +96 -0
  515. package/.docs/reference/ai-sdk/handle-chat-stream.md +85 -0
  516. package/.docs/reference/ai-sdk/handle-network-stream.md +47 -0
  517. package/.docs/reference/ai-sdk/handle-workflow-stream.md +61 -0
  518. package/.docs/reference/ai-sdk/network-route.md +84 -0
  519. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +97 -0
  520. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +282 -0
  521. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +81 -0
  522. package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +78 -0
  523. package/.docs/reference/ai-sdk/with-mastra.md +65 -0
  524. package/.docs/reference/ai-sdk/workflow-route.md +85 -0
  525. package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +53 -0
  526. package/.docs/reference/auth/auth0.md +75 -0
  527. package/.docs/reference/auth/better-auth.md +73 -0
  528. package/.docs/reference/auth/clerk.md +38 -0
  529. package/.docs/reference/auth/fga.md +140 -0
  530. package/.docs/reference/auth/firebase.md +82 -0
  531. package/.docs/reference/auth/google.md +357 -0
  532. package/.docs/reference/auth/jwt.md +28 -0
  533. package/.docs/reference/auth/okta.md +164 -0
  534. package/.docs/reference/auth/supabase.md +35 -0
  535. package/.docs/reference/auth/workos.md +131 -0
  536. package/.docs/reference/browser/agent-browser.md +407 -0
  537. package/.docs/reference/browser/browser-viewer.md +232 -0
  538. package/.docs/reference/browser/firecrawl-browser.md +71 -0
  539. package/.docs/reference/browser/mastra-browser.md +288 -0
  540. package/.docs/reference/browser/stagehand-browser.md +320 -0
  541. package/.docs/reference/build-with-ai.md +263 -0
  542. package/.docs/reference/channels/channel-provider.md +67 -0
  543. package/.docs/reference/channels/slack-provider.md +228 -0
  544. package/.docs/reference/cli/create-mastra.md +222 -0
  545. package/.docs/reference/cli/mastra.md +1784 -0
  546. package/.docs/reference/client-js/agents.md +959 -0
  547. package/.docs/reference/client-js/conversations.md +137 -0
  548. package/.docs/reference/client-js/error-handling.md +18 -0
  549. package/.docs/reference/client-js/logs.md +26 -0
  550. package/.docs/reference/client-js/mastra-client.md +96 -0
  551. package/.docs/reference/client-js/memory.md +237 -0
  552. package/.docs/reference/client-js/observability.md +183 -0
  553. package/.docs/reference/client-js/responses.md +219 -0
  554. package/.docs/reference/client-js/telemetry.md +22 -0
  555. package/.docs/reference/client-js/tools.md +46 -0
  556. package/.docs/reference/client-js/vectors.md +81 -0
  557. package/.docs/reference/client-js/workflows.md +393 -0
  558. package/.docs/reference/code-sdk/mount-agent-controller.md +78 -0
  559. package/.docs/reference/coding-agent/build-base-prompt.md +77 -0
  560. package/.docs/reference/coding-agent/create-coding-agent.md +100 -0
  561. package/.docs/reference/configuration.md +927 -0
  562. package/.docs/reference/core/addGateway.md +44 -0
  563. package/.docs/reference/core/addStoredWorkflow.md +62 -0
  564. package/.docs/reference/core/addStoredWorkflows.md +40 -0
  565. package/.docs/reference/core/getAgent.md +23 -0
  566. package/.docs/reference/core/getAgentById.md +56 -0
  567. package/.docs/reference/core/getDeployer.md +24 -0
  568. package/.docs/reference/core/getEditor.md +37 -0
  569. package/.docs/reference/core/getGateway.md +40 -0
  570. package/.docs/reference/core/getGatewayById.md +43 -0
  571. package/.docs/reference/core/getLogger.md +24 -0
  572. package/.docs/reference/core/getMCPServer.md +47 -0
  573. package/.docs/reference/core/getMCPServerById.md +55 -0
  574. package/.docs/reference/core/getMemory.md +51 -0
  575. package/.docs/reference/core/getScorer.md +56 -0
  576. package/.docs/reference/core/getScorerById.md +56 -0
  577. package/.docs/reference/core/getServer.md +24 -0
  578. package/.docs/reference/core/getStorage.md +24 -0
  579. package/.docs/reference/core/getTelemetry.md +24 -0
  580. package/.docs/reference/core/getTool.md +33 -0
  581. package/.docs/reference/core/getToolById.md +48 -0
  582. package/.docs/reference/core/getVector.md +24 -0
  583. package/.docs/reference/core/getWorkflow.md +42 -0
  584. package/.docs/reference/core/listAgents.md +23 -0
  585. package/.docs/reference/core/listGateways.md +42 -0
  586. package/.docs/reference/core/listLogs.md +38 -0
  587. package/.docs/reference/core/listLogsByRunId.md +38 -0
  588. package/.docs/reference/core/listMCPServers.md +53 -0
  589. package/.docs/reference/core/listMemory.md +57 -0
  590. package/.docs/reference/core/listScorers.md +31 -0
  591. package/.docs/reference/core/listTools.md +38 -0
  592. package/.docs/reference/core/listVectors.md +24 -0
  593. package/.docs/reference/core/listWorkflows.md +23 -0
  594. package/.docs/reference/core/mastra-class.md +153 -0
  595. package/.docs/reference/core/mastra-model-gateway.md +171 -0
  596. package/.docs/reference/core/removeWorkspace.md +28 -0
  597. package/.docs/reference/core/setLogger.md +26 -0
  598. package/.docs/reference/core/setStorage.md +29 -0
  599. package/.docs/reference/datasets/addItem.md +53 -0
  600. package/.docs/reference/datasets/addItems.md +41 -0
  601. package/.docs/reference/datasets/compareExperiments.md +64 -0
  602. package/.docs/reference/datasets/create.md +51 -0
  603. package/.docs/reference/datasets/dataset.md +80 -0
  604. package/.docs/reference/datasets/datasets-manager.md +86 -0
  605. package/.docs/reference/datasets/delete.md +25 -0
  606. package/.docs/reference/datasets/deleteExperiment.md +27 -0
  607. package/.docs/reference/datasets/deleteItem.md +27 -0
  608. package/.docs/reference/datasets/deleteItems.md +29 -0
  609. package/.docs/reference/datasets/get.md +31 -0
  610. package/.docs/reference/datasets/getDetails.md +47 -0
  611. package/.docs/reference/datasets/getExperiment.md +30 -0
  612. package/.docs/reference/datasets/getItem.md +33 -0
  613. package/.docs/reference/datasets/getItemHistory.md +51 -0
  614. package/.docs/reference/datasets/list.md +63 -0
  615. package/.docs/reference/datasets/listExperimentResults.md +87 -0
  616. package/.docs/reference/datasets/listExperiments.md +90 -0
  617. package/.docs/reference/datasets/listItems.md +62 -0
  618. package/.docs/reference/datasets/listVersions.md +53 -0
  619. package/.docs/reference/datasets/startExperiment.md +146 -0
  620. package/.docs/reference/datasets/startExperimentAsync.md +51 -0
  621. package/.docs/reference/datasets/update.md +48 -0
  622. package/.docs/reference/datasets/updateItem.md +38 -0
  623. package/.docs/reference/deployer/cloudflare.md +135 -0
  624. package/.docs/reference/deployer/netlify.md +130 -0
  625. package/.docs/reference/deployer/vercel.md +118 -0
  626. package/.docs/reference/deployer.md +102 -0
  627. package/.docs/reference/editor/blob-store-provider.md +61 -0
  628. package/.docs/reference/editor/browser-provider.md +77 -0
  629. package/.docs/reference/editor/filesystem-provider.md +64 -0
  630. package/.docs/reference/editor/mastra-editor.md +241 -0
  631. package/.docs/reference/editor/processor-provider.md +66 -0
  632. package/.docs/reference/editor/prompt-blocks.md +137 -0
  633. package/.docs/reference/editor/sandbox-provider.md +63 -0
  634. package/.docs/reference/editor/storage-browser-ref.md +82 -0
  635. package/.docs/reference/editor/storage-workspace-ref.md +95 -0
  636. package/.docs/reference/editor/tool-provider.md +121 -0
  637. package/.docs/reference/editor/tools.md +100 -0
  638. package/.docs/reference/editor/versioning.md +130 -0
  639. package/.docs/reference/evals/answer-relevancy.md +107 -0
  640. package/.docs/reference/evals/answer-similarity.md +99 -0
  641. package/.docs/reference/evals/bias.md +122 -0
  642. package/.docs/reference/evals/checks.md +212 -0
  643. package/.docs/reference/evals/completeness.md +138 -0
  644. package/.docs/reference/evals/content-similarity.md +103 -0
  645. package/.docs/reference/evals/context-precision.md +198 -0
  646. package/.docs/reference/evals/context-recall.md +205 -0
  647. package/.docs/reference/evals/context-relevance.md +533 -0
  648. package/.docs/reference/evals/create-scorer.md +331 -0
  649. package/.docs/reference/evals/faithfulness.md +116 -0
  650. package/.docs/reference/evals/filter-run.md +119 -0
  651. package/.docs/reference/evals/hallucination.md +206 -0
  652. package/.docs/reference/evals/keyword-coverage.md +130 -0
  653. package/.docs/reference/evals/mastra-scorer.md +245 -0
  654. package/.docs/reference/evals/noise-sensitivity.md +677 -0
  655. package/.docs/reference/evals/prompt-alignment.md +617 -0
  656. package/.docs/reference/evals/rubric.md +115 -0
  657. package/.docs/reference/evals/run-evals.md +418 -0
  658. package/.docs/reference/evals/scorer-utils.md +516 -0
  659. package/.docs/reference/evals/summarization.md +203 -0
  660. package/.docs/reference/evals/textual-difference.md +115 -0
  661. package/.docs/reference/evals/tone-consistency.md +121 -0
  662. package/.docs/reference/evals/tool-call-accuracy.md +535 -0
  663. package/.docs/reference/evals/toxicity.md +125 -0
  664. package/.docs/reference/evals/trajectory-accuracy.md +629 -0
  665. package/.docs/reference/file-based-agents/config.md +136 -0
  666. package/.docs/reference/file-based-agents/instructions.md +79 -0
  667. package/.docs/reference/file-based-agents/logger.md +26 -0
  668. package/.docs/reference/file-based-agents/memory.md +58 -0
  669. package/.docs/reference/file-based-agents/observability.md +32 -0
  670. package/.docs/reference/file-based-agents/processors.md +56 -0
  671. package/.docs/reference/file-based-agents/schedules.md +232 -0
  672. package/.docs/reference/file-based-agents/scorers.md +54 -0
  673. package/.docs/reference/file-based-agents/server.md +37 -0
  674. package/.docs/reference/file-based-agents/skills.md +56 -0
  675. package/.docs/reference/file-based-agents/storage.md +30 -0
  676. package/.docs/reference/file-based-agents/studio.md +56 -0
  677. package/.docs/reference/file-based-agents/subagents.md +123 -0
  678. package/.docs/reference/file-based-agents/tools.md +64 -0
  679. package/.docs/reference/file-based-agents/workflows.md +52 -0
  680. package/.docs/reference/file-based-agents/workspace.md +74 -0
  681. package/.docs/reference/index.md +418 -0
  682. package/.docs/reference/logging/pino-logger.md +175 -0
  683. package/.docs/reference/mastra-platform/api.md +110 -0
  684. package/.docs/reference/memory/clone-utilities.md +203 -0
  685. package/.docs/reference/memory/cloneThread.md +173 -0
  686. package/.docs/reference/memory/createThread.md +70 -0
  687. package/.docs/reference/memory/deleteMessages.md +40 -0
  688. package/.docs/reference/memory/getThreadById.md +26 -0
  689. package/.docs/reference/memory/listThreads.md +147 -0
  690. package/.docs/reference/memory/memory-class.md +148 -0
  691. package/.docs/reference/memory/observational-memory.md +877 -0
  692. package/.docs/reference/memory/recall.md +116 -0
  693. package/.docs/reference/memory/serialized-memory-config.md +74 -0
  694. package/.docs/reference/memory/summarizeConversation.md +99 -0
  695. package/.docs/reference/memory/summarizeThread.md +93 -0
  696. package/.docs/reference/observability/feedback.md +391 -0
  697. package/.docs/reference/observability/metrics/automatic-metrics.md +138 -0
  698. package/.docs/reference/observability/tracing/bridges/datadog.md +213 -0
  699. package/.docs/reference/observability/tracing/bridges/otel.md +155 -0
  700. package/.docs/reference/observability/tracing/configuration.md +214 -0
  701. package/.docs/reference/observability/tracing/exporters/arize.md +143 -0
  702. package/.docs/reference/observability/tracing/exporters/arthur.md +124 -0
  703. package/.docs/reference/observability/tracing/exporters/braintrust.md +98 -0
  704. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +248 -0
  705. package/.docs/reference/observability/tracing/exporters/confident-ai.md +138 -0
  706. package/.docs/reference/observability/tracing/exporters/console-exporter.md +137 -0
  707. package/.docs/reference/observability/tracing/exporters/datadog.md +121 -0
  708. package/.docs/reference/observability/tracing/exporters/default-exporter.md +182 -0
  709. package/.docs/reference/observability/tracing/exporters/laminar.md +80 -0
  710. package/.docs/reference/observability/tracing/exporters/langfuse.md +130 -0
  711. package/.docs/reference/observability/tracing/exporters/langsmith.md +111 -0
  712. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +265 -0
  713. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +196 -0
  714. package/.docs/reference/observability/tracing/exporters/otel.md +205 -0
  715. package/.docs/reference/observability/tracing/exporters/posthog.md +133 -0
  716. package/.docs/reference/observability/tracing/exporters/sentry.md +188 -0
  717. package/.docs/reference/observability/tracing/instances.md +109 -0
  718. package/.docs/reference/observability/tracing/interfaces.md +900 -0
  719. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +166 -0
  720. package/.docs/reference/observability/tracing/span-filtering.md +97 -0
  721. package/.docs/reference/observability/tracing/spans.md +228 -0
  722. package/.docs/reference/processors/batch-parts-processor.md +62 -0
  723. package/.docs/reference/processors/cost-guard-processor.md +115 -0
  724. package/.docs/reference/processors/language-detector.md +85 -0
  725. package/.docs/reference/processors/message-history-processor.md +86 -0
  726. package/.docs/reference/processors/moderation-processor.md +109 -0
  727. package/.docs/reference/processors/pii-detector.md +113 -0
  728. package/.docs/reference/processors/prefill-error-handler.md +74 -0
  729. package/.docs/reference/processors/processor-interface.md +1159 -0
  730. package/.docs/reference/processors/prompt-injection-detector.md +76 -0
  731. package/.docs/reference/processors/provider-history-compat.md +136 -0
  732. package/.docs/reference/processors/regex-filter-processor.md +181 -0
  733. package/.docs/reference/processors/response-cache.md +117 -0
  734. package/.docs/reference/processors/semantic-recall-processor.md +118 -0
  735. package/.docs/reference/processors/skill-search-processor.md +115 -0
  736. package/.docs/reference/processors/stream-error-retry-processor.md +127 -0
  737. package/.docs/reference/processors/system-prompt-scrubber.md +84 -0
  738. package/.docs/reference/processors/token-limiter-processor.md +158 -0
  739. package/.docs/reference/processors/tool-call-filter.md +138 -0
  740. package/.docs/reference/processors/tool-search-processor.md +248 -0
  741. package/.docs/reference/processors/unicode-normalizer.md +62 -0
  742. package/.docs/reference/processors/working-memory-processor.md +151 -0
  743. package/.docs/reference/project-structure.md +59 -0
  744. package/.docs/reference/pubsub/base.md +204 -0
  745. package/.docs/reference/pubsub/caching-pubsub.md +118 -0
  746. package/.docs/reference/pubsub/event-emitter.md +109 -0
  747. package/.docs/reference/pubsub/google-cloud-pubsub.md +96 -0
  748. package/.docs/reference/pubsub/lease-provider.md +133 -0
  749. package/.docs/reference/pubsub/redis-streams.md +130 -0
  750. package/.docs/reference/pubsub/unix-socket-pubsub.md +54 -0
  751. package/.docs/reference/rag/chunk.md +223 -0
  752. package/.docs/reference/rag/database-config.md +279 -0
  753. package/.docs/reference/rag/document.md +116 -0
  754. package/.docs/reference/rag/embeddings.md +94 -0
  755. package/.docs/reference/rag/extract-params.md +170 -0
  756. package/.docs/reference/rag/graph-rag.md +113 -0
  757. package/.docs/reference/rag/metadata-filters.md +218 -0
  758. package/.docs/reference/rag/rerank.md +85 -0
  759. package/.docs/reference/rag/rerankWithScorer.md +90 -0
  760. package/.docs/reference/schedules/overview.md +199 -0
  761. package/.docs/reference/server/create-route.md +266 -0
  762. package/.docs/reference/server/express-adapter.md +199 -0
  763. package/.docs/reference/server/fastify-adapter.md +118 -0
  764. package/.docs/reference/server/hono-adapter.md +184 -0
  765. package/.docs/reference/server/koa-adapter.md +150 -0
  766. package/.docs/reference/server/mastra-server.md +301 -0
  767. package/.docs/reference/server/nestjs-adapter.md +169 -0
  768. package/.docs/reference/server/register-api-route.md +271 -0
  769. package/.docs/reference/server/routes.md +462 -0
  770. package/.docs/reference/signals/create-notification-inbox-tool.md +69 -0
  771. package/.docs/reference/signals/signal-provider.md +411 -0
  772. package/.docs/reference/signals/task-signal-provider.md +65 -0
  773. package/.docs/reference/signals/webhook-signal-provider.md +140 -0
  774. package/.docs/reference/storage/clickhouse.md +379 -0
  775. package/.docs/reference/storage/cloudflare-d1.md +220 -0
  776. package/.docs/reference/storage/cloudflare.md +161 -0
  777. package/.docs/reference/storage/composite.md +397 -0
  778. package/.docs/reference/storage/convex.md +232 -0
  779. package/.docs/reference/storage/dsql.md +430 -0
  780. package/.docs/reference/storage/duckdb.md +156 -0
  781. package/.docs/reference/storage/dynamodb.md +284 -0
  782. package/.docs/reference/storage/lance.md +133 -0
  783. package/.docs/reference/storage/libsql.md +143 -0
  784. package/.docs/reference/storage/mongodb.md +267 -0
  785. package/.docs/reference/storage/mssql.md +159 -0
  786. package/.docs/reference/storage/overview.md +141 -0
  787. package/.docs/reference/storage/postgresql.md +531 -0
  788. package/.docs/reference/storage/redis.md +268 -0
  789. package/.docs/reference/storage/retention.md +248 -0
  790. package/.docs/reference/storage/spanner.md +220 -0
  791. package/.docs/reference/storage/upstash.md +162 -0
  792. package/.docs/reference/streaming/ChunkType.md +700 -0
  793. package/.docs/reference/streaming/agents/MastraModelOutput.md +254 -0
  794. package/.docs/reference/streaming/agents/stream.md +402 -0
  795. package/.docs/reference/streaming/agents/streamLegacy.md +186 -0
  796. package/.docs/reference/streaming/agents/streamUntilIdle.md +107 -0
  797. package/.docs/reference/streaming/smoothStream.md +135 -0
  798. package/.docs/reference/streaming/workflows/observeStream.md +44 -0
  799. package/.docs/reference/streaming/workflows/resumeStream.md +75 -0
  800. package/.docs/reference/streaming/workflows/stream.md +102 -0
  801. package/.docs/reference/streaming/workflows/timeTravelStream.md +144 -0
  802. package/.docs/reference/templates/overview.md +116 -0
  803. package/.docs/reference/tools/ask-user-tool.md +78 -0
  804. package/.docs/reference/tools/bedrock-kb-tool.md +117 -0
  805. package/.docs/reference/tools/brightdata.md +169 -0
  806. package/.docs/reference/tools/create-code-mode.md +127 -0
  807. package/.docs/reference/tools/create-tool.md +518 -0
  808. package/.docs/reference/tools/document-chunker-tool.md +91 -0
  809. package/.docs/reference/tools/graph-rag-tool.md +182 -0
  810. package/.docs/reference/tools/isolated-vm-transport.md +74 -0
  811. package/.docs/reference/tools/mcp-client.md +1335 -0
  812. package/.docs/reference/tools/mcp-server.md +1668 -0
  813. package/.docs/reference/tools/perplexity.md +155 -0
  814. package/.docs/reference/tools/submit-plan-tool.md +93 -0
  815. package/.docs/reference/tools/task-tools.md +132 -0
  816. package/.docs/reference/tools/tavily.md +307 -0
  817. package/.docs/reference/tools/vector-query-tool.md +495 -0
  818. package/.docs/reference/vectors/astra.md +123 -0
  819. package/.docs/reference/vectors/chroma.md +266 -0
  820. package/.docs/reference/vectors/convex.md +424 -0
  821. package/.docs/reference/vectors/couchbase.md +228 -0
  822. package/.docs/reference/vectors/duckdb.md +320 -0
  823. package/.docs/reference/vectors/elasticsearch.md +191 -0
  824. package/.docs/reference/vectors/lance.md +230 -0
  825. package/.docs/reference/vectors/libsql.md +307 -0
  826. package/.docs/reference/vectors/mongodb.md +567 -0
  827. package/.docs/reference/vectors/opensearch.md +101 -0
  828. package/.docs/reference/vectors/pg.md +430 -0
  829. package/.docs/reference/vectors/pinecone.md +170 -0
  830. package/.docs/reference/vectors/qdrant.md +224 -0
  831. package/.docs/reference/vectors/s3vectors.md +279 -0
  832. package/.docs/reference/vectors/turbopuffer.md +163 -0
  833. package/.docs/reference/vectors/upstash.md +296 -0
  834. package/.docs/reference/vectors/vectorize.md +149 -0
  835. package/.docs/reference/voice/aws-nova-sonic.md +249 -0
  836. package/.docs/reference/voice/azure.md +156 -0
  837. package/.docs/reference/voice/cloudflare.md +85 -0
  838. package/.docs/reference/voice/composite-voice.md +123 -0
  839. package/.docs/reference/voice/deepgram.md +87 -0
  840. package/.docs/reference/voice/elevenlabs.md +98 -0
  841. package/.docs/reference/voice/google-gemini-live.md +413 -0
  842. package/.docs/reference/voice/google.md +290 -0
  843. package/.docs/reference/voice/inworld-realtime.md +355 -0
  844. package/.docs/reference/voice/inworld.md +137 -0
  845. package/.docs/reference/voice/livekit.md +482 -0
  846. package/.docs/reference/voice/mastra-voice.md +313 -0
  847. package/.docs/reference/voice/mistral.md +127 -0
  848. package/.docs/reference/voice/murf.md +120 -0
  849. package/.docs/reference/voice/openai-realtime.md +207 -0
  850. package/.docs/reference/voice/openai.md +96 -0
  851. package/.docs/reference/voice/playai.md +82 -0
  852. package/.docs/reference/voice/sarvam.md +132 -0
  853. package/.docs/reference/voice/speechify.md +81 -0
  854. package/.docs/reference/voice/voice.addInstructions.md +58 -0
  855. package/.docs/reference/voice/voice.addTools.md +69 -0
  856. package/.docs/reference/voice/voice.answer.md +56 -0
  857. package/.docs/reference/voice/voice.close.md +53 -0
  858. package/.docs/reference/voice/voice.connect.md +98 -0
  859. package/.docs/reference/voice/voice.events.md +39 -0
  860. package/.docs/reference/voice/voice.getSpeakers.md +131 -0
  861. package/.docs/reference/voice/voice.listen.md +172 -0
  862. package/.docs/reference/voice/voice.off.md +56 -0
  863. package/.docs/reference/voice/voice.on.md +113 -0
  864. package/.docs/reference/voice/voice.send.md +67 -0
  865. package/.docs/reference/voice/voice.speak.md +169 -0
  866. package/.docs/reference/voice/voice.updateConfig.md +62 -0
  867. package/.docs/reference/voice/xai-realtime.md +269 -0
  868. package/.docs/reference/workers/overview.md +87 -0
  869. package/.docs/reference/workflows/run-methods/cancel.md +88 -0
  870. package/.docs/reference/workflows/run-methods/restart.md +49 -0
  871. package/.docs/reference/workflows/run-methods/resume.md +101 -0
  872. package/.docs/reference/workflows/run-methods/start.md +76 -0
  873. package/.docs/reference/workflows/run-methods/startAsync.md +75 -0
  874. package/.docs/reference/workflows/run-methods/timeTravel.md +162 -0
  875. package/.docs/reference/workflows/run.md +61 -0
  876. package/.docs/reference/workflows/step.md +240 -0
  877. package/.docs/reference/workflows/stored-workflow-definition.md +292 -0
  878. package/.docs/reference/workflows/workflow-methods/agent.md +62 -0
  879. package/.docs/reference/workflows/workflow-methods/branch.md +27 -0
  880. package/.docs/reference/workflows/workflow-methods/commit.md +19 -0
  881. package/.docs/reference/workflows/workflow-methods/create-run.md +65 -0
  882. package/.docs/reference/workflows/workflow-methods/dountil.md +27 -0
  883. package/.docs/reference/workflows/workflow-methods/dowhile.md +27 -0
  884. package/.docs/reference/workflows/workflow-methods/foreach.md +133 -0
  885. package/.docs/reference/workflows/workflow-methods/map.md +95 -0
  886. package/.docs/reference/workflows/workflow-methods/parallel.md +23 -0
  887. package/.docs/reference/workflows/workflow-methods/sleep.md +37 -0
  888. package/.docs/reference/workflows/workflow-methods/sleepUntil.md +37 -0
  889. package/.docs/reference/workflows/workflow-methods/then.md +23 -0
  890. package/.docs/reference/workflows/workflow-methods/tool.md +43 -0
  891. package/.docs/reference/workflows/workflow-state-reader.md +115 -0
  892. package/.docs/reference/workflows/workflow.md +235 -0
  893. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +203 -0
  894. package/.docs/reference/workspace/agentfs-filesystem.md +111 -0
  895. package/.docs/reference/workspace/apple-container-sandbox.md +257 -0
  896. package/.docs/reference/workspace/archil-filesystem.md +204 -0
  897. package/.docs/reference/workspace/azure-blob-filesystem.md +220 -0
  898. package/.docs/reference/workspace/blaxel-sandbox.md +167 -0
  899. package/.docs/reference/workspace/daytona-sandbox.md +485 -0
  900. package/.docs/reference/workspace/docker-sandbox.md +259 -0
  901. package/.docs/reference/workspace/e2b-sandbox.md +277 -0
  902. package/.docs/reference/workspace/files-sdk-filesystem.md +188 -0
  903. package/.docs/reference/workspace/filesystem.md +273 -0
  904. package/.docs/reference/workspace/gcs-filesystem.md +197 -0
  905. package/.docs/reference/workspace/google-drive-filesystem.md +185 -0
  906. package/.docs/reference/workspace/local-filesystem.md +359 -0
  907. package/.docs/reference/workspace/local-sandbox.md +226 -0
  908. package/.docs/reference/workspace/mesa-filesystem.md +321 -0
  909. package/.docs/reference/workspace/modal-sandbox.md +168 -0
  910. package/.docs/reference/workspace/platform-filesystem.md +185 -0
  911. package/.docs/reference/workspace/platform-sandbox.md +276 -0
  912. package/.docs/reference/workspace/process-manager.md +298 -0
  913. package/.docs/reference/workspace/railway-sandbox.md +266 -0
  914. package/.docs/reference/workspace/s3-filesystem.md +274 -0
  915. package/.docs/reference/workspace/sandbox.md +97 -0
  916. package/.docs/reference/workspace/vercel-sandbox.md +205 -0
  917. package/.docs/reference/workspace/vercel-serverless.md +128 -0
  918. package/.docs/reference/workspace/workspace-class.md +495 -0
  919. package/CHANGELOG.md +3072 -4
  920. package/README.md +63 -125
  921. package/dist/index.d.ts.map +1 -1
  922. package/dist/index.js +2 -0
  923. package/dist/logger.d.ts +3 -0
  924. package/dist/logger.d.ts.map +1 -1
  925. package/dist/prompts/migration.d.ts +6 -0
  926. package/dist/prompts/migration.d.ts.map +1 -0
  927. package/dist/src-BZcgzbk9.js +1774 -0
  928. package/dist/src-BZcgzbk9.js.map +1 -0
  929. package/dist/stdio.js +32 -1141
  930. package/dist/stdio.js.map +1 -0
  931. package/dist/tools/course.d.ts +7 -27
  932. package/dist/tools/course.d.ts.map +1 -1
  933. package/dist/tools/docs.d.ts +6 -18
  934. package/dist/tools/docs.d.ts.map +1 -1
  935. package/dist/tools/embedded-docs.d.ts +176 -0
  936. package/dist/tools/embedded-docs.d.ts.map +1 -0
  937. package/dist/tools/migration.d.ts +20 -0
  938. package/dist/tools/migration.d.ts.map +1 -0
  939. package/dist/utils.d.ts +1 -58
  940. package/dist/utils.d.ts.map +1 -1
  941. package/package.json +30 -26
  942. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +0 -9
  943. package/.docs/organized/changelogs/%40internal%2Fplayground.md +0 -3
  944. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +0 -302
  945. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +0 -49
  946. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +0 -302
  947. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +0 -302
  948. package/.docs/organized/changelogs/%40mastra%2Fastra.md +0 -302
  949. package/.docs/organized/changelogs/%40mastra%2Fauth.md +0 -31
  950. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +0 -302
  951. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +0 -302
  952. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +0 -302
  953. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +0 -302
  954. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +0 -302
  955. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +0 -302
  956. package/.docs/organized/changelogs/%40mastra%2Fcore.md +0 -302
  957. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +0 -302
  958. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +0 -302
  959. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +0 -302
  960. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +0 -302
  961. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +0 -302
  962. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +0 -302
  963. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +0 -302
  964. package/.docs/organized/changelogs/%40mastra%2Fevals.md +0 -302
  965. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +0 -87
  966. package/.docs/organized/changelogs/%40mastra%2Flance.md +0 -302
  967. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +0 -302
  968. package/.docs/organized/changelogs/%40mastra%2Floggers.md +0 -302
  969. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +0 -302
  970. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +0 -302
  971. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +0 -302
  972. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +0 -302
  973. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +0 -302
  974. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +0 -302
  975. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +0 -302
  976. package/.docs/organized/changelogs/%40mastra%2Fpg.md +0 -302
  977. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +0 -302
  978. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +0 -302
  979. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +0 -302
  980. package/.docs/organized/changelogs/%40mastra%2Frag.md +0 -302
  981. package/.docs/organized/changelogs/%40mastra%2Freact.md +0 -247
  982. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +0 -149
  983. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +0 -195
  984. package/.docs/organized/changelogs/%40mastra%2Fserver.md +0 -302
  985. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +0 -302
  986. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +0 -302
  987. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +0 -302
  988. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +0 -302
  989. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +0 -302
  990. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +0 -302
  991. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +0 -302
  992. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +0 -302
  993. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +0 -265
  994. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +0 -302
  995. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +0 -302
  996. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +0 -302
  997. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +0 -302
  998. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +0 -302
  999. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +0 -302
  1000. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +0 -302
  1001. package/.docs/organized/changelogs/create-mastra.md +0 -302
  1002. package/.docs/organized/changelogs/mastra.md +0 -302
  1003. package/.docs/organized/code-examples/a2a.md +0 -208
  1004. package/.docs/organized/code-examples/agent.md +0 -1333
  1005. package/.docs/organized/code-examples/agui.md +0 -173
  1006. package/.docs/organized/code-examples/ai-elements.md +0 -47
  1007. package/.docs/organized/code-examples/ai-sdk-useChat.md +0 -369
  1008. package/.docs/organized/code-examples/ai-sdk-v5.md +0 -203
  1009. package/.docs/organized/code-examples/assistant-ui.md +0 -28
  1010. package/.docs/organized/code-examples/bird-checker-with-express.md +0 -223
  1011. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +0 -347
  1012. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +0 -241
  1013. package/.docs/organized/code-examples/client-side-tools.md +0 -59
  1014. package/.docs/organized/code-examples/crypto-chatbot.md +0 -87
  1015. package/.docs/organized/code-examples/experimental-auth-weather-agent.md +0 -564
  1016. package/.docs/organized/code-examples/fireworks-r1.md +0 -148
  1017. package/.docs/organized/code-examples/heads-up-game.md +0 -252
  1018. package/.docs/organized/code-examples/mcp-configuration.md +0 -556
  1019. package/.docs/organized/code-examples/mcp-registry-registry.md +0 -50
  1020. package/.docs/organized/code-examples/memory-per-resource-example.md +0 -222
  1021. package/.docs/organized/code-examples/memory-todo-agent.md +0 -152
  1022. package/.docs/organized/code-examples/memory-with-context.md +0 -155
  1023. package/.docs/organized/code-examples/memory-with-libsql.md +0 -190
  1024. package/.docs/organized/code-examples/memory-with-pg.md +0 -211
  1025. package/.docs/organized/code-examples/memory-with-processors.md +0 -594
  1026. package/.docs/organized/code-examples/memory-with-upstash.md +0 -254
  1027. package/.docs/organized/code-examples/openapi-spec-writer.md +0 -567
  1028. package/.docs/organized/code-examples/quick-start.md +0 -156
  1029. package/.docs/organized/code-examples/stock-price-tool.md +0 -111
  1030. package/.docs/organized/code-examples/weather-agent.md +0 -576
  1031. package/.docs/organized/code-examples/workflow-ai-recruiter.md +0 -147
  1032. package/.docs/organized/code-examples/workflow-with-inline-steps.md +0 -99
  1033. package/.docs/organized/code-examples/workflow-with-memory.md +0 -381
  1034. package/.docs/organized/code-examples/workflow-with-separate-steps.md +0 -160
  1035. package/.docs/organized/code-examples/workflow-with-suspend-resume.md +0 -182
  1036. package/.docs/raw/agents/adding-voice.mdx +0 -290
  1037. package/.docs/raw/agents/agent-memory.mdx +0 -158
  1038. package/.docs/raw/agents/guardrails.mdx +0 -342
  1039. package/.docs/raw/agents/networks.mdx +0 -235
  1040. package/.docs/raw/agents/overview.mdx +0 -425
  1041. package/.docs/raw/agents/using-tools.mdx +0 -95
  1042. package/.docs/raw/auth/auth0.mdx +0 -235
  1043. package/.docs/raw/auth/clerk.mdx +0 -142
  1044. package/.docs/raw/auth/firebase.mdx +0 -285
  1045. package/.docs/raw/auth/index.mdx +0 -19
  1046. package/.docs/raw/auth/jwt.mdx +0 -101
  1047. package/.docs/raw/auth/supabase.mdx +0 -128
  1048. package/.docs/raw/auth/workos.mdx +0 -198
  1049. package/.docs/raw/community/contributing-templates.mdx +0 -193
  1050. package/.docs/raw/community/discord.mdx +0 -12
  1051. package/.docs/raw/community/licensing.mdx +0 -71
  1052. package/.docs/raw/course/01-first-agent/04-project-structure.md +0 -17
  1053. package/.docs/raw/course/01-first-agent/05-running-playground.md +0 -19
  1054. package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +0 -51
  1055. package/.docs/raw/course/01-first-agent/08-exporting-your-agent.md +0 -33
  1056. package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +0 -12
  1057. package/.docs/raw/course/01-first-agent/11-creating-transactions-tool.md +0 -41
  1058. package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +0 -29
  1059. package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +0 -15
  1060. package/.docs/raw/course/01-first-agent/15-installing-memory.md +0 -13
  1061. package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +0 -33
  1062. package/.docs/raw/course/01-first-agent/17-testing-memory.md +0 -15
  1063. package/.docs/raw/course/02-agent-tools-mcp/03-setting-up-mcp-configuration.md +0 -21
  1064. package/.docs/raw/course/02-agent-tools-mcp/04-initializing-mcp-tools.md +0 -11
  1065. package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +0 -20
  1066. package/.docs/raw/course/02-agent-tools-mcp/07-what-is-zapier-mcp.md +0 -14
  1067. package/.docs/raw/course/02-agent-tools-mcp/08-getting-zapier-mcp-url.md +0 -16
  1068. package/.docs/raw/course/02-agent-tools-mcp/09-updating-mcp-config-zapier.md +0 -17
  1069. package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +0 -29
  1070. package/.docs/raw/course/02-agent-tools-mcp/12-troubleshooting-zapier.md +0 -17
  1071. package/.docs/raw/course/02-agent-tools-mcp/13-what-is-github-mcp.md +0 -14
  1072. package/.docs/raw/course/02-agent-tools-mcp/14-getting-github-mcp-url.md +0 -35
  1073. package/.docs/raw/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +0 -20
  1074. package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +0 -33
  1075. package/.docs/raw/course/02-agent-tools-mcp/18-troubleshooting-github.md +0 -17
  1076. package/.docs/raw/course/02-agent-tools-mcp/20-updating-mcp-config-hackernews.md +0 -26
  1077. package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +0 -38
  1078. package/.docs/raw/course/02-agent-tools-mcp/26-updating-mcp-config-filesystem.md +0 -33
  1079. package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +0 -45
  1080. package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +0 -76
  1081. package/.docs/raw/course/02-agent-tools-mcp/32-conclusion.md +0 -17
  1082. package/.docs/raw/course/03-agent-memory/03-installing-memory.md +0 -13
  1083. package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +0 -36
  1084. package/.docs/raw/course/03-agent-memory/05-updating-mastra-export.md +0 -18
  1085. package/.docs/raw/course/03-agent-memory/07-understanding-memory-threads.md +0 -14
  1086. package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +0 -37
  1087. package/.docs/raw/course/03-agent-memory/09-using-memory-in-application.md +0 -19
  1088. package/.docs/raw/course/03-agent-memory/10-storage-configuration.md +0 -30
  1089. package/.docs/raw/course/03-agent-memory/12-handling-memory-frontend.md +0 -62
  1090. package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +0 -27
  1091. package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +0 -41
  1092. package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +0 -28
  1093. package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +0 -63
  1094. package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +0 -89
  1095. package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +0 -80
  1096. package/.docs/raw/course/03-agent-memory/26-updating-mastra-export-comprehensive.md +0 -32
  1097. package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +0 -103
  1098. package/.docs/raw/course/04-workflows/01-introduction-to-workflows.md +0 -44
  1099. package/.docs/raw/course/04-workflows/02-understanding-steps.md +0 -53
  1100. package/.docs/raw/course/04-workflows/03-creating-your-first-step.md +0 -57
  1101. package/.docs/raw/course/04-workflows/04-creating-a-second-step.md +0 -58
  1102. package/.docs/raw/course/04-workflows/05-chaining-steps-together.md +0 -57
  1103. package/.docs/raw/course/04-workflows/06-registering-with-mastra.md +0 -24
  1104. package/.docs/raw/course/04-workflows/07-using-playground.md +0 -58
  1105. package/.docs/raw/course/04-workflows/08-running-workflows-programmatically.md +0 -77
  1106. package/.docs/raw/course/04-workflows/09-adding-a-third-step.md +0 -70
  1107. package/.docs/raw/course/04-workflows/10-updating-the-workflow.md +0 -55
  1108. package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +0 -67
  1109. package/.docs/raw/course/04-workflows/12-using-agent-in-workflow.md +0 -91
  1110. package/.docs/raw/course/04-workflows/13-creating-ai-enhanced-workflow.md +0 -75
  1111. package/.docs/raw/course/04-workflows/14-understanding-parallel-execution.md +0 -38
  1112. package/.docs/raw/course/04-workflows/15-creating-parallel-steps.md +0 -115
  1113. package/.docs/raw/course/04-workflows/16-building-parallel-workflow.md +0 -100
  1114. package/.docs/raw/course/04-workflows/17-testing-parallel-performance.md +0 -40
  1115. package/.docs/raw/course/04-workflows/18-understanding-conditional-branching.md +0 -61
  1116. package/.docs/raw/course/04-workflows/19-creating-conditional-steps.md +0 -128
  1117. package/.docs/raw/course/04-workflows/20-building-conditional-workflow.md +0 -60
  1118. package/.docs/raw/course/04-workflows/21-testing-conditional-logic.md +0 -58
  1119. package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +0 -115
  1120. package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +0 -273
  1121. package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +0 -137
  1122. package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +0 -206
  1123. package/.docs/raw/deployment/cloud-providers/index.mdx +0 -52
  1124. package/.docs/raw/deployment/monorepo.mdx +0 -107
  1125. package/.docs/raw/deployment/overview.mdx +0 -82
  1126. package/.docs/raw/deployment/server-deployment.mdx +0 -86
  1127. package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +0 -87
  1128. package/.docs/raw/deployment/serverless-platforms/index.mdx +0 -52
  1129. package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +0 -94
  1130. package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +0 -109
  1131. package/.docs/raw/deployment/web-framework.mdx +0 -63
  1132. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +0 -675
  1133. package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +0 -125
  1134. package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -108
  1135. package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +0 -341
  1136. package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -165
  1137. package/.docs/raw/frameworks/servers/express.mdx +0 -208
  1138. package/.docs/raw/frameworks/web-frameworks/astro.mdx +0 -519
  1139. package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -336
  1140. package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +0 -461
  1141. package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +0 -242
  1142. package/.docs/raw/getting-started/installation.mdx +0 -316
  1143. package/.docs/raw/getting-started/mcp-docs-server.mdx +0 -183
  1144. package/.docs/raw/getting-started/project-structure.mdx +0 -72
  1145. package/.docs/raw/getting-started/templates.mdx +0 -70
  1146. package/.docs/raw/index.mdx +0 -58
  1147. package/.docs/raw/mastra-cloud/dashboard.mdx +0 -100
  1148. package/.docs/raw/mastra-cloud/observability.mdx +0 -52
  1149. package/.docs/raw/mastra-cloud/overview.mdx +0 -71
  1150. package/.docs/raw/mastra-cloud/setting-up.mdx +0 -92
  1151. package/.docs/raw/memory/conversation-history.mdx +0 -23
  1152. package/.docs/raw/memory/memory-processors.mdx +0 -136
  1153. package/.docs/raw/memory/overview.mdx +0 -119
  1154. package/.docs/raw/memory/semantic-recall.mdx +0 -226
  1155. package/.docs/raw/memory/threads-and-resources.mdx +0 -94
  1156. package/.docs/raw/memory/working-memory.mdx +0 -378
  1157. package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +0 -81
  1158. package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +0 -120
  1159. package/.docs/raw/observability/ai-tracing/exporters/default.mdx +0 -168
  1160. package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +0 -121
  1161. package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +0 -88
  1162. package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +0 -253
  1163. package/.docs/raw/observability/ai-tracing/overview.mdx +0 -565
  1164. package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +0 -274
  1165. package/.docs/raw/observability/logging.mdx +0 -113
  1166. package/.docs/raw/observability/nextjs-tracing.mdx +0 -109
  1167. package/.docs/raw/observability/otel-tracing.mdx +0 -190
  1168. package/.docs/raw/observability/overview.mdx +0 -66
  1169. package/.docs/raw/rag/chunking-and-embedding.mdx +0 -208
  1170. package/.docs/raw/rag/overview.mdx +0 -87
  1171. package/.docs/raw/rag/retrieval.mdx +0 -543
  1172. package/.docs/raw/rag/vector-databases.mdx +0 -529
  1173. package/.docs/raw/reference/agents/agent.mdx +0 -230
  1174. package/.docs/raw/reference/agents/generate.mdx +0 -577
  1175. package/.docs/raw/reference/agents/generateLegacy.mdx +0 -528
  1176. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +0 -67
  1177. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +0 -67
  1178. package/.docs/raw/reference/agents/getDescription.mdx +0 -34
  1179. package/.docs/raw/reference/agents/getInstructions.mdx +0 -67
  1180. package/.docs/raw/reference/agents/getLLM.mdx +0 -74
  1181. package/.docs/raw/reference/agents/getMemory.mdx +0 -67
  1182. package/.docs/raw/reference/agents/getModel.mdx +0 -67
  1183. package/.docs/raw/reference/agents/getScorers.mdx +0 -67
  1184. package/.docs/raw/reference/agents/getTools.mdx +0 -67
  1185. package/.docs/raw/reference/agents/getVoice.mdx +0 -67
  1186. package/.docs/raw/reference/agents/getWorkflows.mdx +0 -67
  1187. package/.docs/raw/reference/agents/listAgents.mdx +0 -68
  1188. package/.docs/raw/reference/agents/network.mdx +0 -290
  1189. package/.docs/raw/reference/auth/auth0.mdx +0 -117
  1190. package/.docs/raw/reference/auth/clerk.mdx +0 -71
  1191. package/.docs/raw/reference/auth/firebase.mdx +0 -128
  1192. package/.docs/raw/reference/auth/jwt.mdx +0 -41
  1193. package/.docs/raw/reference/auth/supabase.mdx +0 -62
  1194. package/.docs/raw/reference/auth/workos.mdx +0 -128
  1195. package/.docs/raw/reference/cli/create-mastra.mdx +0 -177
  1196. package/.docs/raw/reference/cli/mastra.mdx +0 -258
  1197. package/.docs/raw/reference/client-js/agents.mdx +0 -220
  1198. package/.docs/raw/reference/client-js/error-handling.mdx +0 -23
  1199. package/.docs/raw/reference/client-js/logs.mdx +0 -29
  1200. package/.docs/raw/reference/client-js/mastra-client.mdx +0 -157
  1201. package/.docs/raw/reference/client-js/memory.mdx +0 -130
  1202. package/.docs/raw/reference/client-js/observability.mdx +0 -76
  1203. package/.docs/raw/reference/client-js/telemetry.mdx +0 -25
  1204. package/.docs/raw/reference/client-js/tools.mdx +0 -49
  1205. package/.docs/raw/reference/client-js/vectors.mdx +0 -84
  1206. package/.docs/raw/reference/client-js/workflows-legacy.mdx +0 -143
  1207. package/.docs/raw/reference/client-js/workflows.mdx +0 -175
  1208. package/.docs/raw/reference/core/getAgent.mdx +0 -43
  1209. package/.docs/raw/reference/core/getAgentById.mdx +0 -43
  1210. package/.docs/raw/reference/core/getAgents.mdx +0 -35
  1211. package/.docs/raw/reference/core/getDeployer.mdx +0 -35
  1212. package/.docs/raw/reference/core/getLogger.mdx +0 -35
  1213. package/.docs/raw/reference/core/getLogs.mdx +0 -92
  1214. package/.docs/raw/reference/core/getLogsByRunId.mdx +0 -84
  1215. package/.docs/raw/reference/core/getMCPServer.mdx +0 -49
  1216. package/.docs/raw/reference/core/getMCPServers.mdx +0 -35
  1217. package/.docs/raw/reference/core/getMemory.mdx +0 -35
  1218. package/.docs/raw/reference/core/getScorer.mdx +0 -75
  1219. package/.docs/raw/reference/core/getScorerByName.mdx +0 -75
  1220. package/.docs/raw/reference/core/getScorers.mdx +0 -42
  1221. package/.docs/raw/reference/core/getServer.mdx +0 -35
  1222. package/.docs/raw/reference/core/getStorage.mdx +0 -35
  1223. package/.docs/raw/reference/core/getTelemetry.mdx +0 -35
  1224. package/.docs/raw/reference/core/getVector.mdx +0 -43
  1225. package/.docs/raw/reference/core/getVectors.mdx +0 -35
  1226. package/.docs/raw/reference/core/getWorkflow.mdx +0 -48
  1227. package/.docs/raw/reference/core/getWorkflows.mdx +0 -43
  1228. package/.docs/raw/reference/core/mastra-class.mdx +0 -143
  1229. package/.docs/raw/reference/core/setLogger.mdx +0 -47
  1230. package/.docs/raw/reference/core/setStorage.mdx +0 -39
  1231. package/.docs/raw/reference/core/setTelemetry.mdx +0 -35
  1232. package/.docs/raw/reference/deployer/cloudflare.mdx +0 -91
  1233. package/.docs/raw/reference/deployer/deployer.mdx +0 -165
  1234. package/.docs/raw/reference/deployer/netlify.mdx +0 -20
  1235. package/.docs/raw/reference/deployer/vercel.mdx +0 -46
  1236. package/.docs/raw/reference/evals/answer-relevancy.mdx +0 -190
  1237. package/.docs/raw/reference/evals/bias.mdx +0 -195
  1238. package/.docs/raw/reference/evals/completeness.mdx +0 -184
  1239. package/.docs/raw/reference/evals/content-similarity.mdx +0 -185
  1240. package/.docs/raw/reference/evals/context-position.mdx +0 -198
  1241. package/.docs/raw/reference/evals/context-precision.mdx +0 -196
  1242. package/.docs/raw/reference/evals/context-relevancy.mdx +0 -197
  1243. package/.docs/raw/reference/evals/contextual-recall.mdx +0 -197
  1244. package/.docs/raw/reference/evals/faithfulness.mdx +0 -200
  1245. package/.docs/raw/reference/evals/hallucination.mdx +0 -227
  1246. package/.docs/raw/reference/evals/keyword-coverage.mdx +0 -186
  1247. package/.docs/raw/reference/evals/prompt-alignment.mdx +0 -248
  1248. package/.docs/raw/reference/evals/summarization.mdx +0 -214
  1249. package/.docs/raw/reference/evals/textual-difference.mdx +0 -172
  1250. package/.docs/raw/reference/evals/tone-consistency.mdx +0 -190
  1251. package/.docs/raw/reference/evals/toxicity.mdx +0 -173
  1252. package/.docs/raw/reference/index.mdx +0 -12
  1253. package/.docs/raw/reference/legacyWorkflows/after.mdx +0 -89
  1254. package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +0 -79
  1255. package/.docs/raw/reference/legacyWorkflows/commit.mdx +0 -33
  1256. package/.docs/raw/reference/legacyWorkflows/createRun.mdx +0 -76
  1257. package/.docs/raw/reference/legacyWorkflows/else.mdx +0 -68
  1258. package/.docs/raw/reference/legacyWorkflows/events.mdx +0 -305
  1259. package/.docs/raw/reference/legacyWorkflows/execute.mdx +0 -110
  1260. package/.docs/raw/reference/legacyWorkflows/if.mdx +0 -108
  1261. package/.docs/raw/reference/legacyWorkflows/resume.mdx +0 -158
  1262. package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +0 -133
  1263. package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +0 -207
  1264. package/.docs/raw/reference/legacyWorkflows/start.mdx +0 -87
  1265. package/.docs/raw/reference/legacyWorkflows/step-class.mdx +0 -100
  1266. package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +0 -137
  1267. package/.docs/raw/reference/legacyWorkflows/step-function.mdx +0 -93
  1268. package/.docs/raw/reference/legacyWorkflows/step-options.mdx +0 -69
  1269. package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +0 -196
  1270. package/.docs/raw/reference/legacyWorkflows/suspend.mdx +0 -70
  1271. package/.docs/raw/reference/legacyWorkflows/then.mdx +0 -72
  1272. package/.docs/raw/reference/legacyWorkflows/until.mdx +0 -168
  1273. package/.docs/raw/reference/legacyWorkflows/watch.mdx +0 -124
  1274. package/.docs/raw/reference/legacyWorkflows/while.mdx +0 -168
  1275. package/.docs/raw/reference/legacyWorkflows/workflow.mdx +0 -234
  1276. package/.docs/raw/reference/memory/Memory.mdx +0 -206
  1277. package/.docs/raw/reference/memory/createThread.mdx +0 -119
  1278. package/.docs/raw/reference/memory/deleteMessages.mdx +0 -60
  1279. package/.docs/raw/reference/memory/getThreadById.mdx +0 -46
  1280. package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +0 -78
  1281. package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +0 -109
  1282. package/.docs/raw/reference/memory/query.mdx +0 -174
  1283. package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +0 -182
  1284. package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +0 -234
  1285. package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +0 -112
  1286. package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +0 -176
  1287. package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +0 -148
  1288. package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +0 -196
  1289. package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +0 -116
  1290. package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +0 -112
  1291. package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +0 -361
  1292. package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +0 -651
  1293. package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +0 -178
  1294. package/.docs/raw/reference/observability/ai-tracing/span.mdx +0 -371
  1295. package/.docs/raw/reference/observability/logging/pino-logger.mdx +0 -148
  1296. package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +0 -117
  1297. package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +0 -81
  1298. package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +0 -120
  1299. package/.docs/raw/reference/observability/otel-tracing/providers/braintrust.mdx +0 -40
  1300. package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +0 -40
  1301. package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +0 -22
  1302. package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +0 -73
  1303. package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +0 -41
  1304. package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +0 -84
  1305. package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +0 -48
  1306. package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +0 -43
  1307. package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +0 -40
  1308. package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +0 -40
  1309. package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +0 -40
  1310. package/.docs/raw/reference/processors/batch-parts-processor.mdx +0 -111
  1311. package/.docs/raw/reference/processors/language-detector.mdx +0 -154
  1312. package/.docs/raw/reference/processors/moderation-processor.mdx +0 -145
  1313. package/.docs/raw/reference/processors/pii-detector.mdx +0 -153
  1314. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +0 -130
  1315. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +0 -145
  1316. package/.docs/raw/reference/processors/token-limiter-processor.mdx +0 -136
  1317. package/.docs/raw/reference/processors/unicode-normalizer.mdx +0 -114
  1318. package/.docs/raw/reference/rag/chunk.mdx +0 -445
  1319. package/.docs/raw/reference/rag/database-config.mdx +0 -334
  1320. package/.docs/raw/reference/rag/document.mdx +0 -131
  1321. package/.docs/raw/reference/rag/embeddings.mdx +0 -168
  1322. package/.docs/raw/reference/rag/extract-params.mdx +0 -254
  1323. package/.docs/raw/reference/rag/graph-rag.mdx +0 -186
  1324. package/.docs/raw/reference/rag/metadata-filters.mdx +0 -347
  1325. package/.docs/raw/reference/rag/rerank.mdx +0 -213
  1326. package/.docs/raw/reference/rag/rerankWithScorer.mdx +0 -213
  1327. package/.docs/raw/reference/scorers/answer-relevancy.mdx +0 -209
  1328. package/.docs/raw/reference/scorers/answer-similarity.mdx +0 -423
  1329. package/.docs/raw/reference/scorers/bias.mdx +0 -225
  1330. package/.docs/raw/reference/scorers/completeness.mdx +0 -209
  1331. package/.docs/raw/reference/scorers/content-similarity.mdx +0 -195
  1332. package/.docs/raw/reference/scorers/context-precision.mdx +0 -343
  1333. package/.docs/raw/reference/scorers/context-relevance.mdx +0 -599
  1334. package/.docs/raw/reference/scorers/create-scorer.mdx +0 -495
  1335. package/.docs/raw/reference/scorers/faithfulness.mdx +0 -233
  1336. package/.docs/raw/reference/scorers/hallucination.mdx +0 -247
  1337. package/.docs/raw/reference/scorers/keyword-coverage.mdx +0 -224
  1338. package/.docs/raw/reference/scorers/mastra-scorer.mdx +0 -182
  1339. package/.docs/raw/reference/scorers/noise-sensitivity.mdx +0 -766
  1340. package/.docs/raw/reference/scorers/prompt-alignment.mdx +0 -614
  1341. package/.docs/raw/reference/scorers/run-experiment.mdx +0 -216
  1342. package/.docs/raw/reference/scorers/textual-difference.mdx +0 -204
  1343. package/.docs/raw/reference/scorers/tone-consistency.mdx +0 -208
  1344. package/.docs/raw/reference/scorers/tool-call-accuracy.mdx +0 -567
  1345. package/.docs/raw/reference/scorers/toxicity.mdx +0 -224
  1346. package/.docs/raw/reference/storage/cloudflare-d1.mdx +0 -104
  1347. package/.docs/raw/reference/storage/cloudflare.mdx +0 -95
  1348. package/.docs/raw/reference/storage/dynamodb.mdx +0 -196
  1349. package/.docs/raw/reference/storage/lance.mdx +0 -101
  1350. package/.docs/raw/reference/storage/libsql.mdx +0 -74
  1351. package/.docs/raw/reference/storage/mssql.mdx +0 -112
  1352. package/.docs/raw/reference/storage/postgresql.mdx +0 -305
  1353. package/.docs/raw/reference/storage/upstash.mdx +0 -91
  1354. package/.docs/raw/reference/streaming/ChunkType.mdx +0 -854
  1355. package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +0 -321
  1356. package/.docs/raw/reference/streaming/agents/stream.mdx +0 -698
  1357. package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +0 -515
  1358. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +0 -49
  1359. package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
  1360. package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +0 -118
  1361. package/.docs/raw/reference/streaming/workflows/stream.mdx +0 -125
  1362. package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -144
  1363. package/.docs/raw/reference/templates/overview.mdx +0 -228
  1364. package/.docs/raw/reference/tools/client.mdx +0 -336
  1365. package/.docs/raw/reference/tools/create-tool.mdx +0 -130
  1366. package/.docs/raw/reference/tools/document-chunker-tool.mdx +0 -141
  1367. package/.docs/raw/reference/tools/graph-rag-tool.mdx +0 -262
  1368. package/.docs/raw/reference/tools/mcp-client.mdx +0 -830
  1369. package/.docs/raw/reference/tools/mcp-server.mdx +0 -1079
  1370. package/.docs/raw/reference/tools/vector-query-tool.mdx +0 -604
  1371. package/.docs/raw/reference/vectors/astra.mdx +0 -258
  1372. package/.docs/raw/reference/vectors/chroma.mdx +0 -422
  1373. package/.docs/raw/reference/vectors/couchbase.mdx +0 -345
  1374. package/.docs/raw/reference/vectors/lance.mdx +0 -451
  1375. package/.docs/raw/reference/vectors/libsql.mdx +0 -355
  1376. package/.docs/raw/reference/vectors/mongodb.mdx +0 -309
  1377. package/.docs/raw/reference/vectors/opensearch.mdx +0 -200
  1378. package/.docs/raw/reference/vectors/pg.mdx +0 -632
  1379. package/.docs/raw/reference/vectors/pinecone.mdx +0 -286
  1380. package/.docs/raw/reference/vectors/qdrant.mdx +0 -236
  1381. package/.docs/raw/reference/vectors/s3vectors.mdx +0 -386
  1382. package/.docs/raw/reference/vectors/turbopuffer.mdx +0 -249
  1383. package/.docs/raw/reference/vectors/upstash.mdx +0 -354
  1384. package/.docs/raw/reference/vectors/vectorize.mdx +0 -298
  1385. package/.docs/raw/reference/voice/azure.mdx +0 -218
  1386. package/.docs/raw/reference/voice/cloudflare.mdx +0 -154
  1387. package/.docs/raw/reference/voice/composite-voice.mdx +0 -144
  1388. package/.docs/raw/reference/voice/deepgram.mdx +0 -166
  1389. package/.docs/raw/reference/voice/elevenlabs.mdx +0 -218
  1390. package/.docs/raw/reference/voice/google-gemini-live.mdx +0 -629
  1391. package/.docs/raw/reference/voice/google.mdx +0 -203
  1392. package/.docs/raw/reference/voice/mastra-voice.mdx +0 -413
  1393. package/.docs/raw/reference/voice/murf.mdx +0 -253
  1394. package/.docs/raw/reference/voice/openai-realtime.mdx +0 -376
  1395. package/.docs/raw/reference/voice/openai.mdx +0 -169
  1396. package/.docs/raw/reference/voice/playai.mdx +0 -163
  1397. package/.docs/raw/reference/voice/sarvam.mdx +0 -260
  1398. package/.docs/raw/reference/voice/speechify.mdx +0 -147
  1399. package/.docs/raw/reference/voice/voice.addInstructions.mdx +0 -72
  1400. package/.docs/raw/reference/voice/voice.addTools.mdx +0 -83
  1401. package/.docs/raw/reference/voice/voice.answer.mdx +0 -69
  1402. package/.docs/raw/reference/voice/voice.close.mdx +0 -56
  1403. package/.docs/raw/reference/voice/voice.connect.mdx +0 -123
  1404. package/.docs/raw/reference/voice/voice.events.mdx +0 -85
  1405. package/.docs/raw/reference/voice/voice.getSpeakers.mdx +0 -298
  1406. package/.docs/raw/reference/voice/voice.listen.mdx +0 -201
  1407. package/.docs/raw/reference/voice/voice.off.mdx +0 -74
  1408. package/.docs/raw/reference/voice/voice.on.mdx +0 -132
  1409. package/.docs/raw/reference/voice/voice.send.mdx +0 -81
  1410. package/.docs/raw/reference/voice/voice.speak.mdx +0 -206
  1411. package/.docs/raw/reference/voice/voice.updateConfig.mdx +0 -92
  1412. package/.docs/raw/reference/workflows/run-methods/cancel.mdx +0 -58
  1413. package/.docs/raw/reference/workflows/run-methods/resume.mdx +0 -137
  1414. package/.docs/raw/reference/workflows/run-methods/start.mdx +0 -134
  1415. package/.docs/raw/reference/workflows/run-methods/watch.mdx +0 -74
  1416. package/.docs/raw/reference/workflows/run.mdx +0 -104
  1417. package/.docs/raw/reference/workflows/step.mdx +0 -155
  1418. package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +0 -48
  1419. package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +0 -30
  1420. package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +0 -65
  1421. package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +0 -52
  1422. package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +0 -52
  1423. package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +0 -60
  1424. package/.docs/raw/reference/workflows/workflow-methods/map.mdx +0 -43
  1425. package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +0 -43
  1426. package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +0 -70
  1427. package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +0 -61
  1428. package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +0 -61
  1429. package/.docs/raw/reference/workflows/workflow-methods/then.mdx +0 -44
  1430. package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +0 -66
  1431. package/.docs/raw/reference/workflows/workflow.mdx +0 -132
  1432. package/.docs/raw/scorers/custom-scorers.mdx +0 -473
  1433. package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +0 -26
  1434. package/.docs/raw/scorers/evals-old-api/overview.mdx +0 -106
  1435. package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +0 -85
  1436. package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +0 -58
  1437. package/.docs/raw/scorers/off-the-shelf-scorers.mdx +0 -48
  1438. package/.docs/raw/scorers/overview.mdx +0 -138
  1439. package/.docs/raw/server-db/custom-api-routes.mdx +0 -67
  1440. package/.docs/raw/server-db/local-dev-playground.mdx +0 -233
  1441. package/.docs/raw/server-db/mastra-client.mdx +0 -274
  1442. package/.docs/raw/server-db/middleware.mdx +0 -173
  1443. package/.docs/raw/server-db/production-server.mdx +0 -91
  1444. package/.docs/raw/server-db/runtime-context.mdx +0 -190
  1445. package/.docs/raw/server-db/storage.mdx +0 -514
  1446. package/.docs/raw/streaming/events.mdx +0 -223
  1447. package/.docs/raw/streaming/overview.mdx +0 -177
  1448. package/.docs/raw/streaming/tool-streaming.mdx +0 -143
  1449. package/.docs/raw/streaming/workflow-streaming.mdx +0 -124
  1450. package/.docs/raw/tools-mcp/advanced-usage.mdx +0 -128
  1451. package/.docs/raw/tools-mcp/mcp-overview.mdx +0 -370
  1452. package/.docs/raw/tools-mcp/overview.mdx +0 -93
  1453. package/.docs/raw/voice/overview.mdx +0 -944
  1454. package/.docs/raw/voice/speech-to-speech.mdx +0 -105
  1455. package/.docs/raw/voice/speech-to-text.mdx +0 -86
  1456. package/.docs/raw/voice/text-to-speech.mdx +0 -90
  1457. package/.docs/raw/workflows/control-flow.mdx +0 -265
  1458. package/.docs/raw/workflows/error-handling.mdx +0 -213
  1459. package/.docs/raw/workflows/inngest-workflow.mdx +0 -359
  1460. package/.docs/raw/workflows/input-data-mapping.mdx +0 -107
  1461. package/.docs/raw/workflows/overview.mdx +0 -277
  1462. package/.docs/raw/workflows/snapshots.mdx +0 -250
  1463. package/.docs/raw/workflows/suspend-and-resume.mdx +0 -298
  1464. package/.docs/raw/workflows/using-with-agents-and-tools.mdx +0 -350
  1465. package/.docs/raw/workflows-legacy/control-flow.mdx +0 -776
  1466. package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +0 -237
  1467. package/.docs/raw/workflows-legacy/error-handling.mdx +0 -185
  1468. package/.docs/raw/workflows-legacy/nested-workflows.mdx +0 -354
  1469. package/.docs/raw/workflows-legacy/overview.mdx +0 -180
  1470. package/.docs/raw/workflows-legacy/runtime-variables.mdx +0 -154
  1471. package/.docs/raw/workflows-legacy/steps.mdx +0 -113
  1472. package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +0 -404
  1473. package/.docs/raw/workflows-legacy/variables.mdx +0 -316
  1474. package/LICENSE.md +0 -15
  1475. package/dist/chunk-TUAHUTTB.js +0 -356
  1476. package/dist/prepare-docs/code-examples.d.ts +0 -5
  1477. package/dist/prepare-docs/code-examples.d.ts.map +0 -1
  1478. package/dist/prepare-docs/copy-raw.d.ts +0 -2
  1479. package/dist/prepare-docs/copy-raw.d.ts.map +0 -1
  1480. package/dist/prepare-docs/package-changes.d.ts +0 -5
  1481. package/dist/prepare-docs/package-changes.d.ts.map +0 -1
  1482. package/dist/prepare-docs/prepare.d.ts +0 -2
  1483. package/dist/prepare-docs/prepare.d.ts.map +0 -1
  1484. package/dist/prepare-docs/prepare.js +0 -1
  1485. package/dist/tools/__tests__/test-setup.d.ts +0 -5
  1486. package/dist/tools/__tests__/test-setup.d.ts.map +0 -1
  1487. package/dist/tools/blog.d.ts +0 -22
  1488. package/dist/tools/blog.d.ts.map +0 -1
  1489. package/dist/tools/changes.d.ts +0 -22
  1490. package/dist/tools/changes.d.ts.map +0 -1
  1491. package/dist/tools/examples.d.ts +0 -28
  1492. package/dist/tools/examples.d.ts.map +0 -1
  1493. /package/.docs/{raw/course → course}/01-first-agent/01-introduction-to-mastra.md +0 -0
  1494. /package/.docs/{raw/course → course}/01-first-agent/02-what-is-mastra.md +0 -0
  1495. /package/.docs/{raw/course → course}/01-first-agent/03-verifying-installation.md +0 -0
  1496. /package/.docs/{raw/course → course}/01-first-agent/06-understanding-system-prompts.md +0 -0
  1497. /package/.docs/{raw/course → course}/01-first-agent/10-understanding-tools.md +0 -0
  1498. /package/.docs/{raw/course → course}/01-first-agent/14-understanding-memory.md +0 -0
  1499. /package/.docs/{raw/course → course}/01-first-agent/18-conclusion.md +0 -0
  1500. /package/.docs/{raw/course → course}/02-agent-tools-mcp/01-introduction-to-mcp.md +0 -0
  1501. /package/.docs/{raw/course → course}/02-agent-tools-mcp/02-installing-mcp.md +0 -0
  1502. /package/.docs/{raw/course → course}/02-agent-tools-mcp/06-testing-mcp-setup.md +0 -0
  1503. /package/.docs/{raw/course → course}/02-agent-tools-mcp/11-testing-zapier-integration.md +0 -0
  1504. /package/.docs/{raw/course → course}/02-agent-tools-mcp/17-testing-github-integration.md +0 -0
  1505. /package/.docs/{raw/course → course}/02-agent-tools-mcp/19-what-is-hackernews-mcp.md +0 -0
  1506. /package/.docs/{raw/course → course}/02-agent-tools-mcp/22-testing-hackernews-integration.md +0 -0
  1507. /package/.docs/{raw/course → course}/02-agent-tools-mcp/23-troubleshooting-hackernews.md +0 -0
  1508. /package/.docs/{raw/course → course}/02-agent-tools-mcp/24-what-is-filesystem-mcp.md +0 -0
  1509. /package/.docs/{raw/course → course}/02-agent-tools-mcp/25-creating-notes-directory.md +0 -0
  1510. /package/.docs/{raw/course → course}/02-agent-tools-mcp/28-testing-filesystem-integration.md +0 -0
  1511. /package/.docs/{raw/course → course}/02-agent-tools-mcp/29-troubleshooting-filesystem.md +0 -0
  1512. /package/.docs/{raw/course → course}/03-agent-memory/01-understanding-memory.md +0 -0
  1513. /package/.docs/{raw/course → course}/03-agent-memory/02-why-memory-matters.md +0 -0
  1514. /package/.docs/{raw/course → course}/03-agent-memory/06-testing-memory-agent.md +0 -0
  1515. /package/.docs/{raw/course → course}/03-agent-memory/11-testing-conversation-history.md +0 -0
  1516. /package/.docs/{raw/course → course}/03-agent-memory/14-what-is-semantic-recall.md +0 -0
  1517. /package/.docs/{raw/course → course}/03-agent-memory/15-how-semantic-recall-works.md +0 -0
  1518. /package/.docs/{raw/course → course}/03-agent-memory/17-testing-semantic-recall.md +0 -0
  1519. /package/.docs/{raw/course → course}/03-agent-memory/19-what-is-working-memory.md +0 -0
  1520. /package/.docs/{raw/course → course}/03-agent-memory/20-how-working-memory-works.md +0 -0
  1521. /package/.docs/{raw/course → course}/03-agent-memory/23-testing-working-memory.md +0 -0
  1522. /package/.docs/{raw/course → course}/03-agent-memory/24-working-memory-in-practice.md +0 -0
  1523. /package/.docs/{raw/course → course}/03-agent-memory/28-testing-memory-enhanced-agents.md +0 -0
  1524. /package/.docs/{raw/course → course}/03-agent-memory/29-memory-best-practices.md +0 -0
  1525. /package/.docs/{raw/course → course}/03-agent-memory/30-conclusion.md +0 -0
  1526. /package/.docs/{raw/course → course}/04-workflows/22-conclusion.md +0 -0
@@ -0,0 +1,1668 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # MCPServer
4
+
5
+ The `MCPServer` class provides the functionality to expose your existing Mastra tools and Agents as a Model Context Protocol (MCP) server. This allows any MCP client (like Cursor, Windsurf, or Claude Desktop) to connect to these capabilities and make them available to an agent.
6
+
7
+ Note that if you only need to use your tools or agents directly within your Mastra application, you don't necessarily need to create an MCP server. This API is specifically for exposing your Mastra tools and agents to _external_ MCP clients.
8
+
9
+ It supports both [stdio (subprocess) and SSE (HTTP) MCP transports](https://modelcontextprotocol.io/docs/concepts/transports).
10
+
11
+ ## Constructor
12
+
13
+ To create a new `MCPServer`, you need to provide some basic information about your server, the tools it will offer, and optionally, any agents you want to expose as tools.
14
+
15
+ ```typescript
16
+ import { Agent } from '@mastra/core/agent'
17
+ import { createTool } from '@mastra/core/tools'
18
+ import { MCPServer } from '@mastra/mcp'
19
+ import { z } from 'zod'
20
+ import { dataProcessingWorkflow } from '../workflows/dataProcessingWorkflow'
21
+
22
+ const myAgent = new Agent({
23
+ id: 'my-example-agent',
24
+ name: 'MyExampleAgent',
25
+ description: 'A generalist to help with basic questions.',
26
+ instructions: 'You are a helpful assistant.',
27
+ model: 'openai/gpt-5.6-sol',
28
+ })
29
+
30
+ const weatherTool = createTool({
31
+ id: 'getWeather',
32
+ description: 'Gets the current weather for a location.',
33
+ inputSchema: z.object({ location: z.string() }),
34
+ execute: async inputData => `Weather in ${inputData.location} is sunny.`,
35
+ })
36
+
37
+ const server = new MCPServer({
38
+ id: 'my-custom-server',
39
+ name: 'My Custom Server',
40
+ version: '1.0.0',
41
+ description: 'A server that provides weather data and agent capabilities',
42
+ instructions:
43
+ 'Use the available tools to help users with weather information and data processing tasks.',
44
+ tools: { weatherTool },
45
+ agents: { myAgent }, // this agent will become tool "ask_myAgent"
46
+ workflows: {
47
+ dataProcessingWorkflow, // this workflow will become tool "run_dataProcessingWorkflow"
48
+ },
49
+ })
50
+ ```
51
+
52
+ ### Configuration Properties
53
+
54
+ The constructor accepts an `MCPServerConfig` object with the following properties:
55
+
56
+ **id** (`string`): Unique identifier for the server. This ID is preserved when the server is registered with Mastra and can be used to retrieve the server via getMCPServerById().
57
+
58
+ **name** (`string`): A descriptive name for your server (e.g., 'My Weather and Agent Server').
59
+
60
+ **version** (`string`): The semantic version of your server (e.g., '1.0.0').
61
+
62
+ **tools** (`ToolsInput`): An object where keys are tool names and values are Mastra tool definitions (created with createTool or Vercel AI SDK). These tools will be directly exposed.
63
+
64
+ **agents** (`Record<string, Agent>`): An object where keys are agent identifiers and values are Mastra Agent instances. Each agent will be automatically converted into a tool named ask\_\<agentIdentifier>. The agent \*\*must\*\* have a non-empty description string property defined in its constructor configuration. This description will be used in the tool's description. If an agent's description is missing or empty, an error will be thrown during MCPServer initialization.
65
+
66
+ **workflows** (`Record<string, Workflow>`): An object where keys are workflow identifiers and values are Mastra Workflow instances. Each workflow is converted into a tool named run\_\<workflowKey>. The workflow's inputSchema becomes the tool's input schema. The workflow \*\*must\*\* have a non-empty description string property, which is used for the tool's description. If a workflow's description is missing or empty, an error will be thrown. The tool executes the workflow by calling workflow\.createRun() followed by run.start({ inputData: \<tool\_input> }). If a tool name derived from an agent or workflow (e.g., ask\_myAgent or run\_myWorkflow) collides with an explicitly defined tool name or another derived name, the explicitly defined tool takes precedence, and a warning is logged. Agents/workflows leading to subsequent collisions are skipped.
67
+
68
+ **description** (`string`): Optional description of what the MCP server does.
69
+
70
+ **instructions** (`string`): Optional instructions describing how to use the server and its features.
71
+
72
+ **mapAuthInfoToUser** (`({ authInfo, extra, requestContext }) => unknown | null | undefined | Promise<unknown | null | undefined>`): Maps MCP transport auth data from extra.authInfo into the user value used by Mastra FGA checks. Use this when an OAuth-protected MCP server is registered on a Mastra instance with an FGA provider.
73
+
74
+ **fga** (`{ resourceMapping?: Partial<Record<'tool' | 'tools', { fgaResourceType: string; deriveId?: ({ user, resourceId, requestContext }) => string | undefined }>>; permissionMapping?: Record<string, string> }`): Overrides resource and permission mappings for this MCP server's tools/list and tools/call FGA checks. Use this when MCP authorization should be scoped differently from internal agent or workflow tool execution.
75
+
76
+ **repository** (`Repository`): Optional repository information for the server's source code.
77
+
78
+ **releaseDate** (`string`): Optional release date of this server version (ISO 8601 string). Defaults to the time of instantiation if not provided.
79
+
80
+ **isLatest** (`boolean`): Optional flag indicating if this is the latest version. Defaults to true if not provided.
81
+
82
+ **packageCanonical** (`'npm' | 'docker' | 'pypi' | 'crates' | string`): Optional canonical packaging format if the server is distributed as a package (e.g., 'npm', 'docker').
83
+
84
+ **packages** (`PackageInfo[]`): Optional list of installable packages for this server.
85
+
86
+ **remotes** (`RemoteInfo[]`): Optional list of remote access points for this server.
87
+
88
+ **resources** (`MCPServerResources`): An object defining how the server should handle MCP resources. See Resource Handling section for details.
89
+
90
+ **prompts** (`MCPServerPrompts`): An object defining how the server should handle MCP prompts. See Prompt Handling section for details.
91
+
92
+ **appResources** (`AppResources`): A map of ui:// URIs to app resource configurations. Each entry defines an interactive HTML UI served via the MCP Apps extension (SEP-1865). See the MCP Apps section for details.
93
+
94
+ ## Exposing agents as tools
95
+
96
+ A powerful feature of `MCPServer` is its ability to automatically expose your Mastra Agents as callable tools. When you provide agents in the `agents` property of the configuration:
97
+
98
+ - **Tool Naming**: Each agent is converted into a tool named `ask_<agentKey>`, where `<agentKey>` is the key you used for that agent in the `agents` object. For instance, if you configure `agents: { myAgentKey: myAgentInstance }`, a tool named `ask_myAgentKey` will be created.
99
+
100
+ - **Tool Functionality**:
101
+
102
+ - **Description**: The generated tool's description will be in the format: "Ask agent `<AgentName>` a question. Original agent instructions: `<agent description>`".
103
+ - **Input**: The tool expects a single object argument with a `message` property (string): `{ message: "Your question for the agent" }`.
104
+ - **Execution**: When this tool is called, it invokes the corresponding agent's `generate()` method with the provided `query`.
105
+ - **Output**: The direct result from the agent's `generate()` method is returned as the output of the tool.
106
+
107
+ - **Name collisions.** If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., a tool named `ask_myAgentKey` alongside an agent keyed as `myAgentKey`), the _explicitly defined tool will take precedence_. The agent won't be converted into a tool in this conflicting case, and a warning will be logged.
108
+
109
+ This makes it straightforward to allow MCP clients to interact with your agents using natural language queries, like any other tool.
110
+
111
+ ### Agent-to-Tool Conversion
112
+
113
+ When you provide agents in the `agents` configuration property, `MCPServer` will automatically create a corresponding tool for each agent. The tool will be `ask_<agentIdentifier>`, where `<agentIdentifier>` is the key you used in the `agents` object.
114
+
115
+ The description for this generated tool will be: "Ask agent `<agent.name>` a question. Agent description: `<agent.description>`".
116
+
117
+ For an agent to be converted into a tool, it **must** have a non-empty `description` string property set in its configuration when it was instantiated (e.g., `new Agent({ id: 'my-agent', name: 'myAgent', description: 'This agent does X.', ... })`). If an agent is passed to `MCPServer` with a missing or empty `description`, an error will be thrown when the `MCPServer` is instantiated, and server setup will fail.
118
+
119
+ This allows you to quickly expose the generative capabilities of your agents through the MCP, enabling clients to "ask" your agents questions directly.
120
+
121
+ ### Accessing MCP Context in Tools
122
+
123
+ Tools exposed through `MCPServer` can access MCP request context (authentication, session IDs, etc.) via two different properties depending on how the tool is invoked:
124
+
125
+ | Call Pattern | Access Method |
126
+ | ---------------- | ------------------------------------------- |
127
+ | Direct tool call | `context?.mcp?.extra` |
128
+ | Agent tool call | `context?.requestContext?.get("mcp.extra")` |
129
+
130
+ **Universal pattern** (works in both contexts):
131
+
132
+ ```typescript
133
+ const mcpExtra = context?.mcp?.extra ?? context?.requestContext?.get('mcp.extra')
134
+ const authInfo = mcpExtra?.authInfo
135
+ ```
136
+
137
+ #### Example: Tool that works in both contexts
138
+
139
+ ```typescript
140
+ import { createTool } from '@mastra/core/tools'
141
+ import { z } from 'zod'
142
+
143
+ const fetchUserData = createTool({
144
+ id: 'fetchUserData',
145
+ description: 'Fetches user data using authentication from MCP context',
146
+ inputSchema: z.object({
147
+ userId: z.string().describe('The ID of the user to fetch'),
148
+ }),
149
+ execute: async (inputData, context) => {
150
+ // Access MCP authentication context
151
+ // When called directly via MCP: context.mcp.extra
152
+ // When called via agent: context.requestContext.get('mcp.extra')
153
+ const mcpExtra = context?.mcp?.extra || context?.requestContext?.get('mcp.extra')
154
+ const authInfo = mcpExtra?.authInfo
155
+
156
+ if (!authInfo?.token) {
157
+ throw new Error('Authentication required')
158
+ }
159
+
160
+ const response = await fetch(`https://api.example.com/users/${inputData.userId}`, {
161
+ headers: {
162
+ Authorization: `Bearer ${authInfo.token}`,
163
+ },
164
+ })
165
+
166
+ return response.json()
167
+ },
168
+ })
169
+ ```
170
+
171
+ ## Methods
172
+
173
+ These are the functions you can call on an `MCPServer` instance to control its behavior and get information.
174
+
175
+ ### `startStdio()`
176
+
177
+ Use this method to start the server so it communicates using standard input and output (stdio). This is typical when running the server as a command-line program.
178
+
179
+ ```typescript
180
+ async startStdio(): Promise<void>
181
+ ```
182
+
183
+ Here's how you would start the server using stdio:
184
+
185
+ ```typescript
186
+ const server = new MCPServer({
187
+ id: 'my-server',
188
+ name: 'My Server',
189
+ version: '1.0.0',
190
+ tools: {/* ... */},
191
+ })
192
+ await server.startStdio()
193
+ ```
194
+
195
+ ### `startSSE()`
196
+
197
+ This method helps you integrate the MCP server with an existing web server to use Server-Sent Events (SSE) for communication. You'll call this from your web server's code when it receives a request for the SSE or message paths.
198
+
199
+ ```typescript
200
+ async startSSE({
201
+ url,
202
+ ssePath,
203
+ messagePath,
204
+ req,
205
+ res,
206
+ }: {
207
+ url: URL;
208
+ ssePath: string;
209
+ messagePath: string;
210
+ req: any;
211
+ res: any;
212
+ }): Promise<void>
213
+ ```
214
+
215
+ Here's an example of how you might use `startSSE` within an HTTP server request handler. In this example an MCP client could connect to your MCP server at `http://localhost:1234/sse`:
216
+
217
+ ```typescript
218
+ import http from 'http'
219
+
220
+ const httpServer = http.createServer(async (req, res) => {
221
+ await server.startSSE({
222
+ url: new URL(req.url || '', `http://localhost:1234`),
223
+ ssePath: '/sse',
224
+ messagePath: '/message',
225
+ req,
226
+ res,
227
+ })
228
+ })
229
+
230
+ httpServer.listen(PORT, () => {
231
+ console.log(`HTTP server listening on port ${PORT}`)
232
+ })
233
+ ```
234
+
235
+ Here are the details for the values needed by the `startSSE` method:
236
+
237
+ **url** (`URL`): The web address the user is requesting.
238
+
239
+ **ssePath** (`string`): The specific part of the URL where clients will connect for SSE (e.g., '/sse').
240
+
241
+ **messagePath** (`string`): The specific part of the URL where clients will send messages (e.g., '/message').
242
+
243
+ **req** (`any`): The incoming request object from your web server.
244
+
245
+ **res** (`any`): The response object from your web server, used to send data back.
246
+
247
+ ### `startHonoSSE()`
248
+
249
+ This method helps you integrate the MCP server with an existing web server to use Server-Sent Events (SSE) for communication. You'll call this from your web server's code when it receives a request for the SSE or message paths.
250
+
251
+ ```typescript
252
+ async startHonoSSE({
253
+ url,
254
+ ssePath,
255
+ messagePath,
256
+ req,
257
+ res,
258
+ }: {
259
+ url: URL;
260
+ ssePath: string;
261
+ messagePath: string;
262
+ req: any;
263
+ res: any;
264
+ }): Promise<void>
265
+ ```
266
+
267
+ Here's an example of how you might use `startHonoSSE` within an HTTP server request handler. In this example an MCP client could connect to your MCP server at `http://localhost:1234/hono-sse`:
268
+
269
+ ```typescript
270
+ import http from 'http'
271
+
272
+ const httpServer = http.createServer(async (req, res) => {
273
+ await server.startHonoSSE({
274
+ url: new URL(req.url || '', `http://localhost:1234`),
275
+ ssePath: '/hono-sse',
276
+ messagePath: '/message',
277
+ req,
278
+ res,
279
+ })
280
+ })
281
+
282
+ httpServer.listen(PORT, () => {
283
+ console.log(`HTTP server listening on port ${PORT}`)
284
+ })
285
+ ```
286
+
287
+ Here are the details for the values needed by the `startHonoSSE` method:
288
+
289
+ **url** (`URL`): The web address the user is requesting.
290
+
291
+ **ssePath** (`string`): The specific part of the URL where clients will connect for SSE (e.g., '/hono-sse').
292
+
293
+ **messagePath** (`string`): The specific part of the URL where clients will send messages (e.g., '/message').
294
+
295
+ **req** (`any`): The incoming request object from your web server.
296
+
297
+ **res** (`any`): The response object from your web server, used to send data back.
298
+
299
+ ### `startHTTP()`
300
+
301
+ This method helps you integrate the MCP server with an existing web server to use streamable HTTP for communication. You'll call this from your web server's code when it receives HTTP requests.
302
+
303
+ ```typescript
304
+ async startHTTP({
305
+ url,
306
+ httpPath,
307
+ req,
308
+ res,
309
+ options = { sessionIdGenerator: () => randomUUID() },
310
+ }: {
311
+ url: URL;
312
+ httpPath: string;
313
+ req: http.IncomingMessage;
314
+ res: http.ServerResponse<http.IncomingMessage>;
315
+ options?: StreamableHTTPServerTransportOptions;
316
+ }): Promise<void>
317
+ ```
318
+
319
+ Here's an example of how you might use `startHTTP` within an HTTP server request handler. In this example an MCP client could connect to your MCP server at `http://localhost:1234/http`:
320
+
321
+ ```typescript
322
+ import http from 'http'
323
+
324
+ const httpServer = http.createServer(async (req, res) => {
325
+ await server.startHTTP({
326
+ url: new URL(req.url || '', 'http://localhost:1234'),
327
+ httpPath: `/mcp`,
328
+ req,
329
+ res,
330
+ options: {
331
+ sessionIdGenerator: () => randomUUID(),
332
+ },
333
+ })
334
+ })
335
+
336
+ httpServer.listen(PORT, () => {
337
+ console.log(`HTTP server listening on port ${PORT}`)
338
+ })
339
+ ```
340
+
341
+ For **serverless environments** (Supabase Edge Functions, Cloudflare Workers, Vercel Edge, etc.), use `serverless: true` to enable stateless operation:
342
+
343
+ ```typescript
344
+ // Supabase Edge Function example
345
+ import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'
346
+ import { MCPServer } from '@mastra/mcp'
347
+ // Note: You will need to convert req/res format from Deno to Node
348
+ import { toReqRes, toFetchResponse } from 'fetch-to-node'
349
+
350
+ const server = new MCPServer({
351
+ id: 'my-serverless-mcp',
352
+ name: 'My Serverless MCP',
353
+ version: '1.0.0',
354
+ tools: {/* your tools */},
355
+ })
356
+
357
+ serve(async req => {
358
+ const url = new URL(req.url)
359
+
360
+ if (url.pathname === '/mcp') {
361
+ // Convert Deno Request to Node.js-compatible format
362
+ const { req: nodeReq, res: nodeRes } = toReqRes(req)
363
+
364
+ await server.startHTTP({
365
+ url,
366
+ httpPath: '/mcp',
367
+ req: nodeReq,
368
+ res: nodeRes,
369
+ options: {
370
+ serverless: true, // ← Enable stateless mode for serverless
371
+ },
372
+ })
373
+
374
+ return toFetchResponse(nodeRes)
375
+ }
376
+
377
+ return new Response('Not found', { status: 404 })
378
+ })
379
+ ```
380
+
381
+ > **When to use serverless: true:** Use `serverless: true` when deploying to environments where each request runs in a fresh, stateless execution context:
382
+ >
383
+ > - Supabase Edge Functions
384
+ > - Cloudflare Workers
385
+ > - Vercel Edge Functions
386
+ > - Netlify Edge Functions
387
+ > - AWS Lambda
388
+ > - Deno Deploy
389
+ >
390
+ > Use the default session-based mode (without `serverless: true`) for:
391
+ >
392
+ > - Long-lived Node.js servers
393
+ > - Docker containers
394
+ > - Traditional hosting (VPS, dedicated servers)
395
+ >
396
+ > The serverless mode disables session management and creates fresh server instances per request, which is necessary for stateless environments where memory doesn't persist between invocations.
397
+ >
398
+ > By default, serverless mode buffers each request into a single JSON response, so `notifications/progress` sent by a tool never reach the client. Set `serverlessStreaming: true` to handle the request with request-scoped SSE streaming instead, which delivers progress notifications before the final result:
399
+ >
400
+ > ```typescript
401
+ > await server.startHTTP({
402
+ > url,
403
+ > httpPath: '/mcp',
404
+ > req: nodeReq,
405
+ > res: nodeRes,
406
+ > options: {
407
+ > serverless: true,
408
+ > serverlessStreaming: true, // ← Stream request-scoped notifications/progress
409
+ > },
410
+ > })
411
+ > ```
412
+ >
413
+ > This is still stateless: no `mcp-session-id` is required or persisted. It only enables notifications scoped to the current request (such as progress). The session-dependent features below remain unavailable.
414
+ >
415
+ > The following MCP features require session state or persistent connections and **won't work** in serverless mode (including with `serverlessStreaming: true`):
416
+ >
417
+ > - **Elicitation** - Interactive user input requests during tool execution require session management to route responses back to the correct client
418
+ > - **Resource subscriptions** - `resources/subscribe` and `resources/unsubscribe` need persistent connections to maintain subscription state
419
+ > - **Resource update notifications** - `resources.notifyUpdated()` requires active subscriptions and persistent connections to notify clients
420
+ > - **Prompt list change notifications** - `prompts.notifyListChanged()` requires persistent connections to push updates to clients
421
+ > - **Tool list change notifications** - `toolActions.notifyListChanged()` requires persistent connections to push updates to clients
422
+ > - **Server log notifications** - `sendLoggingMessage()` requires persistent connections to push log messages to clients
423
+ >
424
+ > These features work normally in long-lived server environments (Node.js servers, Docker containers, etc.).
425
+
426
+ Here are the details for the values needed by the `startHTTP` method:
427
+
428
+ **url** (`URL`): The web address the user is requesting.
429
+
430
+ **httpPath** (`string`): The specific part of the URL where the MCP server will handle HTTP requests (e.g., '/mcp').
431
+
432
+ **req** (`http.IncomingMessage`): The incoming request object from your web server.
433
+
434
+ **res** (`http.ServerResponse`): The response object from your web server, used to send data back.
435
+
436
+ **options** (`StreamableHTTPServerTransportOptions`): Optional configuration for the HTTP transport. See the options table below for more details.
437
+
438
+ The `StreamableHTTPServerTransportOptions` object allows you to customize the behavior of the HTTP transport. Here are the available options:
439
+
440
+ **serverless** (`boolean`): If true, runs in stateless mode without session management. Each request is handled independently with a fresh server instance. Essential for serverless environments (Cloudflare Workers, Supabase Edge Functions, Vercel Edge, etc.) where sessions cannot persist between invocations. Defaults to false.
441
+
442
+ **serverlessStreaming** (`boolean`): If true, serverless requests use request-scoped SSE streaming instead of a buffered JSON response, allowing in-request notifications/progress to reach the client before the final result. Only takes effect together with serverless: true. Defaults to false (buffered JSON responses), which preserves backward-compatible behavior. It enables only request-scoped notifications such as progress; elicitation, subscriptions, and out-of-request notifications still require session state.
443
+
444
+ **sessionIdGenerator** (`(() => string) | undefined`): A function that generates a unique session ID. This should be a cryptographically secure, globally unique string. Return undefined to disable session management.
445
+
446
+ **onsessioninitialized** (`(sessionId: string) => void`): A callback that is invoked when a new session is initialized. This is useful for tracking active MCP sessions.
447
+
448
+ **enableJsonResponse** (`boolean`): If true, the server will return plain JSON responses instead of using Server-Sent Events (SSE) for streaming. Defaults to false.
449
+
450
+ **eventStore** (`EventStore`): An event store for message resumability. Providing this enables clients to reconnect and resume message streams.
451
+
452
+ ### `close()`
453
+
454
+ This method closes the server and releases all resources.
455
+
456
+ ```typescript
457
+ async close(): Promise<void>
458
+ ```
459
+
460
+ ### `getServerInfo()`
461
+
462
+ The method returns the server's basic information.
463
+
464
+ ```typescript
465
+ getServerInfo(): ServerInfo
466
+ ```
467
+
468
+ ### `getServerDetail()`
469
+
470
+ The method returns details about the server's information.
471
+
472
+ ```typescript
473
+ getServerDetail(): ServerDetail
474
+ ```
475
+
476
+ ### `getToolListInfo()`
477
+
478
+ The method returns the tools that were set up when you created the server. It's a read-only list, useful for debugging purposes.
479
+
480
+ ```typescript
481
+ getToolListInfo(): ToolListInfo
482
+ ```
483
+
484
+ ### `getToolInfo()`
485
+
486
+ The method returns details about a specific tool.
487
+
488
+ ```typescript
489
+ getToolInfo(toolName: string): ToolInfo
490
+ ```
491
+
492
+ ### `executeTool()`
493
+
494
+ This method executes a specific tool and returns the result.
495
+
496
+ ```typescript
497
+ executeTool(toolName: string, input: any): Promise<any>
498
+ ```
499
+
500
+ ### `getStdioTransport()`
501
+
502
+ If you started the server with `startStdio()`, you can use this to get the object that manages the stdio communication. This is mostly for checking things internally or for testing.
503
+
504
+ ```typescript
505
+ getStdioTransport(): StdioServerTransport | undefined
506
+ ```
507
+
508
+ ### `getSseTransport()`
509
+
510
+ If you started the server with `startSSE()`, you can use this to get the object that manages the SSE communication. Like `getStdioTransport`, this is mainly for internal checks or testing.
511
+
512
+ ```typescript
513
+ getSseTransport(): SSEServerTransport | undefined
514
+ ```
515
+
516
+ ### `getSseHonoTransport()`
517
+
518
+ If you started the server with `startHonoSSE()`, you can use this to get the object that manages the SSE communication. Like `getSseTransport`, this is mainly for internal checks or testing.
519
+
520
+ ```typescript
521
+ getSseHonoTransport(): SSETransport | undefined
522
+ ```
523
+
524
+ ### `getStreamableHTTPTransport()`
525
+
526
+ If you started the server with `startHTTP()`, you can use this to get the object that manages the HTTP communication. Like `getSseTransport`, this is mainly for internal checks or testing.
527
+
528
+ ```typescript
529
+ getStreamableHTTPTransport(): StreamableHTTPServerTransport | undefined
530
+ ```
531
+
532
+ ### `tools()`
533
+
534
+ Executes a specific tool provided by this MCP server.
535
+
536
+ ```typescript
537
+ async executeTool(
538
+ toolId: string,
539
+ args: any,
540
+ executionContext?: { messages?: any[]; toolCallId?: string },
541
+ ): Promise<any>
542
+ ```
543
+
544
+ **toolId** (`string`): The ID/name of the tool to execute.
545
+
546
+ **args** (`any`): The arguments to pass to the tool's execute function.
547
+
548
+ **executionContext** (`object`): Optional context for the tool execution, like messages or a toolCallId.
549
+
550
+ ## Resource handling
551
+
552
+ ### What are MCP Resources?
553
+
554
+ Resources are a core primitive in the Model Context Protocol (MCP) that allow servers to expose data and content that can be read by clients and used as context for LLM interactions. They represent any kind of data that an MCP server wants to make available, such as:
555
+
556
+ - File contents
557
+ - Database records
558
+ - API responses
559
+ - Live system data
560
+ - Screenshots and images
561
+ - Log files
562
+
563
+ Resources are identified by unique URIs (e.g., `file:///home/user/documents/report.pdf`, `postgres://database/customers/schema`) and can contain either text (UTF-8 encoded) or binary data (base64 encoded).
564
+
565
+ Clients can discover resources through:
566
+
567
+ 1. **Direct resources**: Servers expose a list of concrete resources via a `resources/list` endpoint.
568
+ 2. **Resource templates**: For runtime-defined resources, servers can expose URI templates (RFC 6570) that clients use to construct resource URIs.
569
+
570
+ To read a resource, clients make a `resources/read` request with the URI. Servers can also notify clients about changes to the resource list (`notifications/resources/list_changed`) or updates to specific resource content (`notifications/resources/updated`) if a client has subscribed to that resource.
571
+
572
+ For more detailed information, refer to the [official MCP documentation on Resources](https://modelcontextprotocol.io/docs/concepts/resources).
573
+
574
+ ### `MCPServerResources` Type
575
+
576
+ The `resources` option takes an object of type `MCPServerResources`. This type defines the callbacks your server will use to handle resource requests:
577
+
578
+ ```typescript
579
+ export type MCPServerResources = {
580
+ // Callback to list available resources
581
+ listResources: () => Promise<Resource[]>
582
+
583
+ // Callback to get the content of a specific resource
584
+ getResourceContent: ({
585
+ uri,
586
+ }: {
587
+ uri: string
588
+ }) => Promise<MCPServerResourceContent | MCPServerResourceContent[]>
589
+
590
+ // Optional callback to list available resource templates
591
+ resourceTemplates?: () => Promise<ResourceTemplate[]>
592
+ }
593
+
594
+ export type MCPServerResourceContent = { text?: string } | { blob?: string }
595
+ ```
596
+
597
+ Example:
598
+
599
+ ```typescript
600
+ import { MCPServer } from '@mastra/mcp'
601
+ import type { MCPServerResourceContent, Resource, ResourceTemplate } from '@mastra/mcp'
602
+
603
+ // Resources/resource templates will generally be dynamically fetched.
604
+ const myResources: Resource[] = [
605
+ { uri: 'file://data/123.txt', name: 'Data File', mimeType: 'text/plain' },
606
+ ]
607
+
608
+ const myResourceContents: Record<string, MCPServerResourceContent> = {
609
+ 'file://data.txt/123': { text: 'This is the content of the data file.' },
610
+ }
611
+
612
+ const myResourceTemplates: ResourceTemplate[] = [
613
+ {
614
+ uriTemplate: 'file://data/{id}',
615
+ name: 'Data File',
616
+ description: 'A file containing data.',
617
+ mimeType: 'text/plain',
618
+ },
619
+ ]
620
+
621
+ const myResourceHandlers: MCPServerResources = {
622
+ listResources: async () => myResources,
623
+ getResourceContent: async ({ uri }) => {
624
+ if (myResourceContents[uri]) {
625
+ return myResourceContents[uri]
626
+ }
627
+ throw new Error(`Resource content not found for ${uri}`)
628
+ },
629
+ resourceTemplates: async () => myResourceTemplates,
630
+ }
631
+
632
+ const serverWithResources = new MCPServer({
633
+ id: 'resourceful-server',
634
+ name: 'Resourceful Server',
635
+ version: '1.0.0',
636
+ tools: {/* ... your tools ... */},
637
+ resources: myResourceHandlers,
638
+ })
639
+ ```
640
+
641
+ ### Notifying Clients of Resource Changes
642
+
643
+ If the available resources or their content change, your server can notify connected clients that are subscribed to the specific resource.
644
+
645
+ #### `server.resources.notifyUpdated({ uri: string })`
646
+
647
+ Call this method when the content of a specific resource (identified by its `uri`) has been updated. If any clients are subscribed to this URI, they will receive a `notifications/resources/updated` message.
648
+
649
+ ```typescript
650
+ async server.resources.notifyUpdated({ uri: string }): Promise<void>
651
+ ```
652
+
653
+ Example:
654
+
655
+ ```typescript
656
+ // After updating the content of 'file://data.txt'
657
+ await serverWithResources.resources.notifyUpdated({ uri: 'file://data.txt' })
658
+ ```
659
+
660
+ #### `server.resources.notifyListChanged()`
661
+
662
+ Call this method when the list of available resources has changed (e.g., a resource was added or removed). This will send a `notifications/resources/list_changed` message to clients, prompting them to re-fetch the list of resources.
663
+
664
+ ```typescript
665
+ async server.resources.notifyListChanged(): Promise<void>
666
+ ```
667
+
668
+ Example:
669
+
670
+ ```typescript
671
+ // After adding a new resource to the list managed by 'myResourceHandlers.listResources'
672
+ await serverWithResources.resources.notifyListChanged()
673
+ ```
674
+
675
+ ## Prompt handling
676
+
677
+ ### What are MCP Prompts?
678
+
679
+ Prompts are reusable templates or workflows that MCP servers expose to clients. They can accept arguments and include resource context. They also support versioning and standardize LLM interactions.
680
+
681
+ Prompts are identified by a unique name (and optional version) and can be runtime-defined or static.
682
+
683
+ ### `MCPServerPrompts` Type
684
+
685
+ The `prompts` option takes an object of type `MCPServerPrompts`. This type defines the callbacks your server will use to handle prompt requests:
686
+
687
+ ```typescript
688
+ export type MCPServerPrompts = {
689
+ // Callback to list available prompts
690
+ listPrompts: () => Promise<Prompt[]>
691
+
692
+ // Callback to get the messages/content for a specific prompt
693
+ getPromptMessages?: ({
694
+ name,
695
+ version,
696
+ args,
697
+ }: {
698
+ name: string
699
+ version?: string
700
+ args?: any
701
+ }) => Promise<{ prompt: Prompt; messages: PromptMessage[] }>
702
+ }
703
+ ```
704
+
705
+ Example:
706
+
707
+ ```typescript
708
+ import { MCPServer } from '@mastra/mcp'
709
+ import type { Prompt, PromptMessage, MCPServerPrompts } from '@mastra/mcp'
710
+
711
+ const prompts: Prompt[] = [
712
+ {
713
+ name: 'analyze-code',
714
+ description: 'Analyze code for improvements',
715
+ version: 'v1',
716
+ },
717
+ {
718
+ name: 'analyze-code',
719
+ description: 'Analyze code for improvements (new logic)',
720
+ version: 'v2',
721
+ },
722
+ ]
723
+
724
+ const myPromptHandlers: MCPServerPrompts = {
725
+ listPrompts: async () => prompts,
726
+ getPromptMessages: async ({ name, version, args }) => {
727
+ if (name === 'analyze-code') {
728
+ if (version === 'v2') {
729
+ const prompt = prompts.find(p => p.name === name && p.version === 'v2')
730
+ if (!prompt) throw new Error('Prompt version not found')
731
+ return {
732
+ prompt,
733
+ messages: [
734
+ {
735
+ role: 'user',
736
+ content: {
737
+ type: 'text',
738
+ text: `Analyze this code with the new logic: ${args.code}`,
739
+ },
740
+ },
741
+ ],
742
+ }
743
+ }
744
+ // Default or v1
745
+ const prompt = prompts.find(p => p.name === name && p.version === 'v1')
746
+ if (!prompt) throw new Error('Prompt version not found')
747
+ return {
748
+ prompt,
749
+ messages: [
750
+ {
751
+ role: 'user',
752
+ content: { type: 'text', text: `Analyze this code: ${args.code}` },
753
+ },
754
+ ],
755
+ }
756
+ }
757
+ throw new Error('Prompt not found')
758
+ },
759
+ }
760
+
761
+ const serverWithPrompts = new MCPServer({
762
+ id: 'promptful-server',
763
+ name: 'Promptful Server',
764
+ version: '1.0.0',
765
+ tools: {/* ... */},
766
+ prompts: myPromptHandlers,
767
+ })
768
+ ```
769
+
770
+ ### Notifying Clients of Prompt Changes
771
+
772
+ If the available prompts change, your server can notify connected clients:
773
+
774
+ #### `server.prompts.notifyListChanged()`
775
+
776
+ Call this method when the list of available prompts has changed (e.g., a prompt was added or removed). This will send a `notifications/prompts/list_changed` message to clients, prompting them to re-fetch the list of prompts.
777
+
778
+ ```typescript
779
+ await serverWithPrompts.prompts.notifyListChanged()
780
+ ```
781
+
782
+ ### Best practices for Prompt Handling
783
+
784
+ - Use clear, descriptive prompt names and descriptions.
785
+ - Validate all required arguments in `getPromptMessages`.
786
+ - Include a `version` field if you expect to make breaking changes.
787
+ - Use the `version` parameter to select the correct prompt logic.
788
+ - Notify clients when prompt lists change.
789
+ - Handle errors with informative messages.
790
+ - Document argument expectations and available versions.
791
+
792
+ ## Dynamic tool management
793
+
794
+ Tools are usually provided when constructing the `MCPServer`, but you can also add or remove tools while the server is running. The server exposes these operations through the `toolActions` property. When the tool list changes, connected clients receive a `notifications/tools/list_changed` message prompting them to re-fetch the tool list.
795
+
796
+ The property is `toolActions` because `tools()` is the method that returns the registered tool registry.
797
+
798
+ ### `toolActions.add(tools)`
799
+
800
+ Registers new tools on the running server and notifies connected clients. Tools are keyed by their record key, the same as tools passed to the constructor. Adding a tool under an existing key replaces it.
801
+
802
+ ```typescript
803
+ async server.toolActions.add(tools: ToolsInput): Promise<void>
804
+ ```
805
+
806
+ Example:
807
+
808
+ ```typescript
809
+ import { createTool } from '@mastra/core/tools'
810
+ import { z } from 'zod'
811
+
812
+ const searchTool = createTool({
813
+ id: 'search',
814
+ description: 'Searches the knowledge base.',
815
+ inputSchema: z.object({ query: z.string() }),
816
+ execute: async ({ query }) => ({ results: [] }),
817
+ })
818
+
819
+ await server.toolActions.add({ searchTool })
820
+ ```
821
+
822
+ ### `toolActions.remove(toolIds)`
823
+
824
+ Removes tools from the running server by tool ID and notifies connected clients. Unknown tool IDs are ignored. A notification is sent only when at least one tool is removed.
825
+
826
+ ```typescript
827
+ async server.toolActions.remove(toolIds: string[]): Promise<void>
828
+ ```
829
+
830
+ Example:
831
+
832
+ ```typescript
833
+ await server.toolActions.remove(['searchTool'])
834
+ ```
835
+
836
+ ### `toolActions.notifyListChanged()`
837
+
838
+ Sends a `notifications/tools/list_changed` message to connected clients without modifying the tool registry. Call this when tool availability changes through other means (for example, authorization changes).
839
+
840
+ ```typescript
841
+ async server.toolActions.notifyListChanged(): Promise<void>
842
+ ```
843
+
844
+ ### Mastra registry synchronization
845
+
846
+ When the server is registered with a Mastra instance, `toolActions.add()` and `toolActions.remove()` also update the Mastra instance's tool registry, matching the automatic tool registration that happens at startup. Added tools become available through `mastra.listTools()` (keyed by the tool's intrinsic `id` when present), and removed tools are deleted from the registry.
847
+
848
+ ## Logging
849
+
850
+ MCP servers can send structured log messages to clients using `notifications/message`. Clients control verbosity by sending a `logging/setLevel` request. The server drops messages below the requested minimum level (following RFC 5424 severity ordering). The level is tracked per session, so different clients can request different verbosity.
851
+
852
+ ### `sendLoggingMessage()`
853
+
854
+ Sends a log notification to all connected clients, honoring each client's minimum logging level.
855
+
856
+ ```typescript
857
+ async server.sendLoggingMessage(params: {
858
+ level: LoggingLevel;
859
+ data: unknown;
860
+ logger?: string;
861
+ }): Promise<void>
862
+ ```
863
+
864
+ Example:
865
+
866
+ ```typescript
867
+ await server.sendLoggingMessage({
868
+ level: 'info',
869
+ data: { message: 'Sync completed', itemsProcessed: 42 },
870
+ })
871
+ ```
872
+
873
+ ### `context.mcp.log()`
874
+
875
+ Inside a tool's `execute` function, use `context.mcp.log()` to send a log message to the client that called the tool.
876
+
877
+ ```typescript
878
+ async context.mcp.log(
879
+ level: LoggingLevel,
880
+ message: string,
881
+ data?: Record<string, unknown>
882
+ ): Promise<void>
883
+ ```
884
+
885
+ Example:
886
+
887
+ ```typescript
888
+ execute: async ({ location }, context) => {
889
+ await context.mcp.log('debug', 'Fetching weather', { location })
890
+ const weather = await fetchWeather(location)
891
+ await context.mcp.log('info', 'Weather fetched')
892
+ return weather
893
+ }
894
+ ```
895
+
896
+ ## Progress notifications
897
+
898
+ Long-running tools can report progress to the calling client with `notifications/progress`. Progress is only sent when the caller requested progress tracking by including a `progressToken` in the request (the Mastra `MCPClient` does this when `enableProgressTracking` is set). When no token was sent, `context.mcp.progress()` is a no-op.
899
+
900
+ ### `context.mcp.progress()`
901
+
902
+ ```typescript
903
+ async context.mcp.progress(params: {
904
+ progress: number;
905
+ total?: number;
906
+ message?: string;
907
+ }): Promise<void>
908
+ ```
909
+
910
+ Example:
911
+
912
+ ```typescript
913
+ execute: async ({ items }, context) => {
914
+ for (const [index, item] of items.entries()) {
915
+ await processItem(item)
916
+ await context.mcp.progress({
917
+ progress: index + 1,
918
+ total: items.length,
919
+ message: `Processed ${item.name}`,
920
+ })
921
+ }
922
+ return { done: true }
923
+ }
924
+ ```
925
+
926
+ ## Notification delivery
927
+
928
+ Notification methods (`resources.notifyListChanged()`, `prompts.notifyListChanged()`, `toolActions.notifyListChanged()`, and `sendLoggingMessage()`) broadcast to every connected client across all transports: the stdio/SSE connection and each streamable HTTP session. `resources.notifyUpdated()` is the exception: it only notifies clients that subscribed to the resource URI via `resources/subscribe`. Subscriptions are tracked per session for streamable HTTP clients; legacy SSE clients share the main server instance and therefore share one subscription set. Clients using the stateless serverless mode can't receive notifications because each request uses a transient server instance.
929
+
930
+ ## Examples
931
+
932
+ For practical examples of setting up and deploying an MCPServer, see the [Publishing an MCP Server guide](https://mastra.ai/guides/guide/publishing-mcp-server).
933
+
934
+ The example at the beginning of this page also demonstrates how to instantiate `MCPServer` with both tools and agents.
935
+
936
+ ## Elicitation
937
+
938
+ ### What's Elicitation?
939
+
940
+ Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users. It supports interactive workflows where servers can collect additional data at runtime.
941
+
942
+ The `MCPServer` class automatically includes elicitation capabilities. Tools receive a `context.mcp` object in their `execute` function that includes an `elicitation.sendRequest()` method for requesting user input.
943
+
944
+ ### Tool Execution Signature
945
+
946
+ When tools are executed within an MCP server context, they receive MCP-specific capabilities via the `context.mcp` object:
947
+
948
+ ```typescript
949
+ execute: async (inputData, context) => {
950
+ // input contains the tool's inputData parameters
951
+ // context.mcp contains server capabilities like elicitation and authentication info
952
+
953
+ // Access authentication information (when available)
954
+ if (context.mcp?.extra?.authInfo) {
955
+ console.log('Authenticated request from:', context.mcp.extra.authInfo.clientId)
956
+ }
957
+
958
+ // Use elicitation capabilities
959
+ const result = await context.mcp.elicitation.sendRequest({
960
+ message: 'Please provide information',
961
+ requestedSchema: {/* schema */},
962
+ })
963
+
964
+ return result
965
+ }
966
+ ```
967
+
968
+ ### How Elicitation Works
969
+
970
+ A common use case is during tool execution. When a tool needs user input, it can use the elicitation functionality provided through the context parameter:
971
+
972
+ 1. The tool calls `context.mcp.elicitation.sendRequest()` with a message and schema
973
+ 2. The request is sent to the connected MCP client
974
+ 3. The client presents the request to the user (via UI, command line, etc.)
975
+ 4. The user provides input, declines, or cancels the request
976
+ 5. The client sends the response back to the server
977
+ 6. The tool receives the response and continues execution
978
+
979
+ ### Using Elicitation in Tools
980
+
981
+ Here's an example of a tool that uses elicitation to collect user contact information:
982
+
983
+ ```typescript
984
+ import { MCPServer } from '@mastra/mcp'
985
+ import { createTool } from '@mastra/core/tools'
986
+ import { z } from 'zod'
987
+
988
+ const server = new MCPServer({
989
+ id: 'interactive-server',
990
+ name: 'Interactive Server',
991
+ version: '1.0.0',
992
+ tools: {
993
+ collectContactInfo: createTool({
994
+ id: 'collectContactInfo',
995
+ description: 'Collects user contact information through elicitation',
996
+ inputSchema: z.object({
997
+ reason: z.string().optional().describe('Reason for collecting contact info'),
998
+ }),
999
+ execute: async (inputData, context) => {
1000
+ const { reason } = inputData
1001
+
1002
+ // Log session info if available
1003
+ console.log('Request from session:', context.mcp?.extra?.sessionId)
1004
+
1005
+ try {
1006
+ // Request user input via elicitation
1007
+ const result = await context.mcp.elicitation.sendRequest({
1008
+ message: reason
1009
+ ? `Please provide your contact information. ${reason}`
1010
+ : 'Please provide your contact information',
1011
+ requestedSchema: {
1012
+ type: 'object',
1013
+ properties: {
1014
+ name: {
1015
+ type: 'string',
1016
+ title: 'Full Name',
1017
+ description: 'Your full name',
1018
+ },
1019
+ email: {
1020
+ type: 'string',
1021
+ title: 'Email Address',
1022
+ description: 'Your email address',
1023
+ format: 'email',
1024
+ },
1025
+ phone: {
1026
+ type: 'string',
1027
+ title: 'Phone Number',
1028
+ description: 'Your phone number (optional)',
1029
+ },
1030
+ },
1031
+ required: ['name', 'email'],
1032
+ },
1033
+ })
1034
+
1035
+ // Handle the user's response
1036
+ if (result.action === 'accept') {
1037
+ return `Contact information collected: ${JSON.stringify(result.content, null, 2)}`
1038
+ } else if (result.action === 'decline') {
1039
+ return 'Contact information collection was declined by the user.'
1040
+ } else {
1041
+ return 'Contact information collection was cancelled by the user.'
1042
+ }
1043
+ } catch (error) {
1044
+ return `Error collecting contact information: ${error}`
1045
+ }
1046
+ },
1047
+ }),
1048
+ },
1049
+ })
1050
+ ```
1051
+
1052
+ ### Elicitation Request Schema
1053
+
1054
+ The `requestedSchema` must be a flat object with primitive properties only. Supported types include:
1055
+
1056
+ - **String**: `{ type: 'string', title: 'Display Name', description: 'Help text' }`
1057
+ - **Number**: `{ type: 'number', minimum: 0, maximum: 100 }`
1058
+ - **Boolean**: `{ type: 'boolean', default: false }`
1059
+ - **Enum**: `{ type: 'string', enum: ['option1', 'option2'] }`
1060
+
1061
+ Example schema:
1062
+
1063
+ ```typescript
1064
+ {
1065
+ type: 'object',
1066
+ properties: {
1067
+ name: {
1068
+ type: 'string',
1069
+ title: 'Full Name',
1070
+ description: 'Your complete name',
1071
+ },
1072
+ age: {
1073
+ type: 'number',
1074
+ title: 'Age',
1075
+ minimum: 18,
1076
+ maximum: 120,
1077
+ },
1078
+ newsletter: {
1079
+ type: 'boolean',
1080
+ title: 'Subscribe to Newsletter',
1081
+ default: false,
1082
+ },
1083
+ },
1084
+ required: ['name'],
1085
+ }
1086
+ ```
1087
+
1088
+ ### Response Actions
1089
+
1090
+ Users can respond to elicitation requests in three ways:
1091
+
1092
+ 1. **Accept** (`action: 'accept'`): User provided data and confirmed submission
1093
+ - Contains `content` field with the submitted data
1094
+ 2. **Decline** (`action: 'decline'`): User explicitly declined to provide information
1095
+ - No content field
1096
+ 3. **Cancel** (`action: 'cancel'`): User dismissed the request without deciding
1097
+ - No content field
1098
+
1099
+ Tools should handle all three response types appropriately.
1100
+
1101
+ ### Security Considerations
1102
+
1103
+ - **Never request sensitive information** like passwords, SSNs, or credit card numbers
1104
+ - Validate all user input against the provided schema
1105
+ - Handle declining and cancellation gracefully
1106
+ - Provide clear reasons for data collection
1107
+ - Respect user privacy and preferences
1108
+
1109
+ ### Tool Execution API
1110
+
1111
+ The elicitation functionality is available through the `options` parameter in tool execution:
1112
+
1113
+ ```typescript
1114
+ // Within a tool's execute function
1115
+ execute: async (inputData, context) => {
1116
+ // Use elicitation for user input
1117
+ const result = await context.mcp.elicitation.sendRequest({
1118
+ message: string, // Message to display to user
1119
+ requestedSchema: object // JSON schema defining expected response structure
1120
+ }): Promise<ElicitResult>
1121
+
1122
+ // Access authentication info if needed
1123
+ if (context.mcp?.extra?.authInfo) {
1124
+ // Use context.mcp.extra.authInfo.token, etc.
1125
+ }
1126
+ }
1127
+ ```
1128
+
1129
+ Elicitation is **session-aware** when using HTTP-based transports (SSE or HTTP). When multiple clients are connected to the same server, elicitation requests are routed to the client session that initiated the tool execution.
1130
+
1131
+ The `ElicitResult` type:
1132
+
1133
+ ```typescript
1134
+ type ElicitResult = {
1135
+ action: 'accept' | 'decline' | 'cancel'
1136
+ content?: any // Only present when action is 'accept'
1137
+ }
1138
+ ```
1139
+
1140
+ ## OAuth protection
1141
+
1142
+ To protect your MCP server with OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `createOAuthMiddleware` function:
1143
+
1144
+ ```typescript
1145
+ import http from 'node:http'
1146
+ import { MCPServer, createOAuthMiddleware, createStaticTokenValidator } from '@mastra/mcp'
1147
+
1148
+ const mcpServer = new MCPServer({
1149
+ id: 'protected-server',
1150
+ name: 'Protected MCP Server',
1151
+ version: '1.0.0',
1152
+ tools: {/* your tools */},
1153
+ })
1154
+
1155
+ // Create OAuth middleware
1156
+ const oauthMiddleware = createOAuthMiddleware({
1157
+ oauth: {
1158
+ resource: 'https://mcp.example.com/mcp',
1159
+ authorizationServers: ['https://auth.example.com'],
1160
+ scopesSupported: ['mcp:read', 'mcp:write'],
1161
+ resourceName: 'My Protected MCP Server',
1162
+ validateToken: createStaticTokenValidator(['allowed-token-1']),
1163
+ },
1164
+ mcpPath: '/mcp',
1165
+ })
1166
+
1167
+ // Create HTTP server with OAuth protection
1168
+ const httpServer = http.createServer(async (req, res) => {
1169
+ const url = new URL(req.url || '', 'https://mcp.example.com')
1170
+
1171
+ // Apply OAuth middleware first
1172
+ const result = await oauthMiddleware(req, res, url)
1173
+ if (!result.proceed) return // Middleware handled response (401, metadata, etc.)
1174
+
1175
+ // Token is valid, proceed to MCP handler
1176
+ await mcpServer.startHTTP({ url, httpPath: '/mcp', req, res })
1177
+ })
1178
+
1179
+ httpServer.listen(3000)
1180
+ ```
1181
+
1182
+ The middleware automatically:
1183
+
1184
+ - Serves **Protected Resource Metadata** at `/.well-known/oauth-protected-resource` (RFC 9728)
1185
+ - Returns `401 Unauthorized` with proper `WWW-Authenticate` headers when authentication is required
1186
+ - Validates bearer tokens using your provided validator
1187
+
1188
+ ### Token Validation
1189
+
1190
+ For production, use proper token validation:
1191
+
1192
+ ```typescript
1193
+ import { createOAuthMiddleware, createIntrospectionValidator } from '@mastra/mcp'
1194
+
1195
+ // Option 1: Token introspection (RFC 7662)
1196
+ const middleware = createOAuthMiddleware({
1197
+ oauth: {
1198
+ resource: 'https://mcp.example.com/mcp',
1199
+ authorizationServers: ['https://auth.example.com'],
1200
+ validateToken: createIntrospectionValidator('https://auth.example.com/oauth/introspect', {
1201
+ clientId: 'mcp-server',
1202
+ clientSecret: 'secret',
1203
+ }),
1204
+ },
1205
+ })
1206
+
1207
+ // Option 2: Custom validation (JWT, database lookup, etc.)
1208
+ const customMiddleware = createOAuthMiddleware({
1209
+ oauth: {
1210
+ resource: 'https://mcp.example.com/mcp',
1211
+ authorizationServers: ['https://auth.example.com'],
1212
+ validateToken: async (token, resource) => {
1213
+ const decoded = await verifyJWT(token)
1214
+ if (!decoded) {
1215
+ return { valid: false, error: 'invalid_token' }
1216
+ }
1217
+ return {
1218
+ valid: true,
1219
+ scopes: decoded.scope?.split(' ') || [],
1220
+ subject: decoded.sub,
1221
+ }
1222
+ },
1223
+ },
1224
+ })
1225
+ ```
1226
+
1227
+ ### OAuth Middleware Options
1228
+
1229
+ **oauth.resource** (`string`): The canonical URL of your MCP server. This is returned in Protected Resource Metadata.
1230
+
1231
+ **oauth.authorizationServers** (`string[]`): URLs of authorization servers that can issue tokens for this resource.
1232
+
1233
+ **oauth.scopesSupported** (`string[]`): Scopes supported by this MCP server. (Default: `['mcp:read', 'mcp:write']`)
1234
+
1235
+ **oauth.resourceName** (`string`): Human-readable name for this resource server.
1236
+
1237
+ **oauth.validateToken** (`(token: string, resource: string) => Promise<TokenValidationResult>`): Function to validate access tokens. If not provided, tokens are accepted without validation (NOT recommended for production).
1238
+
1239
+ **mcpPath** (`string`): Path where the MCP endpoint is served. Only requests to this path require authentication. (Default: `'/mcp'`)
1240
+
1241
+ ## Authentication context
1242
+
1243
+ Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports. This allows you to pass authentication info, user context, or any custom data from your HTTP middleware to your MCP tools.
1244
+
1245
+ ### How it works
1246
+
1247
+ Whatever you set on `req.auth` in your HTTP middleware becomes available as `context.mcp.extra.authInfo` in your tools:
1248
+
1249
+ ```text
1250
+ req.auth = { ... } → context?.mcp?.extra?.authInfo.extra = { ... }
1251
+ ```
1252
+
1253
+ ### Map auth data for FGA
1254
+
1255
+ When an `MCPServer` is registered on a Mastra instance with a fine-grained authorization (FGA) provider, Mastra checks `requestContext.get('user')` before listing or calling tools. HTTP MCP transports pass authenticated data as `extra.authInfo`, so use `mapAuthInfoToUser` to set the user shape expected by your FGA provider.
1256
+
1257
+ ```typescript
1258
+ const server = new MCPServer({
1259
+ id: 'my-server',
1260
+ name: 'My Server',
1261
+ version: '1.0.0',
1262
+ tools: { getUserData },
1263
+ mapAuthInfoToUser: ({ authInfo }) => {
1264
+ const user = authInfo as {
1265
+ extra?: {
1266
+ userId?: string
1267
+ organizationMembershipId?: string
1268
+ }
1269
+ }
1270
+
1271
+ if (!user.extra?.userId) {
1272
+ return null
1273
+ }
1274
+
1275
+ return {
1276
+ id: user.extra.userId,
1277
+ organizationMembershipId: user.extra.organizationMembershipId,
1278
+ }
1279
+ },
1280
+ })
1281
+ ```
1282
+
1283
+ ### Scope MCP tool FGA separately
1284
+
1285
+ Use `fga.resourceMapping` and `fga.permissionMapping` when MCP clients need a different authorization scope than internal agent or workflow tool execution. The override applies only to `tools/list` and `tools/call` checks for this MCP server.
1286
+
1287
+ ```typescript
1288
+ import { MastraFGAPermissions } from '@mastra/core/auth/ee'
1289
+
1290
+ const server = new MCPServer({
1291
+ id: 'my-server',
1292
+ name: 'My Server',
1293
+ version: '1.0.0',
1294
+ tools: { getUserData },
1295
+ mapAuthInfoToUser: ({ authInfo }) => {
1296
+ const user = authInfo as {
1297
+ extra?: {
1298
+ userId?: string
1299
+ organizationMembershipId?: string
1300
+ }
1301
+ }
1302
+
1303
+ if (!user.extra?.userId) {
1304
+ return null
1305
+ }
1306
+
1307
+ return {
1308
+ id: user.extra.userId,
1309
+ organizationMembershipId: user.extra.organizationMembershipId,
1310
+ }
1311
+ },
1312
+ fga: {
1313
+ resourceMapping: {
1314
+ tool: {
1315
+ fgaResourceType: 'user',
1316
+ deriveId: ({ user }) => (user as { id: string }).id,
1317
+ },
1318
+ },
1319
+ permissionMapping: {
1320
+ [MastraFGAPermissions.TOOLS_EXECUTE]: 'read',
1321
+ },
1322
+ },
1323
+ })
1324
+ ```
1325
+
1326
+ ### Setting Up Authentication Middleware
1327
+
1328
+ To pass data to your tools, populate `req.auth` on the Node.js request object in your HTTP server middleware before calling `server.startHTTP()`.
1329
+
1330
+ ```typescript
1331
+ import express from 'express'
1332
+
1333
+ type MCPAuthenticatedRequest = express.Request & {
1334
+ auth?: {
1335
+ token: string
1336
+ clientId: string
1337
+ scopes: string[]
1338
+ expiresAt?: number
1339
+ extra?: Record<string, unknown>
1340
+ }
1341
+ }
1342
+
1343
+ const app = express()
1344
+
1345
+ // Auth middleware - set req.auth before the MCP handler
1346
+ app.use('/mcp', async (req, res, next) => {
1347
+ const authorization = req.headers.authorization
1348
+
1349
+ if (!authorization?.startsWith('Bearer ')) {
1350
+ res.status(401).json({ error: 'Missing bearer token' })
1351
+ return
1352
+ }
1353
+
1354
+ const token = authorization.slice('Bearer '.length)
1355
+
1356
+ try {
1357
+ const user = await verifyToken(token)
1358
+
1359
+ // This entire object becomes context.mcp.extra.authInfo
1360
+ const authenticatedRequest = req as MCPAuthenticatedRequest
1361
+ authenticatedRequest.auth = {
1362
+ token,
1363
+ clientId: user.clientId,
1364
+ scopes: user.scopes,
1365
+ expiresAt: user.expiresAt,
1366
+ extra: {
1367
+ userId: user.userId,
1368
+ email: user.email,
1369
+ },
1370
+ }
1371
+ next()
1372
+ } catch {
1373
+ res.status(401).json({ error: 'Invalid or expired token' })
1374
+ }
1375
+ })
1376
+
1377
+ app.all('/mcp', async (req, res) => {
1378
+ const url = new URL(req.url, `http://${req.headers.host}`)
1379
+ await server.startHTTP({ url, httpPath: '/mcp', req, res })
1380
+ })
1381
+ ```
1382
+
1383
+ ### Accessing Auth Data in Tools
1384
+
1385
+ The `req.auth` object is available as `context.mcp.extra.authInfo` in your tool's execute function:
1386
+
1387
+ ```typescript
1388
+ execute: async (inputData, context) => {
1389
+ // Access the auth data you set in middleware
1390
+ const authInfo = context?.mcp?.extra?.authInfo
1391
+
1392
+ if (!authInfo?.extra?.userId) {
1393
+ return { error: 'Authentication required' }
1394
+ }
1395
+
1396
+ // Use the auth data
1397
+ console.log('User ID:', authInfo.extra.userId)
1398
+ console.log('Email:', authInfo.extra.email)
1399
+
1400
+ const response = await fetch('/api/data', {
1401
+ headers: { Authorization: `Bearer ${authInfo.token}` },
1402
+ signal: context?.mcp?.extra?.signal,
1403
+ })
1404
+
1405
+ return response.json()
1406
+ }
1407
+ ```
1408
+
1409
+ ### Passing `RequestContext` through to agent
1410
+
1411
+ ```typescript
1412
+ execute: async (inputData, context) => {
1413
+ // Access the auth data you set in middleware
1414
+ const authInfo = context?.mcp?.extra?.authInfo
1415
+
1416
+ const requestContext = context.requestContext || new RequestContext().set('someKey', authInfo)
1417
+
1418
+ if (!authInfo?.extra?.userId) {
1419
+ return { error: 'Authentication required' }
1420
+ }
1421
+
1422
+ // Use the auth data
1423
+ console.log('User ID:', authInfo.extra.userId)
1424
+ console.log('Email:', authInfo.extra.email)
1425
+
1426
+ const agent = context?.mastra?.getAgentById('some-agent-id')
1427
+
1428
+ if (!agent) {
1429
+ return { error: "Agent 'some-agent-id' not found" }
1430
+ }
1431
+
1432
+ const response = await agent.generate(prompt, { requestContext })
1433
+
1434
+ return response.text
1435
+ }
1436
+ ```
1437
+
1438
+ ### The `extra` Object
1439
+
1440
+ The full `context.mcp.extra` object contains:
1441
+
1442
+ | Property | Description |
1443
+ | ------------------ | ------------------------------------------------- |
1444
+ | `authInfo` | Whatever you set on `req.auth` in your middleware |
1445
+ | `sessionId` | Session identifier for the MCP connection |
1446
+ | `signal` | AbortSignal for request cancellation |
1447
+ | `sendNotification` | MCP protocol function for sending notifications |
1448
+ | `sendRequest` | MCP protocol function for sending requests |
1449
+
1450
+ ### Complete Example
1451
+
1452
+ Install [`jose`](https://github.com/panva/jose) to verify JSON Web Tokens (JWTs) against your identity provider's JSON Web Key Set (JWKS):
1453
+
1454
+ **npm**:
1455
+
1456
+ ```shell
1457
+ npm install jose
1458
+ ```
1459
+
1460
+ **pnpm**:
1461
+
1462
+ ```shell
1463
+ pnpm add jose
1464
+ ```
1465
+
1466
+ **Yarn**:
1467
+
1468
+ ```shell
1469
+ yarn add jose
1470
+ ```
1471
+
1472
+ **Bun**:
1473
+
1474
+ ```shell
1475
+ bun add jose
1476
+ ```
1477
+
1478
+ The following example validates the token's signature, issuer, audience, algorithm, expiration, and required claims before passing its user data to the tool:
1479
+
1480
+ ```typescript
1481
+ import express from 'express'
1482
+ import { createRemoteJWKSet, jwtVerify } from 'jose'
1483
+ import { MCPServer } from '@mastra/mcp'
1484
+ import { createTool } from '@mastra/core/tools'
1485
+ import { z } from 'zod'
1486
+
1487
+ type MCPAuthenticatedRequest = express.Request & {
1488
+ auth?: {
1489
+ token: string
1490
+ clientId: string
1491
+ scopes: string[]
1492
+ expiresAt?: number
1493
+ extra?: Record<string, unknown>
1494
+ }
1495
+ }
1496
+
1497
+ const issuer = process.env.JWT_ISSUER
1498
+ const audience = process.env.JWT_AUDIENCE
1499
+ const jwksUri = process.env.JWT_JWKS_URI
1500
+
1501
+ if (!issuer || !audience || !jwksUri) {
1502
+ throw new Error('JWT_ISSUER, JWT_AUDIENCE, and JWT_JWKS_URI are required')
1503
+ }
1504
+
1505
+ const jwks = createRemoteJWKSet(new URL(jwksUri))
1506
+
1507
+ const verifyToken = async (token: string) => {
1508
+ const { payload } = await jwtVerify(token, jwks, {
1509
+ issuer,
1510
+ audience,
1511
+ algorithms: ['RS256'],
1512
+ requiredClaims: ['exp'],
1513
+ })
1514
+
1515
+ const clientId =
1516
+ typeof payload.client_id === 'string'
1517
+ ? payload.client_id
1518
+ : typeof payload.azp === 'string'
1519
+ ? payload.azp
1520
+ : undefined
1521
+
1522
+ if (!payload.sub || typeof payload.email !== 'string' || !clientId || !payload.exp) {
1523
+ throw new Error('Token must contain sub, email, exp, and client_id or azp claims')
1524
+ }
1525
+
1526
+ return {
1527
+ userId: payload.sub,
1528
+ clientId,
1529
+ email: payload.email,
1530
+ expiresAt: payload.exp,
1531
+ scopes: typeof payload.scope === 'string' ? payload.scope.split(' ') : [],
1532
+ }
1533
+ }
1534
+
1535
+ // 1. Define your tool that uses auth context
1536
+ const getUserData = createTool({
1537
+ id: 'get-user-data',
1538
+ description: 'Fetches data for the authenticated user',
1539
+ inputSchema: z.object({}),
1540
+ execute: async (inputData, context) => {
1541
+ const authInfo = context?.mcp?.extra?.authInfo
1542
+
1543
+ if (!authInfo?.extra?.userId) {
1544
+ return { error: 'Authentication required' }
1545
+ }
1546
+
1547
+ // Access the data you set in middleware
1548
+ return {
1549
+ userId: authInfo.extra.userId,
1550
+ email: authInfo.extra.email,
1551
+ }
1552
+ },
1553
+ })
1554
+
1555
+ // 2. Create the MCP server with your tools
1556
+ const server = new MCPServer({
1557
+ id: 'my-server',
1558
+ name: 'My Server',
1559
+ version: '1.0.0',
1560
+ tools: { getUserData },
1561
+ })
1562
+
1563
+ // 3. Set up Express with auth middleware
1564
+ const app = express()
1565
+
1566
+ app.use('/mcp', async (req, res, next) => {
1567
+ const authorization = req.headers.authorization
1568
+
1569
+ if (!authorization?.startsWith('Bearer ')) {
1570
+ res.status(401).json({ error: 'Missing bearer token' })
1571
+ return
1572
+ }
1573
+
1574
+ const token = authorization.slice('Bearer '.length)
1575
+
1576
+ try {
1577
+ const user = await verifyToken(token)
1578
+
1579
+ // This entire object becomes context.mcp.extra.authInfo
1580
+ const authenticatedRequest = req as MCPAuthenticatedRequest
1581
+ authenticatedRequest.auth = {
1582
+ token,
1583
+ clientId: user.clientId,
1584
+ scopes: user.scopes,
1585
+ expiresAt: user.expiresAt,
1586
+ extra: {
1587
+ userId: user.userId,
1588
+ email: user.email,
1589
+ },
1590
+ }
1591
+ next()
1592
+ } catch {
1593
+ res.status(401).json({ error: 'Invalid or expired token' })
1594
+ }
1595
+ })
1596
+
1597
+ app.all('/mcp', async (req, res) => {
1598
+ const url = new URL(req.url, `http://${req.headers.host}`)
1599
+ await server.startHTTP({ url, httpPath: '/mcp', req, res })
1600
+ })
1601
+
1602
+ app.listen(3000)
1603
+ ```
1604
+
1605
+ ## MCP Apps (`appResources`)
1606
+
1607
+ The `appResources` option lets you serve interactive HTML UIs from your MCP server via the [MCP Apps extension](https://github.com/modelcontextprotocol/ext-apps). Each entry maps a `ui://` URI to an HTML app that renders in a sandboxed iframe in Mastra Studio.
1608
+
1609
+ ### `AppResources` type
1610
+
1611
+ **Key (URI)** (`string`): A ui:// URI that identifies the app resource (e.g., ui://calculator/main).
1612
+
1613
+ Each value is an `AppResource` object:
1614
+
1615
+ **name** (`string`): Display name for the UI resource.
1616
+
1617
+ **description** (`string`): Optional description of the UI resource.
1618
+
1619
+ **html** (`string`): Inline HTML content for the UI. Provide either html or htmlPath.
1620
+
1621
+ **htmlPath** (`string`): Path to an HTML file. Resolved at server startup. Provide either html or htmlPath.
1622
+
1623
+ **meta** (`McpUiResourceMeta`): UI resource metadata (CSP, permissions, rendering preferences) from the official ext-apps SDK.
1624
+
1625
+ ### Example
1626
+
1627
+ ```typescript
1628
+ import { MCPServer } from '@mastra/mcp'
1629
+ import { createTool } from '@mastra/core/tools'
1630
+ import { z } from 'zod'
1631
+
1632
+ const calculatorTool = createTool({
1633
+ id: 'calculatorWithUI',
1634
+ description: 'An interactive calculator',
1635
+ inputSchema: z.object({
1636
+ num1: z.number(),
1637
+ num2: z.number(),
1638
+ operation: z.enum(['add', 'subtract']),
1639
+ }),
1640
+ execute: async ({ num1, num2, operation }) => {
1641
+ const result = operation === 'add' ? num1 + num2 : num1 - num2
1642
+ return {
1643
+ content: [{ type: 'text', text: 'An interactive calculator is displayed.' }],
1644
+ structuredContent: { result },
1645
+ }
1646
+ },
1647
+ })
1648
+
1649
+ const server = new MCPServer({
1650
+ id: 'app-server',
1651
+ name: 'App Server',
1652
+ version: '1.0.0',
1653
+ tools: { calculatorTool },
1654
+ appResources: {
1655
+ 'ui://calculator/main': {
1656
+ name: 'Interactive Calculator',
1657
+ html: '<html><body><h2>Calculator</h2>...</body></html>',
1658
+ },
1659
+ },
1660
+ })
1661
+ ```
1662
+
1663
+ Link a tool to its app resource by setting `_meta.ui.resourceUri` on the tool to the matching `ui://` URI. The server auto-normalizes this metadata when registering tools. Visit [MCP Apps](https://mastra.ai/docs/mcp/overview) for the full app bridge API and usage patterns.
1664
+
1665
+ ## Related information
1666
+
1667
+ - For connecting to MCP servers in Mastra, see the [MCPClient documentation](https://mastra.ai/reference/tools/mcp-client).
1668
+ - For more about the Model Context Protocol, see the [@modelcontextprotocol/sdk documentation](https://github.com/modelcontextprotocol/typescript-sdk).