@mastra/mcp-docs-server 0.0.0-commonjs-20250414101718

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 (254) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fastra.md +302 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +302 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +161 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +302 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +110 -0
  6. package/.docs/organized/changelogs/%40mastra%2Fcore.md +302 -0
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +302 -0
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +302 -0
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +302 -0
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +302 -0
  11. package/.docs/organized/changelogs/%40mastra%2Fevals.md +302 -0
  12. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +302 -0
  13. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +302 -0
  14. package/.docs/organized/changelogs/%40mastra%2Floggers.md +302 -0
  15. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +302 -0
  16. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +26 -0
  17. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +302 -0
  18. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +196 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +302 -0
  20. package/.docs/organized/changelogs/%40mastra%2Fpg.md +302 -0
  21. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +302 -0
  22. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +302 -0
  23. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +302 -0
  24. package/.docs/organized/changelogs/%40mastra%2Frag.md +302 -0
  25. package/.docs/organized/changelogs/%40mastra%2Fragie.md +302 -0
  26. package/.docs/organized/changelogs/%40mastra%2Fserver.md +302 -0
  27. package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +302 -0
  28. package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +302 -0
  29. package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +302 -0
  30. package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +302 -0
  31. package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +302 -0
  32. package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +302 -0
  33. package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +302 -0
  34. package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +302 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +302 -0
  36. package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +302 -0
  37. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +302 -0
  38. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +302 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +302 -0
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +250 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +250 -0
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +302 -0
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +302 -0
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +302 -0
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +302 -0
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +302 -0
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +302 -0
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +302 -0
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +302 -0
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +302 -0
  51. package/.docs/organized/changelogs/create-mastra.md +302 -0
  52. package/.docs/organized/changelogs/mastra.md +302 -0
  53. package/.docs/organized/code-examples/agent-network.md +282 -0
  54. package/.docs/organized/code-examples/agent.md +388 -0
  55. package/.docs/organized/code-examples/ai-sdk-useChat.md +378 -0
  56. package/.docs/organized/code-examples/assistant-ui.md +37 -0
  57. package/.docs/organized/code-examples/bird-checker-with-express.md +235 -0
  58. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +360 -0
  59. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +250 -0
  60. package/.docs/organized/code-examples/client-side-tools.md +69 -0
  61. package/.docs/organized/code-examples/crypto-chatbot.md +96 -0
  62. package/.docs/organized/code-examples/fireworks-r1.md +159 -0
  63. package/.docs/organized/code-examples/mcp-registry-registry.md +63 -0
  64. package/.docs/organized/code-examples/memory-todo-agent.md +164 -0
  65. package/.docs/organized/code-examples/memory-with-context.md +167 -0
  66. package/.docs/organized/code-examples/memory-with-libsql.md +204 -0
  67. package/.docs/organized/code-examples/memory-with-mem0.md +121 -0
  68. package/.docs/organized/code-examples/memory-with-pg.md +224 -0
  69. package/.docs/organized/code-examples/memory-with-upstash.md +268 -0
  70. package/.docs/organized/code-examples/quick-start.md +129 -0
  71. package/.docs/organized/code-examples/stock-price-tool.md +124 -0
  72. package/.docs/organized/code-examples/weather-agent.md +353 -0
  73. package/.docs/organized/code-examples/workflow-ai-recruiter.md +159 -0
  74. package/.docs/organized/code-examples/workflow-with-inline-steps.md +111 -0
  75. package/.docs/organized/code-examples/workflow-with-memory.md +393 -0
  76. package/.docs/organized/code-examples/workflow-with-separate-steps.md +131 -0
  77. package/.docs/raw/agents/adding-tools.mdx +317 -0
  78. package/.docs/raw/agents/adding-voice.mdx +175 -0
  79. package/.docs/raw/agents/agent-memory.mdx +62 -0
  80. package/.docs/raw/agents/mcp-guide.mdx +215 -0
  81. package/.docs/raw/agents/overview.mdx +303 -0
  82. package/.docs/raw/community/discord.mdx +12 -0
  83. package/.docs/raw/community/licensing.mdx +63 -0
  84. package/.docs/raw/deployment/client.mdx +120 -0
  85. package/.docs/raw/deployment/deployment.mdx +127 -0
  86. package/.docs/raw/deployment/server.mdx +282 -0
  87. package/.docs/raw/evals/custom-eval.mdx +22 -0
  88. package/.docs/raw/evals/overview.mdx +95 -0
  89. package/.docs/raw/evals/running-in-ci.mdx +81 -0
  90. package/.docs/raw/evals/textual-evals.mdx +54 -0
  91. package/.docs/raw/faq/index.mdx +63 -0
  92. package/.docs/raw/frameworks/ai-sdk.mdx +296 -0
  93. package/.docs/raw/frameworks/next-js.mdx +238 -0
  94. package/.docs/raw/getting-started/installation.mdx +442 -0
  95. package/.docs/raw/getting-started/mcp-docs-server.mdx +141 -0
  96. package/.docs/raw/getting-started/project-structure.mdx +80 -0
  97. package/.docs/raw/index.mdx +22 -0
  98. package/.docs/raw/integrations/index.mdx +213 -0
  99. package/.docs/raw/local-dev/add-to-existing-project.mdx +48 -0
  100. package/.docs/raw/local-dev/creating-a-new-project.mdx +54 -0
  101. package/.docs/raw/local-dev/mastra-dev.mdx +108 -0
  102. package/.docs/raw/memory/memory-processors.mdx +131 -0
  103. package/.docs/raw/memory/overview.mdx +119 -0
  104. package/.docs/raw/memory/semantic-recall.mdx +122 -0
  105. package/.docs/raw/memory/working-memory.mdx +87 -0
  106. package/.docs/raw/observability/logging.mdx +38 -0
  107. package/.docs/raw/observability/nextjs-tracing.mdx +108 -0
  108. package/.docs/raw/observability/tracing.mdx +115 -0
  109. package/.docs/raw/rag/chunking-and-embedding.mdx +156 -0
  110. package/.docs/raw/rag/overview.mdx +85 -0
  111. package/.docs/raw/rag/retrieval.mdx +365 -0
  112. package/.docs/raw/rag/vector-databases.mdx +340 -0
  113. package/.docs/raw/reference/agents/createTool.mdx +229 -0
  114. package/.docs/raw/reference/agents/generate.mdx +334 -0
  115. package/.docs/raw/reference/agents/getAgent.mdx +54 -0
  116. package/.docs/raw/reference/agents/stream.mdx +369 -0
  117. package/.docs/raw/reference/cli/build.mdx +55 -0
  118. package/.docs/raw/reference/cli/dev.mdx +134 -0
  119. package/.docs/raw/reference/cli/init.mdx +43 -0
  120. package/.docs/raw/reference/client-js/agents.mdx +107 -0
  121. package/.docs/raw/reference/client-js/error-handling.mdx +38 -0
  122. package/.docs/raw/reference/client-js/logs.mdx +24 -0
  123. package/.docs/raw/reference/client-js/memory.mdx +97 -0
  124. package/.docs/raw/reference/client-js/telemetry.mdx +20 -0
  125. package/.docs/raw/reference/client-js/tools.mdx +44 -0
  126. package/.docs/raw/reference/client-js/vectors.mdx +79 -0
  127. package/.docs/raw/reference/client-js/workflows.mdx +136 -0
  128. package/.docs/raw/reference/core/mastra-class.mdx +232 -0
  129. package/.docs/raw/reference/deployer/cloudflare.mdx +207 -0
  130. package/.docs/raw/reference/deployer/deployer.mdx +159 -0
  131. package/.docs/raw/reference/deployer/netlify.mdx +109 -0
  132. package/.docs/raw/reference/deployer/vercel.mdx +117 -0
  133. package/.docs/raw/reference/evals/answer-relevancy.mdx +186 -0
  134. package/.docs/raw/reference/evals/bias.mdx +186 -0
  135. package/.docs/raw/reference/evals/completeness.mdx +174 -0
  136. package/.docs/raw/reference/evals/content-similarity.mdx +183 -0
  137. package/.docs/raw/reference/evals/context-position.mdx +190 -0
  138. package/.docs/raw/reference/evals/context-precision.mdx +189 -0
  139. package/.docs/raw/reference/evals/context-relevancy.mdx +188 -0
  140. package/.docs/raw/reference/evals/contextual-recall.mdx +191 -0
  141. package/.docs/raw/reference/evals/faithfulness.mdx +193 -0
  142. package/.docs/raw/reference/evals/hallucination.mdx +219 -0
  143. package/.docs/raw/reference/evals/keyword-coverage.mdx +176 -0
  144. package/.docs/raw/reference/evals/prompt-alignment.mdx +238 -0
  145. package/.docs/raw/reference/evals/summarization.mdx +205 -0
  146. package/.docs/raw/reference/evals/textual-difference.mdx +161 -0
  147. package/.docs/raw/reference/evals/tone-consistency.mdx +181 -0
  148. package/.docs/raw/reference/evals/toxicity.mdx +165 -0
  149. package/.docs/raw/reference/index.mdx +12 -0
  150. package/.docs/raw/reference/memory/Memory.mdx +212 -0
  151. package/.docs/raw/reference/memory/createThread.mdx +95 -0
  152. package/.docs/raw/reference/memory/getThreadById.mdx +46 -0
  153. package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +48 -0
  154. package/.docs/raw/reference/memory/query.mdx +167 -0
  155. package/.docs/raw/reference/networks/agent-network.mdx +159 -0
  156. package/.docs/raw/reference/observability/create-logger.mdx +106 -0
  157. package/.docs/raw/reference/observability/logger.mdx +55 -0
  158. package/.docs/raw/reference/observability/otel-config.mdx +120 -0
  159. package/.docs/raw/reference/observability/providers/braintrust.mdx +40 -0
  160. package/.docs/raw/reference/observability/providers/dash0.mdx +40 -0
  161. package/.docs/raw/reference/observability/providers/index.mdx +16 -0
  162. package/.docs/raw/reference/observability/providers/laminar.mdx +41 -0
  163. package/.docs/raw/reference/observability/providers/langfuse.mdx +51 -0
  164. package/.docs/raw/reference/observability/providers/langsmith.mdx +48 -0
  165. package/.docs/raw/reference/observability/providers/langwatch.mdx +45 -0
  166. package/.docs/raw/reference/observability/providers/new-relic.mdx +40 -0
  167. package/.docs/raw/reference/observability/providers/signoz.mdx +40 -0
  168. package/.docs/raw/reference/observability/providers/traceloop.mdx +40 -0
  169. package/.docs/raw/reference/rag/astra.mdx +258 -0
  170. package/.docs/raw/reference/rag/chroma.mdx +281 -0
  171. package/.docs/raw/reference/rag/chunk.mdx +235 -0
  172. package/.docs/raw/reference/rag/document.mdx +127 -0
  173. package/.docs/raw/reference/rag/embeddings.mdx +160 -0
  174. package/.docs/raw/reference/rag/extract-params.mdx +226 -0
  175. package/.docs/raw/reference/rag/graph-rag.mdx +182 -0
  176. package/.docs/raw/reference/rag/libsql.mdx +357 -0
  177. package/.docs/raw/reference/rag/metadata-filters.mdx +298 -0
  178. package/.docs/raw/reference/rag/pg.mdx +477 -0
  179. package/.docs/raw/reference/rag/pinecone.mdx +281 -0
  180. package/.docs/raw/reference/rag/qdrant.mdx +236 -0
  181. package/.docs/raw/reference/rag/rerank.mdx +212 -0
  182. package/.docs/raw/reference/rag/turbopuffer.mdx +249 -0
  183. package/.docs/raw/reference/rag/upstash.mdx +247 -0
  184. package/.docs/raw/reference/rag/vectorize.mdx +298 -0
  185. package/.docs/raw/reference/storage/libsql.mdx +74 -0
  186. package/.docs/raw/reference/storage/postgresql.mdx +48 -0
  187. package/.docs/raw/reference/storage/upstash.mdx +86 -0
  188. package/.docs/raw/reference/tools/client.mdx +207 -0
  189. package/.docs/raw/reference/tools/document-chunker-tool.mdx +141 -0
  190. package/.docs/raw/reference/tools/graph-rag-tool.mdx +154 -0
  191. package/.docs/raw/reference/tools/mcp-configuration.mdx +206 -0
  192. package/.docs/raw/reference/tools/vector-query-tool.mdx +212 -0
  193. package/.docs/raw/reference/voice/composite-voice.mdx +140 -0
  194. package/.docs/raw/reference/voice/deepgram.mdx +164 -0
  195. package/.docs/raw/reference/voice/elevenlabs.mdx +216 -0
  196. package/.docs/raw/reference/voice/google.mdx +198 -0
  197. package/.docs/raw/reference/voice/mastra-voice.mdx +394 -0
  198. package/.docs/raw/reference/voice/murf.mdx +251 -0
  199. package/.docs/raw/reference/voice/openai-realtime.mdx +431 -0
  200. package/.docs/raw/reference/voice/openai.mdx +168 -0
  201. package/.docs/raw/reference/voice/playai.mdx +159 -0
  202. package/.docs/raw/reference/voice/sarvam.mdx +260 -0
  203. package/.docs/raw/reference/voice/speechify.mdx +145 -0
  204. package/.docs/raw/reference/voice/voice.answer.mdx +122 -0
  205. package/.docs/raw/reference/voice/voice.connect.mdx +124 -0
  206. package/.docs/raw/reference/voice/voice.listen.mdx +195 -0
  207. package/.docs/raw/reference/voice/voice.on.mdx +189 -0
  208. package/.docs/raw/reference/voice/voice.send.mdx +118 -0
  209. package/.docs/raw/reference/voice/voice.speak.mdx +203 -0
  210. package/.docs/raw/reference/workflows/after.mdx +88 -0
  211. package/.docs/raw/reference/workflows/afterEvent.mdx +76 -0
  212. package/.docs/raw/reference/workflows/commit.mdx +37 -0
  213. package/.docs/raw/reference/workflows/createRun.mdx +77 -0
  214. package/.docs/raw/reference/workflows/else.mdx +72 -0
  215. package/.docs/raw/reference/workflows/events.mdx +305 -0
  216. package/.docs/raw/reference/workflows/execute.mdx +110 -0
  217. package/.docs/raw/reference/workflows/if.mdx +107 -0
  218. package/.docs/raw/reference/workflows/resume.mdx +155 -0
  219. package/.docs/raw/reference/workflows/resumeWithEvent.mdx +133 -0
  220. package/.docs/raw/reference/workflows/snapshots.mdx +207 -0
  221. package/.docs/raw/reference/workflows/start.mdx +84 -0
  222. package/.docs/raw/reference/workflows/step-class.mdx +100 -0
  223. package/.docs/raw/reference/workflows/step-condition.mdx +134 -0
  224. package/.docs/raw/reference/workflows/step-function.mdx +92 -0
  225. package/.docs/raw/reference/workflows/step-options.mdx +69 -0
  226. package/.docs/raw/reference/workflows/step-retries.mdx +203 -0
  227. package/.docs/raw/reference/workflows/suspend.mdx +70 -0
  228. package/.docs/raw/reference/workflows/then.mdx +74 -0
  229. package/.docs/raw/reference/workflows/until.mdx +165 -0
  230. package/.docs/raw/reference/workflows/watch.mdx +118 -0
  231. package/.docs/raw/reference/workflows/while.mdx +168 -0
  232. package/.docs/raw/reference/workflows/workflow.mdx +233 -0
  233. package/.docs/raw/storage/overview.mdx +378 -0
  234. package/.docs/raw/voice/overview.mdx +135 -0
  235. package/.docs/raw/voice/speech-to-text.mdx +45 -0
  236. package/.docs/raw/voice/text-to-speech.mdx +52 -0
  237. package/.docs/raw/voice/voice-to-voice.mdx +310 -0
  238. package/.docs/raw/workflows/control-flow.mdx +778 -0
  239. package/.docs/raw/workflows/dynamic-workflows.mdx +236 -0
  240. package/.docs/raw/workflows/error-handling.mdx +183 -0
  241. package/.docs/raw/workflows/nested-workflows.mdx +352 -0
  242. package/.docs/raw/workflows/overview.mdx +203 -0
  243. package/.docs/raw/workflows/steps.mdx +108 -0
  244. package/.docs/raw/workflows/suspend-and-resume.mdx +404 -0
  245. package/.docs/raw/workflows/variables.mdx +313 -0
  246. package/LICENSE.md +46 -0
  247. package/README.md +129 -0
  248. package/dist/_tsup-dts-rollup.d.ts +149 -0
  249. package/dist/chunk-QWYMT5LP.js +194 -0
  250. package/dist/prepare-docs/prepare.d.ts +1 -0
  251. package/dist/prepare-docs/prepare.js +1 -0
  252. package/dist/stdio.d.ts +1 -0
  253. package/dist/stdio.js +518 -0
  254. package/package.json +60 -0
