@mastra/mcp-docs-server 1.0.0-beta.11 → 1.0.0-beta.14

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 (345) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +29 -29
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +51 -51
  3. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +45 -45
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +180 -180
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +39 -39
  6. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +39 -39
  7. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +68 -0
  8. package/.docs/organized/changelogs/%40mastra%2Fcore.md +331 -331
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +31 -31
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
  12. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +39 -39
  13. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
  14. package/.docs/organized/changelogs/%40mastra%2Flance.md +39 -39
  15. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +45 -45
  16. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +24 -24
  17. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +24 -24
  18. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +39 -39
  19. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +39 -39
  20. package/.docs/organized/changelogs/%40mastra%2Fpg.md +45 -45
  21. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +96 -96
  22. package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
  23. package/.docs/organized/changelogs/%40mastra%2Freact.md +49 -2
  24. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  25. package/.docs/organized/changelogs/%40mastra%2Fserver.md +122 -122
  26. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +39 -39
  27. package/.docs/organized/changelogs/create-mastra.md +31 -31
  28. package/.docs/organized/changelogs/mastra.md +51 -51
  29. package/.docs/organized/code-examples/agent-v6.md +151 -0
  30. package/.docs/organized/code-examples/ai-elements.md +1 -1
  31. package/.docs/organized/code-examples/quick-start.md +0 -4
  32. package/.docs/organized/code-examples/stock-price-tool.md +21 -2
  33. package/.docs/raw/agents/adding-voice.mdx +2 -3
  34. package/.docs/raw/agents/agent-approval.mdx +139 -6
  35. package/.docs/raw/agents/agent-memory.mdx +24 -32
  36. package/.docs/raw/agents/guardrails.mdx +61 -51
  37. package/.docs/raw/agents/networks.mdx +9 -13
  38. package/.docs/raw/agents/overview.mdx +40 -24
  39. package/.docs/raw/agents/processors.mdx +20 -19
  40. package/.docs/raw/agents/structured-output.mdx +11 -7
  41. package/.docs/raw/agents/using-tools.mdx +5 -6
  42. package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +1 -2
  43. package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +1 -1
  44. package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +1 -2
  45. package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +1 -1
  46. package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +1 -1
  47. package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +1 -1
  48. package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +1 -1
  49. package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +1 -1
  50. package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -2
  51. package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -2
  52. package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +1 -2
  53. package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +3 -4
  54. package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -3
  55. package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +2 -3
  56. package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -2
  57. package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +2 -3
  58. package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +2 -3
  59. package/.docs/raw/deployment/cloud-providers.mdx +20 -0
  60. package/.docs/raw/deployment/{building-mastra.mdx → mastra-server.mdx} +5 -5
  61. package/.docs/raw/deployment/monorepo.mdx +23 -44
  62. package/.docs/raw/deployment/overview.mdx +32 -50
  63. package/.docs/raw/deployment/web-framework.mdx +15 -19
  64. package/.docs/raw/evals/custom-scorers.mdx +9 -6
  65. package/.docs/raw/evals/overview.mdx +3 -6
  66. package/.docs/raw/evals/running-in-ci.mdx +2 -2
  67. package/.docs/raw/getting-started/manual-install.mdx +20 -20
  68. package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
  69. package/.docs/raw/getting-started/start.mdx +10 -1
  70. package/.docs/raw/getting-started/studio.mdx +1 -1
  71. package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +4 -4
  72. package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +1033 -79
  73. package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
  74. package/.docs/raw/guides/build-your-ui/copilotkit.mdx +11 -11
  75. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/amazon-ec2.mdx +9 -9
  76. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/aws-lambda.mdx +13 -16
  77. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/azure-app-services.mdx +5 -7
  78. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/cloudflare-deployer.mdx +8 -5
  79. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/digital-ocean.mdx +12 -15
  80. package/.docs/raw/guides/deployment/index.mdx +32 -0
  81. package/.docs/raw/guides/deployment/inngest.mdx +386 -0
  82. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/netlify-deployer.mdx +7 -3
  83. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/vercel-deployer.mdx +8 -5
  84. package/.docs/raw/guides/getting-started/astro.mdx +292 -451
  85. package/.docs/raw/guides/getting-started/express.mdx +72 -153
  86. package/.docs/raw/guides/getting-started/hono.mdx +227 -0
  87. package/.docs/raw/guides/getting-started/next-js.mdx +170 -61
  88. package/.docs/raw/guides/getting-started/quickstart.mdx +4 -4
  89. package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
  90. package/.docs/raw/guides/getting-started/vite-react.mdx +317 -147
  91. package/.docs/raw/guides/guide/ai-recruiter.mdx +10 -10
  92. package/.docs/raw/guides/guide/chef-michel.mdx +9 -11
  93. package/.docs/raw/guides/guide/notes-mcp-server.mdx +15 -15
  94. package/.docs/raw/guides/guide/research-assistant.mdx +17 -17
  95. package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
  96. package/.docs/raw/guides/guide/web-search.mdx +8 -8
  97. package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
  98. package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
  99. package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +1 -1
  100. package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +17 -0
  101. package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +6 -0
  102. package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +0 -2
  103. package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +21 -23
  104. package/.docs/raw/index.mdx +2 -2
  105. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/dashboard.mdx +2 -6
  106. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/observability.mdx +1 -5
  107. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/overview.mdx +2 -6
  108. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/setting-up.mdx +8 -7
  109. package/.docs/raw/mcp/overview.mdx +31 -13
  110. package/.docs/raw/mcp/publishing-mcp-server.mdx +2 -2
  111. package/.docs/raw/memory/memory-processors.mdx +9 -9
  112. package/.docs/raw/memory/message-history.mdx +69 -0
  113. package/.docs/raw/memory/overview.mdx +34 -76
  114. package/.docs/raw/memory/semantic-recall.mdx +58 -49
  115. package/.docs/raw/memory/storage.mdx +188 -0
  116. package/.docs/raw/memory/working-memory.mdx +7 -7
  117. package/.docs/raw/observability/logging.mdx +10 -11
  118. package/.docs/raw/observability/overview.mdx +0 -1
  119. package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
  120. package/.docs/raw/observability/tracing/exporters/cloud.mdx +1 -1
  121. package/.docs/raw/observability/tracing/exporters/default.mdx +3 -3
  122. package/.docs/raw/observability/tracing/exporters/langfuse.mdx +1 -2
  123. package/.docs/raw/observability/tracing/overview.mdx +23 -25
  124. package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +3 -3
  125. package/.docs/raw/rag/chunking-and-embedding.mdx +18 -31
  126. package/.docs/raw/rag/graph-rag.mdx +220 -0
  127. package/.docs/raw/rag/overview.mdx +2 -3
  128. package/.docs/raw/rag/retrieval.mdx +34 -51
  129. package/.docs/raw/rag/vector-databases.mdx +29 -25
  130. package/.docs/raw/reference/agents/agent.mdx +3 -3
  131. package/.docs/raw/reference/agents/generate.mdx +1 -1
  132. package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
  133. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +3 -3
  134. package/.docs/raw/reference/agents/getDefaultOptions.mdx +3 -3
  135. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +3 -3
  136. package/.docs/raw/reference/agents/getDescription.mdx +1 -1
  137. package/.docs/raw/reference/agents/getInstructions.mdx +3 -3
  138. package/.docs/raw/reference/agents/getLLM.mdx +3 -3
  139. package/.docs/raw/reference/agents/getMemory.mdx +3 -3
  140. package/.docs/raw/reference/agents/getModel.mdx +3 -3
  141. package/.docs/raw/reference/agents/getTools.mdx +2 -2
  142. package/.docs/raw/reference/agents/getVoice.mdx +2 -2
  143. package/.docs/raw/reference/agents/listAgents.mdx +2 -2
  144. package/.docs/raw/reference/agents/listScorers.mdx +3 -3
  145. package/.docs/raw/reference/agents/listTools.mdx +2 -2
  146. package/.docs/raw/reference/agents/listWorkflows.mdx +2 -2
  147. package/.docs/raw/reference/agents/network.mdx +1 -1
  148. package/.docs/raw/reference/ai-sdk/chat-route.mdx +3 -3
  149. package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +2 -2
  150. package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +2 -2
  151. package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +2 -2
  152. package/.docs/raw/reference/ai-sdk/network-route.mdx +3 -3
  153. package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +6 -6
  154. package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +127 -0
  155. package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +107 -0
  156. package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
  157. package/.docs/raw/reference/ai-sdk/workflow-route.mdx +3 -3
  158. package/.docs/raw/reference/auth/auth0.mdx +2 -3
  159. package/.docs/raw/reference/auth/clerk.mdx +2 -3
  160. package/.docs/raw/reference/auth/firebase.mdx +3 -5
  161. package/.docs/raw/reference/auth/jwt.mdx +2 -3
  162. package/.docs/raw/reference/auth/supabase.mdx +2 -3
  163. package/.docs/raw/reference/auth/workos.mdx +2 -3
  164. package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
  165. package/.docs/raw/reference/cli/mastra.mdx +10 -10
  166. package/.docs/raw/reference/client-js/agents.mdx +1 -2
  167. package/.docs/raw/reference/client-js/mastra-client.mdx +2 -2
  168. package/.docs/raw/reference/client-js/workflows.mdx +20 -0
  169. package/.docs/raw/reference/core/getAgent.mdx +1 -1
  170. package/.docs/raw/reference/core/getAgentById.mdx +1 -1
  171. package/.docs/raw/reference/core/getDeployer.mdx +1 -1
  172. package/.docs/raw/reference/core/getLogger.mdx +1 -1
  173. package/.docs/raw/reference/core/getMCPServer.mdx +1 -1
  174. package/.docs/raw/reference/core/getMCPServerById.mdx +1 -1
  175. package/.docs/raw/reference/core/getMemory.mdx +2 -2
  176. package/.docs/raw/reference/core/getServer.mdx +3 -3
  177. package/.docs/raw/reference/core/getStorage.mdx +2 -2
  178. package/.docs/raw/reference/core/getStoredAgentById.mdx +3 -3
  179. package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
  180. package/.docs/raw/reference/core/getVector.mdx +1 -1
  181. package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
  182. package/.docs/raw/reference/core/listAgents.mdx +1 -1
  183. package/.docs/raw/reference/core/listLogs.mdx +1 -1
  184. package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
  185. package/.docs/raw/reference/core/listMCPServers.mdx +1 -1
  186. package/.docs/raw/reference/core/listMemory.mdx +2 -2
  187. package/.docs/raw/reference/core/listStoredAgents.mdx +4 -4
  188. package/.docs/raw/reference/core/listVectors.mdx +1 -1
  189. package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
  190. package/.docs/raw/reference/core/setLogger.mdx +1 -1
  191. package/.docs/raw/reference/core/setStorage.mdx +2 -2
  192. package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
  193. package/.docs/raw/reference/deployer/cloudflare.mdx +1 -2
  194. package/.docs/raw/reference/deployer/deployer.mdx +0 -1
  195. package/.docs/raw/reference/deployer/netlify.mdx +1 -1
  196. package/.docs/raw/reference/deployer/vercel.mdx +2 -4
  197. package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
  198. package/.docs/raw/reference/evals/answer-similarity.mdx +1 -1
  199. package/.docs/raw/reference/evals/bias.mdx +1 -1
  200. package/.docs/raw/reference/evals/completeness.mdx +1 -1
  201. package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
  202. package/.docs/raw/reference/evals/context-precision.mdx +1 -1
  203. package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
  204. package/.docs/raw/reference/evals/hallucination.mdx +1 -1
  205. package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
  206. package/.docs/raw/reference/evals/prompt-alignment.mdx +7 -7
  207. package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
  208. package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
  209. package/.docs/raw/reference/evals/tool-call-accuracy.mdx +10 -10
  210. package/.docs/raw/reference/evals/toxicity.mdx +1 -1
  211. package/.docs/raw/reference/logging/pino-logger.mdx +7 -8
  212. package/.docs/raw/reference/memory/createThread.mdx +2 -2
  213. package/.docs/raw/reference/memory/deleteMessages.mdx +2 -2
  214. package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +2 -2
  215. package/.docs/raw/reference/memory/memory-class.mdx +3 -3
  216. package/.docs/raw/reference/memory/query.mdx +2 -2
  217. package/.docs/raw/reference/memory/recall.mdx +2 -2
  218. package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +1 -1
  219. package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
  220. package/.docs/raw/reference/processors/language-detector.mdx +2 -2
  221. package/.docs/raw/reference/processors/message-history-processor.mdx +2 -2
  222. package/.docs/raw/reference/processors/moderation-processor.mdx +3 -3
  223. package/.docs/raw/reference/processors/pii-detector.mdx +3 -3
  224. package/.docs/raw/reference/processors/processor-interface.mdx +13 -13
  225. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +2 -2
  226. package/.docs/raw/reference/processors/semantic-recall-processor.mdx +2 -2
  227. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
  228. package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
  229. package/.docs/raw/reference/processors/tool-call-filter.mdx +3 -3
  230. package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
  231. package/.docs/raw/reference/processors/working-memory-processor.mdx +3 -3
  232. package/.docs/raw/reference/rag/chunk.mdx +1 -1
  233. package/.docs/raw/reference/rag/database-config.mdx +1 -1
  234. package/.docs/raw/reference/rag/extract-params.mdx +2 -2
  235. package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
  236. package/.docs/raw/reference/server/create-route.mdx +14 -14
  237. package/.docs/raw/reference/server/express-adapter.mdx +10 -11
  238. package/.docs/raw/reference/server/hono-adapter.mdx +10 -11
  239. package/.docs/raw/reference/server/mastra-server.mdx +22 -22
  240. package/.docs/raw/reference/server/routes.mdx +28 -1
  241. package/.docs/raw/reference/storage/cloudflare-d1.mdx +3 -3
  242. package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
  243. package/.docs/raw/reference/storage/convex.mdx +6 -6
  244. package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
  245. package/.docs/raw/reference/storage/lance.mdx +3 -3
  246. package/.docs/raw/reference/storage/libsql.mdx +69 -54
  247. package/.docs/raw/reference/storage/mongodb.mdx +80 -7
  248. package/.docs/raw/reference/storage/mssql.mdx +4 -4
  249. package/.docs/raw/{server-db/storage.mdx → reference/storage/overview.mdx} +13 -111
  250. package/.docs/raw/reference/storage/postgresql.mdx +78 -7
  251. package/.docs/raw/reference/storage/upstash.mdx +74 -2
  252. package/.docs/raw/reference/streaming/agents/stream.mdx +27 -5
  253. package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +2 -2
  254. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
  255. package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +1 -1
  256. package/.docs/raw/reference/streaming/workflows/stream.mdx +35 -22
  257. package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +4 -4
  258. package/.docs/raw/reference/templates/overview.mdx +1 -2
  259. package/.docs/raw/reference/tools/create-tool.mdx +24 -5
  260. package/.docs/raw/reference/tools/graph-rag-tool.mdx +3 -3
  261. package/.docs/raw/reference/tools/vector-query-tool.mdx +4 -4
  262. package/.docs/raw/reference/vectors/astra.mdx +3 -3
  263. package/.docs/raw/reference/vectors/chroma.mdx +3 -3
  264. package/.docs/raw/reference/vectors/convex.mdx +12 -12
  265. package/.docs/raw/reference/vectors/couchbase.mdx +5 -5
  266. package/.docs/raw/reference/vectors/duckdb.mdx +10 -10
  267. package/.docs/raw/reference/vectors/elasticsearch.mdx +4 -4
  268. package/.docs/raw/reference/vectors/lance.mdx +4 -4
  269. package/.docs/raw/reference/vectors/libsql.mdx +61 -11
  270. package/.docs/raw/reference/vectors/mongodb.mdx +58 -5
  271. package/.docs/raw/reference/vectors/pg.mdx +53 -6
  272. package/.docs/raw/reference/vectors/pinecone.mdx +3 -3
  273. package/.docs/raw/reference/vectors/qdrant.mdx +3 -3
  274. package/.docs/raw/reference/vectors/s3vectors.mdx +6 -6
  275. package/.docs/raw/reference/vectors/turbopuffer.mdx +4 -4
  276. package/.docs/raw/reference/vectors/upstash.mdx +55 -6
  277. package/.docs/raw/reference/vectors/vectorize.mdx +3 -3
  278. package/.docs/raw/reference/workflows/run-methods/cancel.mdx +2 -2
  279. package/.docs/raw/reference/workflows/run-methods/restart.mdx +1 -3
  280. package/.docs/raw/reference/workflows/run-methods/resume.mdx +2 -2
  281. package/.docs/raw/reference/workflows/run-methods/start.mdx +2 -2
  282. package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +143 -0
  283. package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +5 -5
  284. package/.docs/raw/reference/workflows/run.mdx +1 -1
  285. package/.docs/raw/reference/workflows/step.mdx +3 -3
  286. package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
  287. package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
  288. package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +37 -2
  289. package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
  290. package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
  291. package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +6 -6
  292. package/.docs/raw/reference/workflows/workflow-methods/map.mdx +7 -7
  293. package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
  294. package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
  295. package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +2 -2
  296. package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +2 -2
  297. package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
  298. package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +2 -2
  299. package/.docs/raw/reference/workflows/workflow.mdx +17 -3
  300. package/.docs/raw/{auth → server/auth}/auth0.mdx +20 -14
  301. package/.docs/raw/{auth → server/auth}/clerk.mdx +16 -9
  302. package/.docs/raw/{auth → server/auth}/firebase.mdx +21 -15
  303. package/.docs/raw/{auth → server/auth}/index.mdx +6 -6
  304. package/.docs/raw/{auth → server/auth}/jwt.mdx +14 -7
  305. package/.docs/raw/{auth → server/auth}/supabase.mdx +16 -9
  306. package/.docs/raw/{auth → server/auth}/workos.mdx +19 -13
  307. package/.docs/raw/{server-db → server}/custom-adapters.mdx +13 -13
  308. package/.docs/raw/{server-db → server}/custom-api-routes.mdx +3 -5
  309. package/.docs/raw/{server-db → server}/mastra-client.mdx +26 -15
  310. package/.docs/raw/{server-db → server}/mastra-server.mdx +8 -8
  311. package/.docs/raw/{server-db → server}/middleware.mdx +9 -9
  312. package/.docs/raw/{server-db → server}/request-context.mdx +33 -32
  313. package/.docs/raw/{server-db → server}/server-adapters.mdx +12 -12
  314. package/.docs/raw/streaming/events.mdx +14 -7
  315. package/.docs/raw/streaming/overview.mdx +21 -10
  316. package/.docs/raw/streaming/tool-streaming.mdx +6 -6
  317. package/.docs/raw/streaming/workflow-streaming.mdx +6 -8
  318. package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
  319. package/.docs/raw/tools-mcp/mcp-overview.mdx +31 -12
  320. package/.docs/raw/tools-mcp/overview.mdx +10 -11
  321. package/.docs/raw/voice/overview.mdx +1 -1
  322. package/.docs/raw/workflows/agents-and-tools.mdx +28 -19
  323. package/.docs/raw/workflows/control-flow.mdx +27 -40
  324. package/.docs/raw/workflows/error-handling.mdx +172 -18
  325. package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
  326. package/.docs/raw/workflows/inngest-workflow.mdx +8 -9
  327. package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
  328. package/.docs/raw/workflows/overview.mdx +34 -23
  329. package/.docs/raw/workflows/snapshots.mdx +14 -44
  330. package/.docs/raw/workflows/suspend-and-resume.mdx +7 -7
  331. package/.docs/raw/workflows/time-travel.mdx +16 -16
  332. package/.docs/raw/workflows/workflow-state.mdx +5 -8
  333. package/CHANGELOG.md +23 -0
  334. package/dist/logger.d.ts +3 -0
  335. package/dist/logger.d.ts.map +1 -1
  336. package/dist/stdio.js +53 -0
  337. package/package.json +4 -4
  338. package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +0 -1
  339. package/.docs/raw/deployment/cloud-providers/index.mdx +0 -55
  340. package/.docs/raw/memory/conversation-history.mdx +0 -24
  341. package/.docs/raw/memory/storage/memory-with-libsql.mdx +0 -140
  342. package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -150
  343. package/.docs/raw/memory/storage/memory-with-pg.mdx +0 -138
  344. package/.docs/raw/memory/storage/memory-with-upstash.mdx +0 -146
  345. package/.docs/raw/memory/threads-and-resources.mdx +0 -95
