@mastra/mcp-docs-server 0.0.0-default-storage-virtual-file-20250410035748

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 (252) 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 +131 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +302 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +80 -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.md +302 -0
  17. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +166 -0
  18. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +302 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fpg.md +302 -0
  20. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +302 -0
  21. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +302 -0
  22. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +302 -0
  23. package/.docs/organized/changelogs/%40mastra%2Frag.md +302 -0
  24. package/.docs/organized/changelogs/%40mastra%2Fragie.md +302 -0
  25. package/.docs/organized/changelogs/%40mastra%2Fserver.md +302 -0
  26. package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +302 -0
  27. package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +302 -0
  28. package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +302 -0
  29. package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +302 -0
  30. package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +302 -0
  31. package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +302 -0
  32. package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +302 -0
  33. package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +302 -0
  34. package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +302 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +302 -0
  36. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +302 -0
  37. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +302 -0
  38. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +302 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +220 -0
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +220 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +302 -0
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +302 -0
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +302 -0
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +302 -0
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +302 -0
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +302 -0
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +302 -0
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +299 -0
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +302 -0
  50. package/.docs/organized/changelogs/create-mastra.md +302 -0
  51. package/.docs/organized/changelogs/mastra.md +302 -0
  52. package/.docs/organized/code-examples/agent-network.md +282 -0
  53. package/.docs/organized/code-examples/agent.md +390 -0
  54. package/.docs/organized/code-examples/ai-sdk-useChat.md +378 -0
  55. package/.docs/organized/code-examples/assistant-ui.md +37 -0
  56. package/.docs/organized/code-examples/bird-checker-with-express.md +235 -0
  57. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +360 -0
  58. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +250 -0
  59. package/.docs/organized/code-examples/crypto-chatbot.md +96 -0
  60. package/.docs/organized/code-examples/fireworks-r1.md +159 -0
  61. package/.docs/organized/code-examples/memory-todo-agent.md +164 -0
  62. package/.docs/organized/code-examples/memory-with-context.md +167 -0
  63. package/.docs/organized/code-examples/memory-with-libsql.md +204 -0
  64. package/.docs/organized/code-examples/memory-with-mem0.md +121 -0
  65. package/.docs/organized/code-examples/memory-with-pg.md +224 -0
  66. package/.docs/organized/code-examples/memory-with-upstash.md +268 -0
  67. package/.docs/organized/code-examples/quick-start.md +129 -0
  68. package/.docs/organized/code-examples/stock-price-tool.md +124 -0
  69. package/.docs/organized/code-examples/weather-agent.md +353 -0
  70. package/.docs/organized/code-examples/workflow-ai-recruiter.md +159 -0
  71. package/.docs/organized/code-examples/workflow-with-inline-steps.md +111 -0
  72. package/.docs/organized/code-examples/workflow-with-memory.md +393 -0
  73. package/.docs/organized/code-examples/workflow-with-separate-steps.md +131 -0
  74. package/.docs/raw/agents/adding-tools.mdx +239 -0
  75. package/.docs/raw/agents/adding-voice.mdx +175 -0
  76. package/.docs/raw/agents/agent-memory.mdx +62 -0
  77. package/.docs/raw/agents/mcp-guide.mdx +192 -0
  78. package/.docs/raw/agents/overview.mdx +303 -0
  79. package/.docs/raw/community/discord.mdx +12 -0
  80. package/.docs/raw/community/licensing.mdx +63 -0
  81. package/.docs/raw/deployment/client.mdx +120 -0
  82. package/.docs/raw/deployment/deployment.mdx +119 -0
  83. package/.docs/raw/deployment/server.mdx +276 -0
  84. package/.docs/raw/evals/custom-eval.mdx +22 -0
  85. package/.docs/raw/evals/overview.mdx +95 -0
  86. package/.docs/raw/evals/running-in-ci.mdx +81 -0
  87. package/.docs/raw/evals/textual-evals.mdx +54 -0
  88. package/.docs/raw/faq/index.mdx +63 -0
  89. package/.docs/raw/frameworks/ai-sdk.mdx +296 -0
  90. package/.docs/raw/frameworks/next-js.mdx +238 -0
  91. package/.docs/raw/getting-started/installation.mdx +436 -0
  92. package/.docs/raw/getting-started/mcp-docs-server.mdx +141 -0
  93. package/.docs/raw/getting-started/project-structure.mdx +80 -0
  94. package/.docs/raw/index.mdx +22 -0
  95. package/.docs/raw/integrations/index.mdx +213 -0
  96. package/.docs/raw/local-dev/add-to-existing-project.mdx +48 -0
  97. package/.docs/raw/local-dev/creating-a-new-project.mdx +54 -0
  98. package/.docs/raw/local-dev/mastra-dev.mdx +108 -0
  99. package/.docs/raw/memory/memory-processors.mdx +131 -0
  100. package/.docs/raw/memory/overview.mdx +119 -0
  101. package/.docs/raw/memory/semantic-recall.mdx +122 -0
  102. package/.docs/raw/memory/working-memory.mdx +87 -0
  103. package/.docs/raw/observability/logging.mdx +38 -0
  104. package/.docs/raw/observability/nextjs-tracing.mdx +108 -0
  105. package/.docs/raw/observability/tracing.mdx +115 -0
  106. package/.docs/raw/rag/chunking-and-embedding.mdx +156 -0
  107. package/.docs/raw/rag/overview.mdx +85 -0
  108. package/.docs/raw/rag/retrieval.mdx +365 -0
  109. package/.docs/raw/rag/vector-databases.mdx +340 -0
  110. package/.docs/raw/reference/agents/createTool.mdx +229 -0
  111. package/.docs/raw/reference/agents/generate.mdx +327 -0
  112. package/.docs/raw/reference/agents/getAgent.mdx +54 -0
  113. package/.docs/raw/reference/agents/stream.mdx +362 -0
  114. package/.docs/raw/reference/cli/build.mdx +48 -0
  115. package/.docs/raw/reference/cli/deploy.mdx +22 -0
  116. package/.docs/raw/reference/cli/dev.mdx +134 -0
  117. package/.docs/raw/reference/cli/init.mdx +43 -0
  118. package/.docs/raw/reference/client-js/agents.mdx +107 -0
  119. package/.docs/raw/reference/client-js/error-handling.mdx +38 -0
  120. package/.docs/raw/reference/client-js/logs.mdx +24 -0
  121. package/.docs/raw/reference/client-js/memory.mdx +97 -0
  122. package/.docs/raw/reference/client-js/telemetry.mdx +20 -0
  123. package/.docs/raw/reference/client-js/tools.mdx +44 -0
  124. package/.docs/raw/reference/client-js/vectors.mdx +79 -0
  125. package/.docs/raw/reference/client-js/workflows.mdx +136 -0
  126. package/.docs/raw/reference/core/mastra-class.mdx +232 -0
  127. package/.docs/raw/reference/deployer/cloudflare.mdx +176 -0
  128. package/.docs/raw/reference/deployer/deployer.mdx +159 -0
  129. package/.docs/raw/reference/deployer/netlify.mdx +88 -0
  130. package/.docs/raw/reference/deployer/vercel.mdx +97 -0
  131. package/.docs/raw/reference/evals/answer-relevancy.mdx +186 -0
  132. package/.docs/raw/reference/evals/bias.mdx +186 -0
  133. package/.docs/raw/reference/evals/completeness.mdx +174 -0
  134. package/.docs/raw/reference/evals/content-similarity.mdx +183 -0
  135. package/.docs/raw/reference/evals/context-position.mdx +190 -0
  136. package/.docs/raw/reference/evals/context-precision.mdx +189 -0
  137. package/.docs/raw/reference/evals/context-relevancy.mdx +188 -0
  138. package/.docs/raw/reference/evals/contextual-recall.mdx +191 -0
  139. package/.docs/raw/reference/evals/faithfulness.mdx +193 -0
  140. package/.docs/raw/reference/evals/hallucination.mdx +219 -0
  141. package/.docs/raw/reference/evals/keyword-coverage.mdx +176 -0
  142. package/.docs/raw/reference/evals/prompt-alignment.mdx +238 -0
  143. package/.docs/raw/reference/evals/summarization.mdx +205 -0
  144. package/.docs/raw/reference/evals/textual-difference.mdx +161 -0
  145. package/.docs/raw/reference/evals/tone-consistency.mdx +181 -0
  146. package/.docs/raw/reference/evals/toxicity.mdx +165 -0
  147. package/.docs/raw/reference/index.mdx +8 -0
  148. package/.docs/raw/reference/memory/Memory.mdx +212 -0
  149. package/.docs/raw/reference/memory/createThread.mdx +95 -0
  150. package/.docs/raw/reference/memory/getThreadById.mdx +46 -0
  151. package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +48 -0
  152. package/.docs/raw/reference/memory/query.mdx +167 -0
  153. package/.docs/raw/reference/networks/agent-network.mdx +159 -0
  154. package/.docs/raw/reference/observability/create-logger.mdx +106 -0
  155. package/.docs/raw/reference/observability/logger.mdx +55 -0
  156. package/.docs/raw/reference/observability/otel-config.mdx +120 -0
  157. package/.docs/raw/reference/observability/providers/braintrust.mdx +40 -0
  158. package/.docs/raw/reference/observability/providers/dash0.mdx +40 -0
  159. package/.docs/raw/reference/observability/providers/index.mdx +16 -0
  160. package/.docs/raw/reference/observability/providers/laminar.mdx +41 -0
  161. package/.docs/raw/reference/observability/providers/langfuse.mdx +51 -0
  162. package/.docs/raw/reference/observability/providers/langsmith.mdx +48 -0
  163. package/.docs/raw/reference/observability/providers/langwatch.mdx +45 -0
  164. package/.docs/raw/reference/observability/providers/new-relic.mdx +40 -0
  165. package/.docs/raw/reference/observability/providers/signoz.mdx +40 -0
  166. package/.docs/raw/reference/observability/providers/traceloop.mdx +40 -0
  167. package/.docs/raw/reference/rag/astra.mdx +258 -0
  168. package/.docs/raw/reference/rag/chroma.mdx +281 -0
  169. package/.docs/raw/reference/rag/chunk.mdx +235 -0
  170. package/.docs/raw/reference/rag/document.mdx +127 -0
  171. package/.docs/raw/reference/rag/embeddings.mdx +160 -0
  172. package/.docs/raw/reference/rag/extract-params.mdx +226 -0
  173. package/.docs/raw/reference/rag/graph-rag.mdx +182 -0
  174. package/.docs/raw/reference/rag/libsql.mdx +357 -0
  175. package/.docs/raw/reference/rag/metadata-filters.mdx +298 -0
  176. package/.docs/raw/reference/rag/pg.mdx +477 -0
  177. package/.docs/raw/reference/rag/pinecone.mdx +281 -0
  178. package/.docs/raw/reference/rag/qdrant.mdx +236 -0
  179. package/.docs/raw/reference/rag/rerank.mdx +212 -0
  180. package/.docs/raw/reference/rag/turbopuffer.mdx +249 -0
  181. package/.docs/raw/reference/rag/upstash.mdx +247 -0
  182. package/.docs/raw/reference/rag/vectorize.mdx +298 -0
  183. package/.docs/raw/reference/storage/libsql.mdx +74 -0
  184. package/.docs/raw/reference/storage/postgresql.mdx +48 -0
  185. package/.docs/raw/reference/storage/upstash.mdx +86 -0
  186. package/.docs/raw/reference/tools/client.mdx +188 -0
  187. package/.docs/raw/reference/tools/document-chunker-tool.mdx +141 -0
  188. package/.docs/raw/reference/tools/graph-rag-tool.mdx +154 -0
  189. package/.docs/raw/reference/tools/mcp-configuration.mdx +206 -0
  190. package/.docs/raw/reference/tools/vector-query-tool.mdx +212 -0
  191. package/.docs/raw/reference/voice/composite-voice.mdx +140 -0
  192. package/.docs/raw/reference/voice/deepgram.mdx +164 -0
  193. package/.docs/raw/reference/voice/elevenlabs.mdx +216 -0
  194. package/.docs/raw/reference/voice/google.mdx +198 -0
  195. package/.docs/raw/reference/voice/mastra-voice.mdx +394 -0
  196. package/.docs/raw/reference/voice/murf.mdx +251 -0
  197. package/.docs/raw/reference/voice/openai-realtime.mdx +431 -0
  198. package/.docs/raw/reference/voice/openai.mdx +168 -0
  199. package/.docs/raw/reference/voice/playai.mdx +159 -0
  200. package/.docs/raw/reference/voice/sarvam.mdx +260 -0
  201. package/.docs/raw/reference/voice/speechify.mdx +145 -0
  202. package/.docs/raw/reference/voice/voice.answer.mdx +122 -0
  203. package/.docs/raw/reference/voice/voice.connect.mdx +124 -0
  204. package/.docs/raw/reference/voice/voice.listen.mdx +195 -0
  205. package/.docs/raw/reference/voice/voice.on.mdx +189 -0
  206. package/.docs/raw/reference/voice/voice.send.mdx +118 -0
  207. package/.docs/raw/reference/voice/voice.speak.mdx +203 -0
  208. package/.docs/raw/reference/workflows/after.mdx +88 -0
  209. package/.docs/raw/reference/workflows/afterEvent.mdx +76 -0
  210. package/.docs/raw/reference/workflows/commit.mdx +37 -0
  211. package/.docs/raw/reference/workflows/createRun.mdx +77 -0
  212. package/.docs/raw/reference/workflows/else.mdx +72 -0
  213. package/.docs/raw/reference/workflows/events.mdx +305 -0
  214. package/.docs/raw/reference/workflows/execute.mdx +110 -0
  215. package/.docs/raw/reference/workflows/if.mdx +107 -0
  216. package/.docs/raw/reference/workflows/resume.mdx +155 -0
  217. package/.docs/raw/reference/workflows/resumeWithEvent.mdx +133 -0
  218. package/.docs/raw/reference/workflows/snapshots.mdx +207 -0
  219. package/.docs/raw/reference/workflows/start.mdx +84 -0
  220. package/.docs/raw/reference/workflows/step-class.mdx +100 -0
  221. package/.docs/raw/reference/workflows/step-condition.mdx +134 -0
  222. package/.docs/raw/reference/workflows/step-function.mdx +92 -0
  223. package/.docs/raw/reference/workflows/step-options.mdx +69 -0
  224. package/.docs/raw/reference/workflows/step-retries.mdx +203 -0
  225. package/.docs/raw/reference/workflows/suspend.mdx +70 -0
  226. package/.docs/raw/reference/workflows/then.mdx +74 -0
  227. package/.docs/raw/reference/workflows/until.mdx +165 -0
  228. package/.docs/raw/reference/workflows/watch.mdx +118 -0
  229. package/.docs/raw/reference/workflows/while.mdx +168 -0
  230. package/.docs/raw/reference/workflows/workflow.mdx +233 -0
  231. package/.docs/raw/storage/overview.mdx +378 -0
  232. package/.docs/raw/voice/overview.mdx +135 -0
  233. package/.docs/raw/voice/speech-to-text.mdx +45 -0
  234. package/.docs/raw/voice/text-to-speech.mdx +52 -0
  235. package/.docs/raw/voice/voice-to-voice.mdx +310 -0
  236. package/.docs/raw/workflows/control-flow.mdx +778 -0
  237. package/.docs/raw/workflows/dynamic-workflows.mdx +236 -0
  238. package/.docs/raw/workflows/error-handling.mdx +183 -0
  239. package/.docs/raw/workflows/nested-workflows.mdx +352 -0
  240. package/.docs/raw/workflows/overview.mdx +167 -0
  241. package/.docs/raw/workflows/steps.mdx +108 -0
  242. package/.docs/raw/workflows/suspend-and-resume.mdx +404 -0
  243. package/.docs/raw/workflows/variables.mdx +313 -0
  244. package/LICENSE +44 -0
  245. package/README.md +129 -0
  246. package/dist/_tsup-dts-rollup.d.ts +149 -0
  247. package/dist/chunk-QWYMT5LP.js +194 -0
  248. package/dist/prepare-docs/prepare.d.ts +1 -0
  249. package/dist/prepare-docs/prepare.js +1 -0
  250. package/dist/stdio.d.ts +1 -0
  251. package/dist/stdio.js +518 -0
  252. package/package.json +60 -0