@@ -0,0 +1,141 @@
1
+ ---
2
+ title: "Using with Cursor/Windsurf | Getting Started | Mastra Docs"
3
+ description: "Learn how to use the Mastra MCP documentation server in your IDE to turn it into an agentic Mastra expert."
4
+ ---
5
+
6
+ import YouTube from "../../../components/youtube";
7
+
8
+ # Mastra Tools for your agentic IDE
9
+
10
+ `@mastra/mcp-docs-server` provides direct access to Mastra's complete knowledge base in Cursor, Windsurf, Cline, or any other IDE that supports MCP.
11
+
12
+ It has access to documentation, code examples, technical blog posts / feature announcements, and package changelogs which your IDE can read to help you build with Mastra.
13
+
14
+ <YouTube id="vciV57lF0og" />
15
+
16
+ The MCP server tools have been designed to allow an agent to query the specific information it needs to complete a Mastra related task - for example: adding a Mastra feature to an agent, scaffolding a new project, or helping you understand how something works.
17
+
18
+ ## How it works
19
+
20
+ Once it's installed in your IDE you can write prompts and assume the agent will understand everything about Mastra.
21
+
22
+ ### Add features
23
+
24
+ - "Add evals to my agent and write tests"
25
+ - "Write me a workflow that does the following `[task]`"
26
+ - "Make a new tool that allows my agent to access `[3rd party API]`"
27
+
28
+ ### Ask about integrations
29
+
30
+ - "Does Mastra work with the AI SDK?
31
+ How can I use it in my `[React/Svelte/etc]` project?"
32
+ - "What's the latest Mastra news around MCP?"
33
+ - "Does Mastra support `[provider]` speech and voice APIs? Show me an example in my code of how I can use it."
34
+
35
+ ### Debug or update existing code
36
+
37
+ - "I'm running into a bug with agent memory, have there been any related changes or bug fixes recently?"
38
+ - "How does working memory behave in Mastra and how can I use it to do `[task]`? It doesn't seem to work the way I expect."
39
+ - "I saw there are new workflow features, explain them to me and then update `[workflow]` to use them."
40
+
41
+ **And more** - if you have a question, try asking your IDE and let it look it up for you.
42
+
43
+ ## Automatic Installation
44
+
45
+ Run `pnpm create mastra@latest` and select Cursor or Windsurf when prompted to install the MCP server. For other IDEs, or if you already have a Mastra project, install the MCP server by following the instructions below.
46
+
47
+ ## Manual Installation
48
+
49
+ - **Cursor**: Edit `.cursor/mcp.json` in your project root, or `~/.cursor/mcp.json` for global configuration
50
+ - **Windsurf**: Edit `~/.codeium/windsurf/mcp_config.json` (only supports global configuration)
51
+
52
+ Add the following configuration:
53
+
54
+ ### MacOS/Linux
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "mastra": {
60
+ "command": "npx",
61
+ "args": ["-y", "@mastra/mcp-docs-server@latest"]
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### Windows
68
+
69
+ ```json
70
+ {
71
+ "mcpServers": {
72
+ "mastra": {
73
+ "command": "cmd",
74
+ "args": ["/c", "npx", "-y", "@mastra/mcp-docs-server@latest"]
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## After Configuration
81
+
82
+ ### Cursor
83
+
84
+ 1. Open Cursor settings
85
+ 2. Navigate to MCP settings
86
+ 3. Click "enable" on the Mastra MCP server
87
+ 4. If you have an agent chat open, you'll need to re-open it or start a new chat to use the MCP server
88
+
89
+ ### Windsurf
90
+
91
+ 1. Fully quit and re-open Windsurf
92
+ 2. If tool calls start failing, go to Windsurfs MCP settings and re-start the MCP server. This is a common Windsurf MCP issue and isn't related to Mastra. Right now Cursor's MCP implementation is more stable than Windsurfs is.
93
+
94
+ In both IDEs it may take a minute for the MCP server to start the first time as it needs to download the package from npm.
95
+
96
+ ## Available Agent Tools
97
+
98
+ ### Documentation
99
+
100
+ Access Mastra's complete documentation:
101
+
102
+ - Getting started / installation
103
+ - Guides and tutorials
104
+ - API references
105
+
106
+ ### Examples
107
+
108
+ Browse code examples:
109
+
110
+ - Complete project structures
111
+ - Implementation patterns
112
+ - Best practices
113
+
114
+ ### Blog Posts
115
+
116
+ Search the blog for:
117
+
118
+ - Technical posts
119
+ - Changelog and feature announcements
120
+ - AI news and updates
121
+
122
+ ### Package Changes
123
+
124
+ Track updates for Mastra and `@mastra/*` packages:
125
+
126
+ - Bug fixes
127
+ - New features
128
+ - Breaking changes
129
+
130
+ ## Common Issues
131
+
132
+ 1. **Server Not Starting**
133
+
134
+ - Ensure npx is installed and working
135
+ - Check for conflicting MCP servers
136
+ - Verify your configuration file syntax
137
+ - On Windows, make sure to use the Windows-specific configuration
138
+
139
+ 2. **Tool Calls Failing**
140
+ - Restart the MCP server and/or your IDE
141
+ - Update to the latest version of your IDE
@@ -0,0 +1,80 @@
1
+ ---
2
+ title: "Local Project Structure | Getting Started | Mastra Docs"
3
+ description: Guide on organizing folders and files in Mastra, including best practices and recommended structures.
4
+ ---
5
+
6
+ import { FileTree } from 'nextra/components';
7
+
8
+ # Project Structure
9
+
10
+ This page provides a guide for organizing folders and files in Mastra. Mastra is a modular framework, and you can use any of the modules separately or together.
11
+
12
+ You could write everything in a single file (as we showed in the quick start), or separate each agent, tool, and workflow into their own files.
13
+
14
+ We don't enforce a specific folder structure, but we do recommend some best practices, and the CLI will scaffold a project with a sensible structure.
15
+
16
+ ## Using the CLI
17
+
18
+ `mastra init` is an interactive CLI that allows you to:
19
+
20
+ - **Choose a directory for Mastra files**: Specify where you want the Mastra files to be placed (default is `src/mastra`).
21
+ - **Select components to install**: Choose which components you want to include in your project:
22
+ - Agents
23
+ - Tools
24
+ - Workflows
25
+ - **Select a default LLM provider**: Choose from supported providers like OpenAI, Anthropic, or Groq.
26
+ - **Include example code**: Decide whether to include example code to help you get started.
27
+
28
+ ### Example Project Structure
29
+
30
+ Assuming you select all components and include example code, your project structure will look like this:
31
+
32
+ <FileTree>
33
+ <FileTree.Folder name="root" defaultOpen>
34
+ <FileTree.Folder name="src" defaultOpen>
35
+ <FileTree.Folder name="mastra" defaultOpen>
36
+ <FileTree.Folder name="agents" defaultOpen>
37
+ <FileTree.File name="index.ts" />
38
+ </FileTree.Folder>
39
+ <FileTree.Folder name="tools" defaultOpen>
40
+ <FileTree.File name="index.ts" />
41
+ </FileTree.Folder>
42
+ <FileTree.Folder name="workflows" defaultOpen>
43
+ <FileTree.File name="index.ts" />
44
+ </FileTree.Folder>
45
+ <FileTree.File name="index.ts" />
46
+ </FileTree.Folder>
47
+ </FileTree.Folder>
48
+ <FileTree.File name=".env" />
49
+ </FileTree.Folder>
50
+ </FileTree>
51
+ {/*
52
+ ```
53
+ root/
54
+ ├── src/
55
+ │ └── mastra/
56
+ │ ├── agents/
57
+ │ │ └── index.ts
58
+ │ ├── tools/
59
+ │ │ └── index.ts
60
+ │ ├── workflows/
61
+ │ │ └── index.ts
62
+ │ ├── index.ts
63
+ ├── .env
64
+ ``` */}
65
+
66
+ ### Top-level Folders
67
+
68
+ | Folder | Description |
69
+ | ---------------------- | ------------------------------------ |
70
+ | `src/mastra` | Core application folder |
71
+ | `src/mastra/agents` | Agent configurations and definitions |
72
+ | `src/mastra/tools` | Custom tool definitions |
73
+ | `src/mastra/workflows` | Workflow definitions |
74
+
75
+ ### Top-level Files
76
+
77
+ | File | Description |
78
+ | --------------------- | ---------------------------------- |
79
+ | `src/mastra/index.ts` | Main configuration file for Mastra |
80
+ | `.env` | Environment variables |
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: "Introduction | Mastra Docs"
3
+ description: "Mastra is a TypeScript agent framework. It helps you build AI applications and features quickly. It gives you the set of primitives you need: workflows, agents, RAG, integrations, syncs and evals."
4
+ ---
5
+
6
+ # About Mastra
7
+
8
+ Mastra is an open-source TypeScript agent framework.
9
+
10
+ It's designed to give you the primitives you need to build AI applications and features.
11
+
12
+ You can use Mastra to build [AI agents](/docs/agents/overview.mdx) that have memory and can execute functions, or chain LLM calls in deterministic [workflows](/docs/workflows/overview.mdx). You can chat with your agents in Mastra's [local dev environment](/docs/local-dev/mastra-dev.mdx), feed them application-specific knowledge with [RAG](/docs/rag/overview.mdx), and score their outputs with Mastra's [evals](/docs/evals/overview.mdx).
13
+
14
+ The main features include:
15
+
16
+ * **[Model routing](https://sdk.vercel.ai/docs/introduction)**: Mastra uses the [Vercel AI SDK](https://sdk.vercel.ai/docs/introduction) for model routing, providing a unified interface to interact with any LLM provider including OpenAI, Anthropic, and Google Gemini.
17
+ * **[Agent memory and tool calling](/docs/agents/agent-memory.mdx)**: With Mastra, you can give your agent tools (functions) that it can call. You can persist agent memory and retrieve it based on recency, semantic similarity, or conversation thread.
18
+ * **[Workflow graphs](/docs/workflows/overview.mdx)**: When you want to execute LLM calls in a deterministic way, Mastra gives you a graph-based workflow engine. You can define discrete steps, log inputs and outputs at each step of each run, and pipe them into an observability tool. Mastra workflows have a simple syntax for control flow (`step()`, `.then()`, `.after()`) that allows branching and chaining.
19
+ * **[Agent development environment](/docs/local-dev/mastra-dev.mdx)**: When you're developing an agent locally, you can chat with it and see its state and memory in Mastra's agent development environment.
20
+ * **[Retrieval-augmented generation (RAG)](/docs/rag/overview.mdx)**: Mastra gives you APIs to process documents (text, HTML, Markdown, JSON) into chunks, create embeddings, and store them in a vector database. At query time, it retrieves relevant chunks to ground LLM responses in your data, with a unified API on top of multiple vector stores (Pinecone, pgvector, etc) and embedding providers (OpenAI, Cohere, etc).
21
+ * **[Deployment](/docs/deployment/deployment.mdx)**: Mastra supports bundling your agents and workflows within an existing React, Next.js, or Node.js application, or into standalone endpoints. The Mastra deploy helper lets you easily bundle agents and workflows into a Node.js server using Hono, or deploy it onto a serverless platform like Vercel, Cloudflare Workers, or Netlify.
22
+ * **[Evals](/docs/evals/overview.mdx)**: Mastra provides automated evaluation metrics that use model-graded, rule-based, and statistical methods to assess LLM outputs, with built-in metrics for toxicity, bias, relevance, and factual accuracy. You can also define your own evals.
@@ -0,0 +1,213 @@
1
+ ---
2
+ title: "Using Mastra Integrations | Mastra Local Development Docs"
3
+ description: Documentation for Mastra integrations, which are auto-generated, type-safe API clients for third-party services.
4
+ ---
5
+
6
+ # Using Mastra Integrations
7
+
8
+ Integrations in Mastra are auto-generated, type-safe API clients for third-party services. They can be used as tools for agents or as steps in workflows.
9
+
10
+ ## Installing an Integration
11
+
12
+ Mastra's default integrations are packaged as individually installable npm modules. You can add an integration to your project by installing it via npm and importing it into your Mastra configuration.
13
+
14
+ ### Example: Adding the GitHub Integration
15
+
16
+ 1. **Install the Integration Package**
17
+
18
+ To install the GitHub integration, run:
19
+
20
+ ```bash
21
+ npm install @mastra/github
22
+ ```
23
+
24
+ 2. **Add the Integration to Your Project**
25
+
26
+ Create a new file for your integrations (e.g., `src/mastra/integrations/index.ts`) and import the integration:
27
+
28
+ ```typescript filename="src/mastra/integrations/index.ts" showLineNumbers copy
29
+ import { GithubIntegration } from "@mastra/github";
30
+
31
+ export const github = new GithubIntegration({
32
+ config: {
33
+ PERSONAL_ACCESS_TOKEN: process.env.GITHUB_PAT!,
34
+ },
35
+ });
36
+ ```
37
+
38
+ Make sure to replace `process.env.GITHUB_PAT!` with your actual GitHub Personal Access Token or ensure that the environment variable is properly set.
39
+
40
+ 3. **Use the Integration in Tools or Workflows**
41
+
42
+ You can now use the integration when defining tools for your agents or in workflows.
43
+
44
+ ```typescript filename="src/mastra/tools/index.ts" showLineNumbers copy
45
+ import { createTool } from "@mastra/core";
46
+ import { z } from "zod";
47
+ import { github } from "../integrations";
48
+
49
+ export const getMainBranchRef = createTool({
50
+ id: "getMainBranchRef",
51
+ description: "Fetch the main branch reference from a GitHub repository",
52
+ inputSchema: z.object({
53
+ owner: z.string(),
54
+ repo: z.string(),
55
+ }),
56
+ outputSchema: z.object({
57
+ ref: z.string().optional(),
58
+ }),
59
+ execute: async ({ context }) => {
60
+ const client = await github.getApiClient();
61
+
62
+ const mainRef = await client.gitGetRef({
63
+ path: {
64
+ owner: context.owner,
65
+ repo: context.repo,
66
+ ref: "heads/main",
67
+ },
68
+ });
69
+
70
+ return { ref: mainRef.data?.ref };
71
+ },
72
+ });
73
+ ```
74
+
75
+ In the example above:
76
+
77
+ - We import the `github` integration.
78
+ - We define a tool called `getMainBranchRef` that uses the GitHub API client to fetch the reference of the main branch of a repository.
79
+ - The tool accepts `owner` and `repo` as inputs and returns the reference string.
80
+
81
+ ## Using Integrations in Agents
82
+
83
+ Once you've defined tools that utilize integrations, you can include these tools in your agents.
84
+
85
+ ```typescript filename="src/mastra/agents/index.ts" showLineNumbers copy
86
+ import { openai } from "@ai-sdk/openai";
87
+ import { Agent } from "@mastra/core/agent";
88
+ import { getMainBranchRef } from "../tools";
89
+
90
+ export const codeReviewAgent = new Agent({
91
+ name: "Code Review Agent",
92
+ instructions:
93
+ "An agent that reviews code repositories and provides feedback.",
94
+ model: openai("gpt-4o-mini"),
95
+ tools: {
96
+ getMainBranchRef,
97
+ // other tools...
98
+ },
99
+ });
100
+ ```
101
+
102
+ In this setup:
103
+
104
+ - We create an agent named `Code Review Agent`.
105
+ - We include the `getMainBranchRef` tool in the agent's available tools.
106
+ - The agent can now use this tool to interact with GitHub repositories during conversations.
107
+
108
+ ## Environment Configuration
109
+
110
+ Ensure that any required API keys or tokens for your integrations are properly set in your environment variables. For example, with the GitHub integration, you need to set your GitHub Personal Access Token:
111
+
112
+ ```bash
113
+ GITHUB_PAT=your_personal_access_token
114
+ ```
115
+
116
+ Consider using a `.env` file or another secure method to manage sensitive credentials.
117
+
118
+ ### Example: Adding the Mem0 Integration
119
+
120
+ In this example you'll learn how to use the [Mem0](https://mem0.ai) platform to add long-term memory capabilities to an agent via tool-use.
121
+ This memory integration can work alongside Mastra's own [agent memory features](https://mastra.ai/docs/agents/agent-memory).
122
+ Mem0 enables your agent to memorize and later remember facts per-user across all interactions with that user, while Mastra's memory works per-thread. Using the two in conjunction will allow Mem0 to store long term memories across conversations/interactions, while Mastra's memory will maintain linear conversation history in individual conversations.
123
+
124
+ 1. **Install the Integration Package**
125
+
126
+ To install the Mem0 integration, run:
127
+
128
+ ```bash
129
+ npm install @mastra/mem0
130
+ ```
131
+
132
+ 2. **Add the Integration to Your Project**
133
+
134
+ Create a new file for your integrations (e.g., `src/mastra/integrations/index.ts`) and import the integration:
135
+
136
+ ```typescript filename="src/mastra/integrations/index.ts" showLineNumbers copy
137
+ import { Mem0Integration } from "@mastra/mem0";
138
+
139
+ export const mem0 = new Mem0Integration({
140
+ config: {
141
+ apiKey: process.env.MEM0_API_KEY!,
142
+ userId: "alice",
143
+ },
144
+ });
145
+ ```
146
+
147
+ 3. **Use the Integration in Tools or Workflows**
148
+
149
+ You can now use the integration when defining tools for your agents or in workflows.
150
+
151
+ ```typescript filename="src/mastra/tools/index.ts" showLineNumbers copy
152
+ import { createTool } from "@mastra/core";
153
+ import { z } from "zod";
154
+ import { mem0 } from "../integrations";
155
+
156
+ export const mem0RememberTool = createTool({
157
+ id: "Mem0-remember",
158
+ description:
159
+ "Remember your agent memories that you've previously saved using the Mem0-memorize tool.",
160
+ inputSchema: z.object({
161
+ question: z
162
+ .string()
163
+ .describe("Question used to look up the answer in saved memories."),
164
+ }),
165
+ outputSchema: z.object({
166
+ answer: z.string().describe("Remembered answer"),
167
+ }),
168
+ execute: async ({ context }) => {
169
+ console.log(`Searching memory "${context.question}"`);
170
+ const memory = await mem0.searchMemory(context.question);
171
+ console.log(`\nFound memory "${memory}"\n`);
172
+
173
+ return {
174
+ answer: memory,
175
+ };
176
+ },
177
+ });
178
+
179
+ export const mem0MemorizeTool = createTool({
180
+ id: "Mem0-memorize",
181
+ description:
182
+ "Save information to mem0 so you can remember it later using the Mem0-remember tool.",
183
+ inputSchema: z.object({
184
+ statement: z.string().describe("A statement to save into memory"),
185
+ }),
186
+ execute: async ({ context }) => {
187
+ console.log(`\nCreating memory "${context.statement}"\n`);
188
+ // to reduce latency memories can be saved async without blocking tool execution
189
+ void mem0.createMemory(context.statement).then(() => {
190
+ console.log(`\nMemory "${context.statement}" saved.\n`);
191
+ });
192
+ return { success: true };
193
+ },
194
+ });
195
+ ```
196
+
197
+ In the example above:
198
+
199
+ - We import the `@mastra/mem0` integration.
200
+ - We define two tools that uses the Mem0 API client to create new memories and recall previously saved memories.
201
+ - The tool accepts `question` as an input and returns the memory as a string.
202
+
203
+ ## Available Integrations
204
+
205
+ Mastra provides several built-in integrations; primarily API-key based integrations that do not require OAuth. Some available integrations including Github, Stripe, Resend, Firecrawl, and more.
206
+
207
+ Check [Mastra's codebase](https://github.com/mastra-ai/mastra/tree/main/integrations) or [npm packages](https://www.npmjs.com/search?q=%22%40mastra%22) for a full list of available integrations.
208
+
209
+ ## Conclusion
210
+
211
+ Integrations in Mastra enable your AI agents and workflows to interact with external services seamlessly. By installing and configuring integrations, you can extend the capabilities of your application to include operations such as fetching data from APIs, sending messages, or managing resources in third-party systems.
212
+
213
+ Remember to consult the documentation of each integration for specific usage details and to adhere to best practices for security and type safety.
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: "Adding to an Existing Project | Mastra Local Development Docs"
3
+ description: "Add Mastra to your existing Node.js applications"
4
+ ---
5
+
6
+ # Adding to an Existing Project
7
+
8
+ You can add Mastra to an existing project using the CLI:
9
+
10
+ ```bash npm2yarn copy
11
+ npm install -g mastra@latest
12
+ mastra init
13
+ ```
14
+
15
+ Changes made to project:
16
+ 1. Creates `src/mastra` directory with entry point
17
+ 2. Adds required dependencies
18
+ 3. Configures TypeScript compiler options
19
+
20
+
21
+ ## Interactive Setup
22
+
23
+ Running commands without arguments starts a CLI prompt for:
24
+
25
+ 1. Component selection
26
+ 2. LLM provider configuration
27
+ 3. API key setup
28
+ 4. Example code inclusion
29
+
30
+ ## Non-Interactive Setup
31
+
32
+ To initialize mastra in non-interactive mode use the following command arguments:
33
+
34
+ ```bash
35
+ Arguments:
36
+ --components Specify components: agents, tools, workflows
37
+ --llm-provider LLM provider: openai, anthropic, or groq
38
+ --add-example Include example implementation
39
+ --llm-api-key Provider API key
40
+ --dir Directory for Mastra files (defaults to src/)
41
+ ```
42
+ For more details, refer to the [mastra init CLI documentation](../../reference/cli/init).
43
+
44
+
45
+
46
+
47
+
48
+
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: "Creating a new Project | Mastra Local Development Docs"
3
+ description: "Create new Mastra projects or add Mastra to existing Node.js applications using the CLI"
4
+ ---
5
+
6
+ # Creating a new project
7
+
8
+ You can create a new project using the `create-mastra` package:
9
+
10
+ ```bash npm2yarn copy
11
+ npm create mastra@latest
12
+ ```
13
+
14
+ You can also create a new project by using the `mastra` CLI directly:
15
+
16
+ ```bash npm2yarn copy
17
+ npm install -g mastra@latest
18
+ mastra create
19
+ ```
20
+
21
+ ## Interactive Setup
22
+
23
+ Running commands without arguments starts a CLI prompt for:
24
+
25
+ 1. Project name
26
+ 1. Component selection
27
+ 2. LLM provider configuration
28
+ 3. API key setup
29
+ 4. Example code inclusion
30
+
31
+ ## Non-Interactive Setup
32
+
33
+ To initialize mastra in non-interactive mode use the following command arguments:
34
+
35
+ ```bash
36
+ Arguments:
37
+ --components Specify components: agents, tools, workflows
38
+ --llm-provider LLM provider: openai, anthropic, groq, google, or cerebras
39
+ --add-example Include example implementation
40
+ --llm-api-key Provider API key
41
+ --project-name Project name that will be used in package.json and as the project directory name
42
+ ```
43
+
44
+
45
+
46
+ Generated project structure:
47
+ ```
48
+ my-project/
49
+ ├── src/
50
+ │ └── mastra/
51
+ │ └── index.ts # Mastra entry point
52
+ ├── package.json
53
+ └── tsconfig.json
54
+ ```
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: "Inspecting Agents with `mastra dev` | Mastra Local Dev Docs"
3
+ description: Documentation for the Mastra local development environment for Mastra applications.
4
+ ---
5
+ import YouTube from "../../../components/youtube";
6
+
7
+ # Local Development Environment
8
+
9
+ Mastra provides a local development environment where you can test your agents, workflows, and tools while developing locally.
10
+
11
+ <YouTube id="spGlcTEjuXY" />
12
+
13
+ ## Launch Development Server
14
+
15
+ You can launch the Mastra development environment using the Mastra CLI by running:
16
+
17
+ ```bash
18
+ mastra dev
19
+ ```
20
+
21
+ By default, the server runs at http://localhost:4111, but you can change the port with the `--port` flag.
22
+
23
+ ## Dev Playground
24
+
25
+ `mastra dev` serves a playground UI for interacting with your agents, workflows, and tools. The playground provides dedicated interfaces for testing each component of your Mastra application during development.
26
+
27
+ ### Agent Playground
28
+
29
+ The Agent playground provides an interactive chat interface where you can test and debug your agents during development. Key features include:
30
+
31
+ - **Chat Interface**: Directly interact with your agents to test their responses and behavior.
32
+ - **Prompt CMS**: Experiment with different system instructions for your agent:
33
+ - A/B test different prompt versions.
34
+ - Track performance metrics for each variant.
35
+ - Select and deploy the most effective prompt version.
36
+ - **Agent Traces**: View detailed execution traces to understand how your agent processes requests, including:
37
+ - Prompt construction.
38
+ - Tool usage.
39
+ - Decision-making steps.
40
+ - Response generation.
41
+ - **Agent Evals**: When you've set up [Agent evaluation metrics](/docs/evals/overview), you can:
42
+ - Run evaluations directly from the playground.
43
+ - View evaluation results and metrics.
44
+ - Compare agent performance across different test cases.
45
+
46
+ ### Workflow Playground
47
+
48
+ The Workflow playground helps you visualize and test your workflow implementations:
49
+
50
+ - **Workflow Visualization**: Workflow graph visualization.
51
+
52
+ - **Run Workflows**:
53
+ - Trigger test workflow runs with custom input data.
54
+ - Debug workflow logic and conditions.
55
+ - Simulate different execution paths.
56
+ - View detailed execution logs for each step.
57
+
58
+ - **Workflow Traces**: Examine detailed execution traces that show:
59
+ - Step-by-step workflow progression.
60
+ - State transitions and data flow.
61
+ - Tool invocations and their results.
62
+ - Decision points and branching logic.
63
+ - Error handling and recovery paths.
64
+
65
+ ### Tools Playground
66
+
67
+ The Tools playground allows you to test your custom tools in isolation:
68
+
69
+ - Test individual tools without running a full agent or workflow.
70
+ - Input test data and view tool responses.
71
+ - Debug tool implementation and error handling.
72
+ - Verify tool input/output schemas.
73
+ - Monitor tool performance and execution time.
74
+
75
+ ## REST API Endpoints
76
+
77
+ `mastra dev` also spins up REST API routes for your agents and workflows via the local [Mastra Server](/docs/deployment/server). This allows you to test your API endpoints before deployment. See [Mastra Dev reference](/reference/cli/dev#routes) for more details about all endpoints.
78
+
79
+ You can then leverage the [Mastra Client](/docs/deployment/client) SDK to interact with your served REST API routes seamlessly.
80
+
81
+ ## OpenAPI Specification
82
+
83
+ `mastra dev` provides an OpenAPI spec at http://localhost:4111/openapi.json
84
+
85
+ ## Local Dev Architecture
86
+
87
+ The local development server is designed to run without any external dependencies or containerization. This is achieved through:
88
+
89
+ - **Dev Server**: Uses [Hono](https://hono.dev) as the underlying framework to power the [Mastra Server](/docs/deployment/server).
90
+
91
+ - **In-Memory Storage**: Uses [LibSQL](https://libsql.org/) memory adapters for:
92
+ - Agent memory management.
93
+ - Trace storage.
94
+ - Evals storage.
95
+ - Workflow snapshots.
96
+
97
+ - **Vector Storage**: Uses [FastEmbed](https://github.com/qdrant/fastembed) for:
98
+ - Default embedding generation.
99
+ - Vector storage and retrieval.
100
+ - Semantic search capabilities.
101
+
102
+ This architecture allows you to start developing immediately without setting up databases or vector stores, while still maintaining production-like behavior in your local environment.
103
+
104
+ ## Summary
105
+
106
+ `mastra dev` makes it easy to develop, debug, and iterate on your AI logic in a self-contained environment before deploying to production.
107
+
108
+ - [Mastra Dev reference](../../reference/cli/dev.mdx)