@@ -19,7 +19,7 @@ This example uses WorkOS authentication. Make sure to:
19
19
  3. Configure your redirect URIs and allowed origins
20
20
  4. Set up Organizations and configure user roles as needed
21
21
 
22
- ```env title=".env" copy
22
+ ```env title=".env"
23
23
  WORKOS_API_KEY=sk_live_...
24
24
  WORKOS_CLIENT_ID=client_...
25
25
  ```
@@ -32,7 +32,7 @@ WORKOS_CLIENT_ID=client_...
32
32
 
33
33
  Before you can use the `MastraAuthWorkos` class you have to install the `@mastra/auth-workos` package.
34
34
 
35
- ```bash copy
35
+ ```bash
36
36
  npm install @mastra/auth-workos@beta
37
37
  ```
38
38
 
@@ -40,12 +40,11 @@ npm install @mastra/auth-workos@beta
40
40
 
41
41
  ### Basic usage with environment variables
42
42
 
43
- ```typescript {2,7} title="src/mastra/index.ts" showLineNumbers copy
43
+ ```typescript {2,6} title="src/mastra/index.ts"
44
44
  import { Mastra } from "@mastra/core";
45
45
  import { MastraAuthWorkos } from "@mastra/auth-workos";
46
46
 
47
47
  export const mastra = new Mastra({
48
- // ..
49
48
  server: {
50
49
  auth: new MastraAuthWorkos(),
51
50
  },
@@ -54,12 +53,11 @@ export const mastra = new Mastra({
54
53
 
55
54
  ### Custom configuration
56
55
 
57
- ```typescript {2,7-10} title="src/mastra/index.ts" showLineNumbers copy
56
+ ```typescript {2,6-9} title="src/mastra/index.ts"
58
57
  import { Mastra } from "@mastra/core";
59
58
  import { MastraAuthWorkos } from "@mastra/auth-workos";
60
59
 
61
60
  export const mastra = new Mastra({
62
- // ..
63
61
  server: {
64
62
  auth: new MastraAuthWorkos({
65
63
  apiKey: process.env.WORKOS_API_KEY,
@@ -82,7 +80,7 @@ By default, `MastraAuthWorkos` checks whether the authenticated user has an 'adm
82
80
 
83
81
  To customize user authorization, provide a custom `authorizeUser` function:
84
82
 
85
- ```typescript title="src/mastra/auth.ts" showLineNumbers copy
83
+ ```typescript title="src/mastra/auth.ts"
86
84
  import { MastraAuthWorkos } from "@mastra/auth-workos";
87
85
 
88
86
  const workosAuth = new MastraAuthWorkos({
@@ -94,7 +92,11 @@ const workosAuth = new MastraAuthWorkos({
94
92
  });
95
93
  ```
96
94
 
97
- > See the [MastraAuthWorkos](/reference/v1/auth/workos) API reference for all available configuration options.
95
+ :::info
96
+
97
+ Visit [MastraAuthWorkos](/reference/v1/auth/workos) for all available configuration options.
98
+
99
+ :::
98
100
 
99
101
  ## Client-side setup
100
102
 
@@ -104,7 +106,7 @@ When using WorkOS auth, you'll need to implement the WorkOS authentication flow
104
106
 
105
107
  First, install the WorkOS SDK in your application:
106
108
 
107
- ```bash copy
109
+ ```bash
108
110
  npm install @workos-inc/node
109
111
  ```
110
112
 
@@ -112,7 +114,7 @@ npm install @workos-inc/node
112
114
 
113
115
  After users complete the WorkOS authentication flow and return with an authorization code, exchange it for an access token:
114
116
 
115
- ```typescript title="lib/auth.ts" showLineNumbers copy
117
+ ```typescript title="lib/auth.ts"
116
118
  import { WorkOS } from "@workos-inc/node";
117
119
 
118
120
  const workos = new WorkOS(process.env.WORKOS_API_KEY);
@@ -137,7 +139,7 @@ export const authenticateWithWorkos = async (
137
139
 
138
140
  When `auth` is enabled, all requests made with `MastraClient` must include a valid WorkOS access token in the `Authorization` header:
139
141
 
140
- ```typescript title="lib/mastra/mastra-client.ts" showLineNumbers copy
142
+ ```typescript title="lib/mastra/mastra-client.ts"
141
143
  import { MastraClient } from "@mastra/client-js";
142
144
 
143
145
  export const createMastraClient = (accessToken: string) => {
@@ -152,7 +154,11 @@ export const createMastraClient = (accessToken: string) => {
152
154
 
153
155
  > **Note:** The access token must be prefixed with `Bearer` in the Authorization header.
154
156
 
155
- > See [Mastra Client SDK](/docs/v1/server-db/mastra-client) for more configuration options.
157
+ :::info
158
+
159
+ Visit [Mastra Client SDK](/docs/v1/server/mastra-client) for more configuration options.
160
+
161
+ :::
156
162
 
157
163
  ### Making authenticated requests
158
164
 
@@ -160,7 +166,7 @@ Once `MastraClient` is configured with the WorkOS access token, you can send aut
160
166
 
161
167
  <Tabs>
162
168
  <TabItem value="react" label="React">
163
- ```typescript title="src/api/agents.ts" showLineNumbers copy
169
+ ```typescript title="src/api/agents.ts" copy
164
170
  import { WorkOS } from '@workos-inc/node';
165
171
  import { MastraClient } from '@mastra/client-js';
166
172
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Custom Adapters | Server & DB"
2
+ title: "Custom Adapters | Server"
3
3
  description: "Create a custom server adapter for frameworks other than Hono or Express."
4
4
  ---
5
5
 
@@ -25,7 +25,7 @@ The `MastraServer` abstract class from `@mastra/server/server-adapter` provides
25
25
 
26
26
  The class takes three type parameters that represent your framework's types:
27
27
 
28
- ```typescript title="my-framework-adapter.ts" copy
28
+ ```typescript title="my-framework-adapter.ts"
29
29
  import { MastraServer } from '@mastra/server/server-adapter';
30
30
 
31
31
  export class MyFrameworkServer extends MastraServer<
@@ -50,7 +50,7 @@ You must implement these six abstract methods. Each handles a specific part of t
50
50
 
51
51
  This method runs first and attaches Mastra context to every incoming request. Route handlers need access to the Mastra instance, tools, and other context to function. How you attach this context depends on your framework — Express uses `res.locals`, Hono uses `c.set()`, and other frameworks have their own patterns.
52
52
 
53
- ```typescript copy
53
+ ```typescript
54
54
  registerContextMiddleware(): void {
55
55
  this.app.use('*', (req, res, next) => {
56
56
  // Attach context to your framework's request/response
@@ -77,7 +77,7 @@ Context to attach:
77
77
 
78
78
  Register authentication and authorization middleware. This method should check if authentication is configured on the Mastra instance and skip registration entirely if not. When auth is configured, you'll typically register two middleware functions: one for authentication (validating tokens and setting the user) and one for authorization (checking if the user can access the requested resource).
79
79
 
80
- ```typescript copy
80
+ ```typescript
81
81
  registerAuthMiddleware(): void {
82
82
  const authConfig = this.mastra.getServer()?.auth;
83
83
  if (!authConfig) return;
@@ -113,7 +113,7 @@ registerAuthMiddleware(): void {
113
113
 
114
114
  Register a single route with your framework. This method is called once for each Mastra route during initialization. It receives a `ServerRoute` object containing the path, HTTP method, handler function, and Zod schemas for validation. Your implementation should wire this up to your framework's routing system.
115
115
 
116
- ```typescript copy
116
+ ```typescript
117
117
  async registerRoute(
118
118
  app: MyApp,
119
119
  route: ServerRoute,
@@ -160,7 +160,7 @@ async registerRoute(
160
160
 
161
161
  Extract URL parameters, query parameters, and request body from the incoming request. Different frameworks expose these values in different ways—Express uses `req.params`, `req.query`, and `req.body`, while other frameworks may use different property names or require method calls. This method normalizes the extraction for your framework.
162
162
 
163
- ```typescript copy
163
+ ```typescript
164
164
  async getParams(
165
165
  route: ServerRoute,
166
166
  request: MyRequest
@@ -184,7 +184,7 @@ async getParams(
184
184
 
185
185
  Send the response back to the client based on the route's response type. Mastra routes can return different response types: JSON for most API responses, streams for agent generation, and special types for MCP transports. Your implementation should handle each type appropriately for your framework.
186
186
 
187
- ```typescript copy
187
+ ```typescript
188
188
  async sendResponse(
189
189
  route: ServerRoute,
190
190
  response: MyResponse,
@@ -219,7 +219,7 @@ async sendResponse(
219
219
 
220
220
  Handle streaming responses for agent generation. When an agent generates a response, it produces a stream of chunks that should be sent to the client as they become available. This method reads from the stream, optionally applies redaction to hide sensitive data, and writes chunks to the response in the appropriate format (SSE or newline-delimited JSON).
221
221
 
222
- ```typescript copy
222
+ ```typescript
223
223
  async stream(
224
224
  route: ServerRoute,
225
225
  response: MyResponse,
@@ -282,7 +282,7 @@ The `parse*` methods use Zod schemas defined on each route to validate input and
282
282
 
283
283
  Your adapter's constructor should accept the same options as the base class and pass them to `super()`. You can add additional framework-specific options if needed:
284
284
 
285
- ```typescript copy
285
+ ```typescript
286
286
  constructor(options: {
287
287
  app: MyApp;
288
288
  mastra: Mastra;
@@ -296,13 +296,13 @@ constructor(options: {
296
296
  }
297
297
  ```
298
298
 
299
- See [Server Adapters](/docs/v1/server-db/server-adapters#constructor-options) for full documentation on each option.
299
+ See [Server Adapters](/docs/v1/server/server-adapters#constructor-options) for full documentation on each option.
300
300
 
301
301
  ## Full example
302
302
 
303
303
  Here's a skeleton implementation showing all the required methods. This uses pseudocode for framework-specific parts—replace with your framework's actual APIs:
304
304
 
305
- ```typescript title="my-framework-adapter.ts" copy
305
+ ```typescript title="my-framework-adapter.ts"
306
306
  import { MastraServer, ServerRoute } from '@mastra/server/server-adapter';
307
307
  import type { Mastra } from '@mastra/core';
308
308
 
@@ -359,7 +359,7 @@ export class MyFrameworkServer extends MastraServer<MyApp, MyRequest, MyResponse
359
359
 
360
360
  Once your adapter is implemented, use it the same way as the provided adapters:
361
361
 
362
- ```typescript title="server.ts" copy
362
+ ```typescript title="server.ts"
363
363
  import { MyFrameworkServer } from './my-framework-adapter';
364
364
  import { mastra } from './mastra';
365
365
 
@@ -379,7 +379,7 @@ The existing [@mastra/hono](https://github.com/mastra-ai/mastra/blob/main/server
379
379
 
380
380
  ## Related
381
381
 
382
- - [Server Adapters](/docs/v1/server-db/server-adapters) - Overview and shared concepts
382
+ - [Server Adapters](/docs/v1/server/server-adapters) - Overview and shared concepts
383
383
  - [Hono Adapter](/reference/v1/server/hono-adapter) - Reference implementation
384
384
  - [Express Adapter](/reference/v1/server/express-adapter) - Reference implementation
385
385
  - [MastraServer Reference](/reference/v1/server/mastra-server) - Full API reference
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Custom API Routes | Server & DB"
2
+ title: "Custom API Routes | Server"
3
3
  description: "Expose additional HTTP endpoints from your Mastra server."
4
4
  ---
5
5
 
@@ -9,12 +9,11 @@ By default, Mastra automatically exposes registered agents and workflows via its
9
9
 
10
10
  Routes are provided with a helper `registerApiRoute()` from `@mastra/core/server`. Routes can live in the same file as the `Mastra` instance but separating them helps keep configuration concise.
11
11
 
12
- ```typescript title="src/mastra/index.ts" copy
12
+ ```typescript title="src/mastra/index.ts"
13
13
  import { Mastra } from "@mastra/core";
14
14
  import { registerApiRoute } from "@mastra/core/server";
15
15
 
16
16
  export const mastra = new Mastra({
17
- // ...
18
17
  server: {
19
18
  apiRoutes: [
20
19
  registerApiRoute("/my-custom-route", {
@@ -41,12 +40,11 @@ Each route's handler receives the Hono `Context`. Within the handler you can acc
41
40
 
42
41
  To add route-specific middleware pass a `middleware` array when calling `registerApiRoute()`.
43
42
 
44
- ```typescript title="src/mastra/index.ts" copy
43
+ ```typescript title="src/mastra/index.ts"
45
44
  import { Mastra } from "@mastra/core";
46
45
  import { registerApiRoute } from "@mastra/core/server";
47
46
 
48
47
  export const mastra = new Mastra({
49
- // ...
50
48
  server: {
51
49
  apiRoutes: [
52
50
  registerApiRoute("/my-custom-route", {
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Mastra Client SDK | Server & DB"
2
+ title: "Mastra Client SDK | Server"
3
3
  description: "Learn how to set up and use the Mastra Client SDK"
4
4
  ---
5
5
 
@@ -8,7 +8,7 @@ import TabItem from "@theme/TabItem";
8
8
 
9
9
  # Mastra Client SDK
10
10
 
11
- The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](/docs/v1/server-db/mastra-server) from your client environment.
11
+ The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](/docs/v1/server/mastra-server) from your client environment.
12
12
 
13
13
  ## Prerequisites
14
14
 
@@ -61,7 +61,7 @@ To use the Mastra Client SDK, install the required dependencies:
61
61
 
62
62
  Once initialized with a `baseUrl`, `MastraClient` exposes a type-safe interface for calling agents, tools, and workflows.
63
63
 
64
- ```typescript title="lib/mastra-client.ts" showLineNumbers copy
64
+ ```typescript title="lib/mastra-client.ts"
65
65
  import { MastraClient } from "@mastra/client-js";
66
66
 
67
67
  export const mastraClient = new MastraClient({
@@ -85,7 +85,7 @@ The Mastra Client SDK exposes all resources served by the Mastra Server
85
85
 
86
86
  Call `.generate()` with an array of message objects that include `role` and `content`:
87
87
 
88
- ```typescript showLineNumbers copy
88
+ ```typescript
89
89
  import { mastraClient } from "lib/mastra-client";
90
90
 
91
91
  const testAgent = async () => {
@@ -108,13 +108,17 @@ const testAgent = async () => {
108
108
  };
109
109
  ```
110
110
 
111
- > See [.generate()](/reference/v1/client-js/agents#generate-response) for more information.
111
+ :::info
112
+
113
+ Visit [.generate()](/reference/v1/client-js/agents#generate-response) for more information.
114
+
115
+ :::
112
116
 
113
117
  ## Streaming responses
114
118
 
115
119
  Use `.stream()` for real-time responses with an array of message objects that include `role` and `content`:
116
120
 
117
- ```typescript showLineNumbers copy
121
+ ```typescript
118
122
  import { mastraClient } from "lib/mastra-client";
119
123
 
120
124
  const testAgent = async () => {
@@ -141,17 +145,20 @@ const testAgent = async () => {
141
145
  };
142
146
  ```
143
147
 
144
- > See [.stream()](/reference/v1/client-js/agents#stream-response) for more information.
148
+ :::info
149
+
150
+ Visit [.stream()](/reference/v1/client-js/agents#stream-response) for more information.
151
+
152
+ :::
145
153
 
146
154
  ## Configuration options
147
155
 
148
156
  `MastraClient` accepts optional parameters like `retries`, `backoffMs`, and `headers` to control request behavior. These parameters are useful for controlling retry behavior and including diagnostic metadata.
149
157
 
150
- ```typescript title="lib/mastra-client.ts" showLineNumbers copy
158
+ ```typescript title="lib/mastra-client.ts"
151
159
  import { MastraClient } from "@mastra/client-js";
152
160
 
153
161
  export const mastraClient = new MastraClient({
154
- // ...
155
162
  retries: 3,
156
163
  backoffMs: 300,
157
164
  maxBackoffMs: 5000,
@@ -161,7 +168,11 @@ export const mastraClient = new MastraClient({
161
168
  });
162
169
  ```
163
170
 
164
- > See [MastraClient](/reference/v1/client-js/mastra-client) for more configuration options.
171
+ :::info
172
+
173
+ Visit [MastraClient](/reference/v1/client-js/mastra-client) for more configuration options.
174
+
175
+ :::
165
176
 
166
177
  ## Adding request cancelling
167
178
 
@@ -169,7 +180,7 @@ export const mastraClient = new MastraClient({
169
180
 
170
181
  Pass an `AbortSignal` to the client constructor to enable cancellation across all requests.
171
182
 
172
- ```typescript {3,7} title="lib/mastra-client.ts" showLineNumbers copy
183
+ ```typescript {3,7} title="lib/mastra-client.ts"
173
184
  import { MastraClient } from "@mastra/client-js";
174
185
 
175
186
  export const controller = new AbortController();
@@ -184,7 +195,7 @@ export const mastraClient = new MastraClient({
184
195
 
185
196
  Calling `.abort()` will cancel any ongoing requests tied to that signal.
186
197
 
187
- ```typescript {4} showLineNumbers copy
198
+ ```typescript {4}
188
199
  import { mastraClient, controller } from "lib/mastra-client";
189
200
 
190
201
  const handleAbort = () => {
@@ -198,7 +209,7 @@ Define tools directly in client-side applications using the `createTool()` funct
198
209
 
199
210
  This lets agents trigger browser-side functionality such as DOM manipulation, local storage access, or other Web APIs, enabling tool execution in the user's environment rather than on the server.
200
211
 
201
- ```typescript {27} showLineNumbers copy
212
+ ```typescript {27}
202
213
  import { createTool } from "@mastra/client-js";
203
214
  import { z } from "zod";
204
215
 
@@ -239,7 +250,7 @@ const handleClientTool = async () => {
239
250
 
240
251
  This is a standard Mastra [agent](../agents/overview#setting-up-agents) configured to return hex color codes, intended to work with the browser-based client tool defined above.
241
252
 
242
- ```typescript title="src/mastra/agents/color-agent" showLineNumbers copy
253
+ ```typescript title="src/mastra/agents/color-agent"
243
254
  import { Agent } from "@mastra/core/agent";
244
255
 
245
256
  export const colorAgent = new Agent({
@@ -256,7 +267,7 @@ export const colorAgent = new Agent({
256
267
 
257
268
  You can also use `MastraClient` in server-side environments such as API routes, serverless functions or actions. The usage will broadly remain the same but you may need to recreate the response to your client:
258
269
 
259
- ```typescript {8} showLineNumbers
270
+ ```typescript {8}
260
271
  export async function action() {
261
272
  const agent = mastraClient.getAgent("testAgent");
262
273
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Server Configuration | Server & DB"
2
+ title: "Server Configuration | Server"
3
3
  description: "Configure the Mastra server with custom settings for port, timeout, CORS, and more."
4
4
  ---
5
5
 
@@ -9,7 +9,7 @@ When deploying your Mastra application to production, it runs as an HTTP server
9
9
 
10
10
  :::info
11
11
 
12
- This page covers the `server` configuration options passed to the `Mastra` constructor. For running Mastra with your own HTTP server (Hono, Express, etc.), see [Server Adapters](/docs/v1/server-db/server-adapters).
12
+ This page covers the `server` configuration options passed to the `Mastra` constructor. For running Mastra with your own HTTP server (Hono, Express, etc.), see [Server Adapters](/docs/v1/server/server-adapters).
13
13
 
14
14
  :::
15
15
 
@@ -27,15 +27,15 @@ The server provides:
27
27
  - Configuration of port
28
28
  - Configuration of body limit
29
29
 
30
- See the [Middleware](/docs/v1/server-db/middleware) and
31
- [Custom API Routes](/docs/v1/server-db/custom-api-routes) pages for details on
30
+ See the [Middleware](/docs/v1/server/middleware) and
31
+ [Custom API Routes](/docs/v1/server/custom-api-routes) pages for details on
32
32
  adding additional server behaviour.
33
33
 
34
34
  ## Server configuration
35
35
 
36
36
  You can configure server `port`, `host`, `studioBase`, and `timeout` in the Mastra instance.
37
37
 
38
- ```typescript title="src/mastra/index.ts" copy
38
+ ```typescript title="src/mastra/index.ts"
39
39
  import { Mastra } from "@mastra/core";
40
40
 
41
41
  export const mastra = new Mastra({
@@ -54,7 +54,7 @@ The `studioBase` option allows you to host Mastra Studio on a sub-path of your e
54
54
 
55
55
  Mastra requires `module` and `moduleResolution` values that support modern Node.js versions. Older settings like `CommonJS` or `node` are incompatible with Mastra’s packages and will cause resolution errors.
56
56
 
57
- ```json {4-5} title="tsconfig.json" copy
57
+ ```json {4-5} title="tsconfig.json"
58
58
  {
59
59
  "compilerOptions": {
60
60
  "target": "ES2022",
@@ -77,7 +77,7 @@ Mastra requires `module` and `moduleResolution` values that support modern Node.
77
77
 
78
78
  Mastra allows you to configure CORS (Cross-Origin Resource Sharing) settings for your server.
79
79
 
80
- ```typescript title="src/mastra/index.ts" copy
80
+ ```typescript title="src/mastra/index.ts"
81
81
  import { Mastra } from "@mastra/core";
82
82
 
83
83
  export const mastra = new Mastra({
@@ -96,4 +96,4 @@ export const mastra = new Mastra({
96
96
 
97
97
  When streaming agent responses, the HTTP streaming layer redacts system prompts, tool definitions, API keys, and similar data from each chunk before sending it to clients. This is enabled by default.
98
98
 
99
- If you're using server adapters directly, you can configure redaction behavior. See [Stream data redaction](/docs/v1/server-db/server-adapters#stream-data-redaction) in the Server Adapters docs.
99
+ If you're using server adapters directly, you can configure redaction behavior. See [Stream data redaction](/docs/v1/server/server-adapters#stream-data-redaction) in the Server Adapters docs.
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Middleware | Server & DB"
2
+ title: "Middleware | Server"
3
3
  description: "Apply custom middleware functions to intercept requests."
4
4
  ---
5
5
 
@@ -13,7 +13,7 @@ A middleware receives the [Hono](https://hono.dev) `Context` (`c`) and a `next`
13
13
  function. If it returns a `Response` the request is short-circuited. Calling
14
14
  `next()` continues processing the next middleware or route handler.
15
15
 
16
- ```typescript copy showLineNumbers
16
+ ```typescript
17
17
  import { Mastra } from "@mastra/core";
18
18
 
19
19
  export const mastra = new Mastra({
@@ -44,7 +44,7 @@ export const mastra = new Mastra({
44
44
  To attach middleware to a single route pass the `middleware` option to
45
45
  `registerApiRoute`:
46
46
 
47
- ```typescript copy showLineNumbers
47
+ ```typescript
48
48
  registerApiRoute("/my-custom-route", {
49
49
  method: "GET",
50
50
  middleware: [
@@ -68,7 +68,7 @@ registerApiRoute("/my-custom-route", {
68
68
 
69
69
  You can populate `RequestContext` dynamically in server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
70
70
 
71
- ```typescript title="src/mastra/index.ts" showLineNumbers copy
71
+ ```typescript title="src/mastra/index.ts"
72
72
  import { Mastra } from "@mastra/core";
73
73
  import { RequestContext } from "@mastra/core/request-context";
74
74
  import { testWeatherAgent } from "./agents/test-weather-agent";
@@ -95,7 +95,7 @@ export const mastra = new Mastra({
95
95
 
96
96
  ### Authentication
97
97
 
98
- ```typescript copy
98
+ ```typescript
99
99
  {
100
100
  handler: async (c, next) => {
101
101
  const authHeader = c.req.header('Authorization');
@@ -112,7 +112,7 @@ export const mastra = new Mastra({
112
112
 
113
113
  ### CORS support
114
114
 
115
- ```typescript copy
115
+ ```typescript
116
116
  {
117
117
  handler: async (c, next) => {
118
118
  c.header('Access-Control-Allow-Origin', '*');
@@ -136,7 +136,7 @@ export const mastra = new Mastra({
136
136
 
137
137
  ### Request logging
138
138
 
139
- ```typescript copy
139
+ ```typescript
140
140
  {
141
141
  handler: async (c, next) => {
142
142
  const start = Date.now();
@@ -152,7 +152,7 @@ export const mastra = new Mastra({
152
152
  When integrating with Mastra Cloud or custom clients the following headers can
153
153
  be inspected by middleware to tailor behavior:
154
154
 
155
- ```typescript copy
155
+ ```typescript
156
156
  {
157
157
  handler: async (c, next) => {
158
158
  const isFromMastraCloud = c.req.header('x-mastra-cloud') === 'true';
@@ -174,4 +174,4 @@ be inspected by middleware to tailor behavior:
174
174
 
175
175
  # Related
176
176
 
177
- - [Request Context](/docs/v1/server-db/request-context)
177
+ - [Request Context](/docs/v1/server/request-context)
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "Request Context | Server & DB"
2
+ title: "Request Context | Server"
3
3
  description: Learn how to use Mastra's RequestContext to provide dynamic, request-specific configuration to agents.
4
4
  ---
5
5
 
@@ -28,7 +28,7 @@ The `.set()` method takes two arguments:
28
28
  1. **key**: The name used to identify the value.
29
29
  2. **value**: The data to associate with that key.
30
30
 
31
- ```typescript showLineNumbers
31
+ ```typescript
32
32
  import { RequestContext } from "@mastra/core/request-context";
33
33
 
34
34
  export type UserTier = {
@@ -74,7 +74,7 @@ await weatherTool.execute({
74
74
 
75
75
  You can populate `requestContext` dynamically in server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
76
76
 
77
- ```typescript title="src/mastra/index.ts" showLineNumbers copy
77
+ ```typescript title="src/mastra/index.ts"
78
78
  import { Mastra } from "@mastra/core";
79
79
  import { RequestContext } from "@mastra/core/request-context";
80
80
  import { testWeatherAgent } from "./agents/test-weather-agent";
@@ -99,13 +99,17 @@ export const mastra = new Mastra({
99
99
  });
100
100
  ```
101
101
 
102
- > See [Middleware](/docs/v1/server-db/middleware) for how to use server middleware.
102
+ :::info
103
+
104
+ Visit [Middleware](/docs/v1/server/middleware) for how to use server middleware.
105
+
106
+ :::
103
107
 
104
108
  ## Accessing values with agents
105
109
 
106
110
  You can access the `requestContext` argument from any supported configuration options in agents. These functions can be sync or `async`. Use the `.get()` method to read values from `requestContext`.
107
111
 
108
- ```typescript {7-8,15,18,21} title="src/mastra/agents/weather-agent.ts" showLineNumbers
112
+ ```typescript title="src/mastra/agents/weather-agent.ts"
109
113
  export type UserTier = {
110
114
  "user-tier": "enterprise" | "pro";
111
115
  };
@@ -116,32 +120,27 @@ export const weatherAgent = new Agent({
116
120
  instructions: async ({ requestContext }) => {
117
121
  const userTier = requestContext.get("user-tier") as UserTier["user-tier"];
118
122
 
119
- if (userTier === "enterprise") {
120
- // ...
121
- }
122
- // ...
123
- },
124
- model: ({ requestContext }) => {
125
- // ...
126
- },
127
- tools: ({ requestContext }) => {
128
- // ...
129
- },
130
- memory: ({ requestContext }) => {
131
- // ...
123
+ if (userTier === "enterprise") {}
132
124
  },
125
+ model: ({ requestContext }) => {},
126
+ tools: ({ requestContext }) => {},
127
+ memory: ({ requestContext }) => {},
133
128
  });
134
129
  ```
135
130
 
136
131
  You can also use `requestContext` with other options like `agents`, `workflows`, `scorers`, `inputProcessors`, and `outputProcessors`.
137
132
 
138
- > See [Agent](/reference/v1/agents/agent) for a full list of configuration options.
133
+ :::info
134
+
135
+ Visit [Agent](/reference/v1/agents/agent) for a full list of configuration options.
136
+
137
+ :::
139
138
 
140
139
  ## Accessing values from workflow steps
141
140
 
142
141
  You can access the `requestContext` argument from a workflow step's `execute` function. This function can be sync or async. Use the `.get()` method to read values from `requestContext`.
143
142
 
144
- ```typescript {7-8} title="src/mastra/workflows/weather-workflow.ts" showLineNumbers copy
143
+ ```typescript title="src/mastra/workflows/weather-workflow.ts"
145
144
  export type UserTier = {
146
145
  "user-tier": "enterprise" | "pro";
147
146
  };
@@ -151,21 +150,22 @@ const stepOne = createStep({
151
150
  execute: async ({ requestContext }) => {
152
151
  const userTier = requestContext.get("user-tier") as UserTier["user-tier"];
153
152
 
154
- if (userTier === "enterprise") {
155
- // ...
156
- }
157
- // ...
153
+ if (userTier === "enterprise") {}
158
154
  },
159
155
  });
160
156
  ```
161
157
 
162
- > See [createStep()](/reference/v1/workflows/step) for a full list of configuration options.
158
+ :::info
159
+
160
+ Visit [createStep()](/reference/v1/workflows/step) for a full list of configuration options.
161
+
162
+ :::
163
163
 
164
164
  ## Accessing values with tools
165
165
 
166
166
  You can access the `requestContext` argument from a tool’s `execute` function. This function is `async`. Use the `.get()` method to read values from `requestContext`.
167
167
 
168
- ```typescript {7-8} title="src/mastra/tools/weather-tool.ts" showLineNumbers
168
+ ```typescript title="src/mastra/tools/weather-tool.ts"
169
169
  export type UserTier = {
170
170
  "user-tier": "enterprise" | "pro";
171
171
  };
@@ -175,19 +175,20 @@ export const weatherTool = createTool({
175
175
  execute: async ({ requestContext }) => {
176
176
  const userTier = requestContext.get("user-tier") as UserTier["user-tier"];
177
177
 
178
- if (userTier === "enterprise") {
179
- // ...
180
- }
181
- // ...
178
+ if (userTier === "enterprise") {}
182
179
  },
183
180
  });
184
181
  ```
185
182
 
186
- > See [createTool()](/reference/v1/tools/create-tool) for a full list of configuration options.
183
+ :::info
184
+
185
+ Visit [createTool()](/reference/v1/tools/create-tool) for a full list of configuration options.
186
+
187
+ :::
187
188
 
188
189
  ## Related
189
190
 
190
191
  - [Agent Request Context](/docs/v1/agents/overview#using-requestcontext)
191
192
  - [Workflow Request Context](../workflows/overview#using-requestcontext)
192
193
  - [Tool Request Context](../mcp/overview#using-requestcontext)
193
- - [Server Middleware](/docs/v1/server-db/middleware)
194
+ - [Server Middleware](/docs/v1/server/middleware)