@@ -0,0 +1,436 @@
1
+ ---
2
+ title: "Installing Mastra Locally | Getting Started | Mastra Docs"
3
+ description: Guide on installing Mastra and setting up the necessary prerequisites for running it with various LLM providers.
4
+ ---
5
+
6
+ import { Callout, Steps, Tabs } from "nextra/components";
7
+ import YouTube from "../../../components/youtube";
8
+
9
+ # Installing Mastra Locally
10
+
11
+ To run Mastra, you need access to an LLM. Typically, you'll want to get an API key from an LLM provider such as [OpenAI](https://platform.openai.com/), [Anthropic](https://console.anthropic.com/settings/keys), or [Google Gemini](https://ai.google.dev/gemini-api/docs). You can also run Mastra with a local LLM using [Ollama](https://ollama.ai/).
12
+
13
+ ## Prerequisites
14
+
15
+ - Node.js `v20.0` or higher
16
+ - Access to a [supported large language model (LLM)](/docs/reference/llm/providers-and-models)
17
+
18
+ ## Automatic Installation
19
+
20
+ <YouTube id="spGlcTEjuXY" />
21
+
22
+ <Steps>
23
+
24
+ ### Create a New Project
25
+
26
+ We recommend starting a new Mastra project using `create-mastra`, which will scaffold your project. To create
27
+ a project, run:
28
+
29
+ <Tabs items={["npx", "npm", "yarn", "pnpm"]}>
30
+ <Tabs.Tab>
31
+ ```bash copy
32
+ npx create-mastra@latest
33
+ ```
34
+ </Tabs.Tab>
35
+ <Tabs.Tab>
36
+ ```bash copy
37
+ npm create mastra@latest
38
+ ```
39
+ </Tabs.Tab>
40
+ <Tabs.Tab>
41
+ ```bash copy
42
+ yarn create mastra@latest
43
+ ```<
44
+ /Tabs.Tab>
45
+ <Tabs.Tab>
46
+ ```bash copy
47
+ pnpm create mastra@latest
48
+ ```
49
+ </Tabs.Tab>
50
+ </Tabs>
51
+
52
+ On installation, you'll be guided through the following prompts:
53
+
54
+ ```bash
55
+ What do you want to name your project? my-mastra-app
56
+ Choose components to install:
57
+ ◯ Agents (recommended)
58
+ ◯ Tools
59
+ ◯ Workflows
60
+ Select default provider:
61
+ ◯ OpenAI (recommended)
62
+ ◯ Anthropic
63
+ ◯ Groq
64
+ Would you like to include example code? No / Yes
65
+ Turn your IDE into a Mastra expert? (Installs MCP server)
66
+ ◯ Skip for now
67
+ ◯ Cursor
68
+ ◯ Windsurf
69
+ ```
70
+
71
+ After the prompts, `create-mastra` will:
72
+
73
+ 1. Set up your project directory with TypeScript
74
+ 2. Install dependencies
75
+ 3. Configure your selected components and LLM provider
76
+ 4. Configure the MCP server in your IDE (if selected) for instant access to docs, examples, and help while you code
77
+
78
+ **MCP Note:** If you're using a different IDE, you can install the MCP server manually by following the instructions in the [MCP server docs](/docs/getting-started/mcp-docs-server). **Also** note that there are additional steps for [Cursor and Windsurf](/docs/getting-started/mcp-docs-server#after-configuration) to activate the MCP server.
79
+
80
+ ### Set Up your API Key
81
+
82
+ Add the API key for your configured LLM provider in your `.env` file.
83
+
84
+ ```bash filename=".env" copy
85
+ OPENAI_API_KEY=<your-openai-key>
86
+ ```
87
+
88
+ </Steps>
89
+
90
+ **Non-Interactive mode**:
91
+ If you prefer to run the command with flags (non-interactive mode) and include the example code, you can use:
92
+
93
+ ```bash copy
94
+ npx create-mastra@latest --components agents,tools --llm openai --example
95
+ ```
96
+
97
+ **Configure Installation Timeout**:
98
+ To configure and specify a timeout if installation takes too long use the timeout flag:
99
+
100
+ ```bash copy
101
+ npx create-mastra@latest --timeout
102
+ ```
103
+
104
+ **Note for LLMs**:
105
+ For a quick one liner that includes examples you can run `npx -y mastra@latest --project-name <ask-the-user> --example --components "tools,agents,workflows" --llm <ask-the-user>`. The available options for the llm flag are `openai|anthropic|groq|google|cerebras`
106
+
107
+ ## Manual Installation
108
+
109
+ <br/>
110
+ <Steps>
111
+
112
+ If you prefer to set up your Mastra project manually, follow these steps:
113
+
114
+ ### Create a New Project
115
+
116
+ Create a project directory and navigate into it:
117
+
118
+ ```bash copy
119
+ mkdir hello-mastra
120
+ cd hello-mastra
121
+ ```
122
+
123
+ Then, initialize a TypeScript project including the `@mastra/core` package:
124
+
125
+ <Tabs items={["npm", "pnpm", "yarn", "bun"]}>
126
+ <Tabs.Tab>
127
+ ```bash copy
128
+ npm init -y
129
+ npm install typescript tsx @types/node mastra --save-dev
130
+ npm install @mastra/core zod @ai-sdk/openai npx tsc --init
131
+ ```
132
+ </Tabs.Tab>
133
+ <Tabs.Tab>
134
+ ```bash copy
135
+ pnpm init pnpm add typescript tsx @types/node mastra --save-dev
136
+ pnpm add @mastra/core zod pnpm dlx tsc --init
137
+ ```
138
+ </Tabs.Tab>
139
+ <Tabs.Tab>
140
+ ```bash copy
141
+ yarn init -y yarn add typescript tsx @types/node mastra --dev
142
+ yarn add @mastra/core zod yarn dlx tsc --init
143
+ ```
144
+ </Tabs.Tab>
145
+ <Tabs.Tab>
146
+ ```bash copy
147
+ bun init -y bun add typescript tsx @types/node mastra --dev
148
+ bun add @mastra/core zod bunx tsc --init
149
+ ```
150
+ </Tabs.Tab>
151
+ </Tabs>
152
+
153
+ ### Initialize TypeScript
154
+
155
+ Create a `tsconfig.json` file in your project root with the following configuration:
156
+
157
+ ```json copy
158
+ {
159
+ "compilerOptions": {
160
+ "target": "ES2022",
161
+ "module": "ES2022",
162
+ "moduleResolution": "bundler",
163
+ "esModuleInterop": true,
164
+ "forceConsistentCasingInFileNames": true,
165
+ "strict": true,
166
+ "skipLibCheck": true,
167
+ "outDir": "dist"
168
+ },
169
+ "include": ["src/**/*"],
170
+ "exclude": ["node_modules", "dist", ".mastra"]
171
+ }
172
+ ```
173
+
174
+ This TypeScript configuration is optimized for Mastra projects, using modern module resolution and strict type checking.
175
+
176
+ ### Set Up your API Key
177
+
178
+ Create a `.env` file in your project root directory and add your API key:
179
+
180
+ ```bash filename=".env" copy
181
+ OPENAI_API_KEY=<your-openai-key>
182
+ ```
183
+
184
+ Replace your_openai_api_key with your actual API key.
185
+
186
+ ### Create a Tool
187
+
188
+ Create a `weather-tool` tool file:
189
+
190
+ ```bash copy
191
+ mkdir -p src/mastra/tools && touch src/mastra/tools/weather-tool.ts
192
+ ```
193
+
194
+ Then, add the following code to `src/mastra/tools/weather-tool.ts`:
195
+
196
+ ```ts filename="src/mastra/tools/weather-tool.ts" showLineNumbers copy
197
+ import { createTool } from "@mastra/core/tools";
198
+ import { z } from "zod";
199
+
200
+ interface WeatherResponse {
201
+ current: {
202
+ time: string;
203
+ temperature_2m: number;
204
+ apparent_temperature: number;
205
+ relative_humidity_2m: number;
206
+ wind_speed_10m: number;
207
+ wind_gusts_10m: number;
208
+ weather_code: number;
209
+ };
210
+ }
211
+
212
+ export const weatherTool = createTool({
213
+ id: "get-weather",
214
+ description: "Get current weather for a location",
215
+ inputSchema: z.object({
216
+ location: z.string().describe("City name"),
217
+ }),
218
+ outputSchema: z.object({
219
+ temperature: z.number(),
220
+ feelsLike: z.number(),
221
+ humidity: z.number(),
222
+ windSpeed: z.number(),
223
+ windGust: z.number(),
224
+ conditions: z.string(),
225
+ location: z.string(),
226
+ }),
227
+ execute: async ({ context }) => {
228
+ return await getWeather(context.location);
229
+ },
230
+ });
231
+
232
+ const getWeather = async (location: string) => {
233
+ const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(location)}&count=1`;
234
+ const geocodingResponse = await fetch(geocodingUrl);
235
+ const geocodingData = await geocodingResponse.json();
236
+
237
+ if (!geocodingData.results?.[0]) {
238
+ throw new Error(`Location '${location}' not found`);
239
+ }
240
+
241
+ const { latitude, longitude, name } = geocodingData.results[0];
242
+
243
+ const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m,apparent_temperature,relative_humidity_2m,wind_speed_10m,wind_gusts_10m,weather_code`;
244
+
245
+ const response = await fetch(weatherUrl);
246
+ const data: WeatherResponse = await response.json();
247
+
248
+ return {
249
+ temperature: data.current.temperature_2m,
250
+ feelsLike: data.current.apparent_temperature,
251
+ humidity: data.current.relative_humidity_2m,
252
+ windSpeed: data.current.wind_speed_10m,
253
+ windGust: data.current.wind_gusts_10m,
254
+ conditions: getWeatherCondition(data.current.weather_code),
255
+ location: name,
256
+ };
257
+ };
258
+
259
+ function getWeatherCondition(code: number): string {
260
+ const conditions: Record<number, string> = {
261
+ 0: "Clear sky",
262
+ 1: "Mainly clear",
263
+ 2: "Partly cloudy",
264
+ 3: "Overcast",
265
+ 45: "Foggy",
266
+ 48: "Depositing rime fog",
267
+ 51: "Light drizzle",
268
+ 53: "Moderate drizzle",
269
+ 55: "Dense drizzle",
270
+ 56: "Light freezing drizzle",
271
+ 57: "Dense freezing drizzle",
272
+ 61: "Slight rain",
273
+ 63: "Moderate rain",
274
+ 65: "Heavy rain",
275
+ 66: "Light freezing rain",
276
+ 67: "Heavy freezing rain",
277
+ 71: "Slight snow fall",
278
+ 73: "Moderate snow fall",
279
+ 75: "Heavy snow fall",
280
+ 77: "Snow grains",
281
+ 80: "Slight rain showers",
282
+ 81: "Moderate rain showers",
283
+ 82: "Violent rain showers",
284
+ 85: "Slight snow showers",
285
+ 86: "Heavy snow showers",
286
+ 95: "Thunderstorm",
287
+ 96: "Thunderstorm with slight hail",
288
+ 99: "Thunderstorm with heavy hail",
289
+ };
290
+ return conditions[code] || "Unknown";
291
+ }
292
+ ```
293
+
294
+ ### Create an Agent
295
+
296
+ Create a `weather` agent file:
297
+
298
+ ```bash copy
299
+ mkdir -p src/mastra/agents && touch src/mastra/agents/weather.ts
300
+ ```
301
+
302
+ Then, add the following code to `src/mastra/agents/weather.ts`:
303
+
304
+ ```ts filename="src/mastra/agents/weather.ts" showLineNumbers copy
305
+ import { openai } from "@ai-sdk/openai";
306
+ import { Agent } from "@mastra/core/agent";
307
+ import { weatherTool } from "../tools/weather-tool";
308
+
309
+ export const weatherAgent = new Agent({
310
+ name: "Weather Agent",
311
+ instructions: `You are a helpful weather assistant that provides accurate weather information.
312
+
313
+ Your primary function is to help users get weather details for specific locations. When responding:
314
+ - Always ask for a location if none is provided
315
+ - If the location name isn’t in English, please translate it
316
+ - Include relevant details like humidity, wind conditions, and precipitation
317
+ - Keep responses concise but informative
318
+
319
+ Use the weatherTool to fetch current weather data.`,
320
+ model: openai("gpt-4o-mini"),
321
+ tools: { weatherTool },
322
+ });
323
+ ```
324
+
325
+ ### Register Agent
326
+
327
+ Finally, create the Mastra entry point in `src/mastra/index.ts` and register agent:
328
+
329
+ ```ts filename="src/mastra/index.ts" showLineNumbers copy
330
+ import { Mastra } from "@mastra/core";
331
+
332
+ import { weatherAgent } from "./agents/weather";
333
+
334
+ export const mastra = new Mastra({
335
+ agents: { weatherAgent },
336
+ });
337
+ ```
338
+
339
+ This registers your agent with Mastra so that `mastra dev` can discover and serve it.
340
+
341
+ </Steps>
342
+
343
+ ## Existing Project Installation
344
+
345
+ To add Mastra to an existing project, see our Local development docs on [adding mastra to an existing project](/docs/local-dev/add-to-existing-project).
346
+
347
+ You can also checkout our framework specific docs e.g [Next.js](/docs/frameworks/next-js)
348
+
349
+ ## Start the Mastra Server
350
+
351
+ Mastra provides commands to serve your agents via REST endpoints
352
+
353
+ ### Development Server
354
+
355
+ Run the following command to start the Mastra server:
356
+
357
+ ```bash copy
358
+ npm run dev
359
+ ```
360
+
361
+ If you have the mastra CLI installed, run:
362
+
363
+ ```bash copy
364
+ mastra dev
365
+ ```
366
+
367
+ This command creates REST API endpoints for your agents.
368
+
369
+ ### Test the Endpoint
370
+
371
+ You can test the agent's endpoint using `curl` or `fetch`:
372
+
373
+ <Tabs items={['curl', 'fetch']}>
374
+ <Tabs.Tab>
375
+ ```bash copy
376
+ curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
377
+ -H "Content-Type: application/json" \
378
+ -d '{"messages": ["What is the weather in London?"]}'
379
+ ```
380
+ </Tabs.Tab>
381
+ <Tabs.Tab>
382
+ ```js copy showLineNumbers
383
+ fetch('http://localhost:4111/api/agents/weatherAgent/generate', {
384
+ method: 'POST',
385
+ headers: {
386
+ 'Content-Type': 'application/json',
387
+ },
388
+ body: JSON.stringify({
389
+ messages: ['What is the weather in London?'],
390
+ }),
391
+ })
392
+ .then(response => response.json())
393
+ .then(data => {
394
+ console.log('Agent response:', data.text);
395
+ })
396
+ .catch(error => {
397
+ console.error('Error:', error);
398
+ });
399
+ ```
400
+ </Tabs.Tab>
401
+ </Tabs>
402
+
403
+ ## Use Mastra on the Client
404
+
405
+ To use Mastra in your frontend applications, you can use our type-safe client SDK to
406
+ interact with your Mastra REST APIs.
407
+
408
+ See the [Mastra Client SDK documentation](/docs/deployment/client) for detailed usage instructions.
409
+
410
+ ## Run from the command line
411
+
412
+ If you'd like to directly call agents from the command line, you can create a script to get an agent and call it:
413
+
414
+ ```ts filename="src/index.ts" showLineNumbers copy
415
+ import { mastra } from "./mastra";
416
+
417
+ async function main() {
418
+ const agent = await mastra.getAgent("weatherAgent");
419
+
420
+ const result = await agent.generate("What is the weather in London?");
421
+
422
+ console.log("Agent response:", result.text);
423
+ }
424
+
425
+ main();
426
+ ```
427
+
428
+ Then, run the script to test that everything is set up correctly:
429
+
430
+ ```bash copy
431
+ npx tsx src/index.ts
432
+ ```
433
+
434
+ This should output the agent's response to your console.
435
+
436
+ ---
@@ -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.