@mastra/mcp-docs-server 0.13.27 → 0.13.28-alpha.2
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.
- package/.docs/organized/changelogs/%40internal%2Fplayground.md +3 -1
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +10 -10
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +4 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +20 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +97 -97
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +44 -44
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +75 -75
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +105 -105
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Frag.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Freact.md +40 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +21 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +79 -79
- package/.docs/organized/changelogs/mastra.md +118 -118
- package/.docs/organized/code-examples/agent.md +2 -1
- package/.docs/organized/code-examples/heads-up-game.md +5 -5
- package/.docs/raw/agents/guardrails.mdx +335 -0
- package/.docs/raw/{networks-vnext/complex-task-execution.mdx → agents/networks.mdx} +29 -9
- package/.docs/raw/agents/overview.mdx +107 -63
- package/.docs/raw/agents/runtime-context.mdx +11 -16
- package/.docs/raw/agents/using-tools-and-mcp.mdx +1 -1
- package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +9 -2
- package/.docs/raw/getting-started/mcp-docs-server.mdx +84 -179
- package/.docs/raw/getting-started/model-providers.mdx +5 -3
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/cli/create-mastra.mdx +61 -5
- package/.docs/raw/reference/cli/mastra.mdx +252 -0
- package/.docs/raw/reference/client-js/agents.mdx +1 -10
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +111 -0
- package/.docs/raw/reference/processors/language-detector.mdx +154 -0
- package/.docs/raw/reference/processors/moderation-processor.mdx +145 -0
- package/.docs/raw/reference/processors/pii-detector.mdx +153 -0
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +130 -0
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +145 -0
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +136 -0
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +114 -0
- package/.docs/raw/reference/streaming/ChunkType.mdx +2 -6
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +1 -5
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +17 -1
- package/.docs/raw/reference/workflows/run-methods/start.mdx +17 -1
- package/.docs/raw/reference/workflows/step.mdx +11 -0
- package/.docs/raw/reference/workflows/workflow.mdx +7 -1
- package/.docs/raw/server-db/local-dev-playground.mdx +1 -1
- package/.docs/raw/workflows/overview.mdx +22 -5
- package/CHANGELOG.md +24 -0
- package/package.json +5 -5
- package/.docs/raw/agents/input-processors.mdx +0 -284
- package/.docs/raw/agents/output-processors.mdx +0 -328
- package/.docs/raw/networks-vnext/overview.mdx +0 -85
- package/.docs/raw/networks-vnext/single-task-execution.mdx +0 -135
- package/.docs/raw/reference/cli/build.mdx +0 -115
- package/.docs/raw/reference/cli/dev.mdx +0 -249
- package/.docs/raw/reference/cli/init.mdx +0 -97
- package/.docs/raw/reference/cli/lint.mdx +0 -56
- package/.docs/raw/reference/cli/mcp-docs-server.mdx +0 -82
- package/.docs/raw/reference/cli/scorers.mdx +0 -160
- package/.docs/raw/reference/cli/start.mdx +0 -50
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Runtime
|
|
2
|
+
title: "Runtime Context | Agents | Mastra Docs"
|
|
3
3
|
description: Learn how to use Mastra's RuntimeContext to provide dynamic, request-specific configuration to agents.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Runtime Context
|
|
7
7
|
|
|
8
8
|
Mastra provides `RuntimeContext`, a dependency injection system that lets you configure agents with runtime variables. If you find yourself creating multiple agents that perform similar tasks, runtime context allows you to consolidate them into a single, more flexible agent.
|
|
9
9
|
|
|
@@ -46,9 +46,9 @@ export const testWeatherAgent = new Agent({
|
|
|
46
46
|
|
|
47
47
|
### Example tool
|
|
48
48
|
|
|
49
|
-
This tool exports a `WeatherRuntimeContext` type,
|
|
49
|
+
This tool exports a `WeatherRuntimeContext` type, enabling type-safe access to runtime configuration wherever the tool’s `runtimeContext` is used. It extracts `city` from `context`, which is derived from the user message passed to `.generate()`, and uses it to query a weather service API.
|
|
50
50
|
|
|
51
|
-
```typescript {4-6} filename="src/mastra/tools/test-weather-tool.ts" showLineNumbers copy
|
|
51
|
+
```typescript {4-6, 15} filename="src/mastra/tools/test-weather-tool.ts" showLineNumbers copy
|
|
52
52
|
import { createTool } from "@mastra/core/tools";
|
|
53
53
|
import { z } from "zod";
|
|
54
54
|
|
|
@@ -58,26 +58,21 @@ export type WeatherRuntimeContext = {
|
|
|
58
58
|
|
|
59
59
|
export const testWeatherTool = createTool({
|
|
60
60
|
id: "test-weather-tool",
|
|
61
|
-
description: "
|
|
61
|
+
description: "Fetches the current weather for a given city",
|
|
62
62
|
inputSchema: z.object({
|
|
63
|
-
|
|
64
|
-
}),
|
|
65
|
-
outputSchema: z.object({
|
|
66
|
-
metric: z.string(),
|
|
67
|
-
temperature: z.number(),
|
|
68
|
-
weather: z.string()
|
|
63
|
+
city: z.string()
|
|
69
64
|
}),
|
|
70
65
|
execute: async ({ context, runtimeContext }) => {
|
|
71
|
-
const {
|
|
66
|
+
const { city } = context;
|
|
72
67
|
const unit = runtimeContext.get("temperature-unit") as WeatherRuntimeContext["temperature-unit"];
|
|
73
68
|
|
|
74
|
-
const
|
|
75
|
-
const
|
|
69
|
+
const response = await fetch(`https://weather.service?city=${city}`);
|
|
70
|
+
const { temperature, conditions } = await response.json();
|
|
76
71
|
|
|
77
72
|
return {
|
|
78
73
|
metric: unit === "celsius" ? "°C" : "°F",
|
|
79
74
|
temperature,
|
|
80
|
-
|
|
75
|
+
conditions
|
|
81
76
|
};
|
|
82
77
|
}
|
|
83
78
|
});
|
|
@@ -96,7 +91,7 @@ const agent = mastra.getAgent("testWeatherAgent");
|
|
|
96
91
|
|
|
97
92
|
const runtimeContext = new RuntimeContext<WeatherRuntimeContext>();
|
|
98
93
|
|
|
99
|
-
runtimeContext.set("temperature-unit", "
|
|
94
|
+
runtimeContext.set("temperature-unit", "celsius");
|
|
100
95
|
|
|
101
96
|
const response = await agent.generate("What's the weather in London?", {
|
|
102
97
|
runtimeContext
|
|
@@ -22,7 +22,7 @@ import { z } from "zod";
|
|
|
22
22
|
|
|
23
23
|
export const weatherTool = createTool({
|
|
24
24
|
id: "weather-tool",
|
|
25
|
-
description: "Fetches the current weather
|
|
25
|
+
description: "Fetches the current weather for a given city",
|
|
26
26
|
inputSchema: z.object({
|
|
27
27
|
city: z.string(),
|
|
28
28
|
}),
|
|
@@ -95,9 +95,16 @@ The default Assistant UI setup configures the chat runtime to use a local API ro
|
|
|
95
95
|
|
|
96
96
|
Find the `useChatRuntime` hook in the `assistant-ui` project, typically at `app/assistant.tsx` and change the `api` property to the full URL of your Mastra agent's stream endpoint:
|
|
97
97
|
|
|
98
|
-
```typescript showLineNumbers copy filename="app/assistant.tsx" {
|
|
98
|
+
```typescript showLineNumbers copy filename="app/assistant.tsx" {6}
|
|
99
|
+
import {
|
|
100
|
+
useChatRuntime,
|
|
101
|
+
AssistantChatTransport,
|
|
102
|
+
} from "@assistant-ui/react-ai-sdk";
|
|
103
|
+
|
|
99
104
|
const runtime = useChatRuntime({
|
|
100
|
-
|
|
105
|
+
transport: new AssistantChatTransport({
|
|
106
|
+
api: "MASTRA_ENDPOINT",
|
|
107
|
+
}),
|
|
101
108
|
});
|
|
102
109
|
```
|
|
103
110
|
|
|
@@ -4,167 +4,55 @@ description: "Learn how to use the Mastra MCP documentation server in your IDE t
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import YouTube from "@/components/youtube";
|
|
7
|
-
import { Tabs } from "nextra/components";
|
|
8
7
|
|
|
9
8
|
# Mastra Docs Server
|
|
10
9
|
|
|
11
|
-
The `@mastra/mcp-docs-server` package provides direct access to Mastra’s full knowledge base, including documentation, code examples, blog posts, and changelogs, via the MCP
|
|
10
|
+
The `@mastra/mcp-docs-server` package provides direct access to Mastra’s full knowledge base, including documentation, code examples, blog posts, and changelogs, via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro). It works with Cursor, Windsurf, Cline, Claude Code, or any tool that supports MCP.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
These tools are designed to help agents retrieve precise, task-specific information—whether you're adding a feature to an agent, scaffolding a new project, or exploring how something works.
|
|
16
|
-
|
|
17
|
-
## How it works
|
|
18
|
-
|
|
19
|
-
Once installed you can write prompts and assume the agent will understand everything about Mastra.
|
|
20
|
-
|
|
21
|
-
### Add features
|
|
22
|
-
|
|
23
|
-
- "Add evals to my agent and write tests"
|
|
24
|
-
- "Write me a workflow that does the following `[task]`"
|
|
25
|
-
- "Make a new tool that allows my agent to access `[3rd party API]`"
|
|
26
|
-
|
|
27
|
-
### Ask about integrations
|
|
28
|
-
|
|
29
|
-
- "Does Mastra work with the AI SDK?
|
|
30
|
-
How can I use it in my `[React/Svelte/etc]` project?"
|
|
31
|
-
- "What's the latest Mastra news around MCP?"
|
|
32
|
-
- "Does Mastra support `[provider]` speech and voice APIs? Show me an example in my code of how I can use it."
|
|
33
|
-
|
|
34
|
-
### Debug or update existing code
|
|
35
|
-
|
|
36
|
-
- "I'm running into a bug with agent memory, have there been any related changes or bug fixes recently?"
|
|
37
|
-
- "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."
|
|
38
|
-
- "I saw there are new workflow features, explain them to me and then update `[workflow]` to use them."
|
|
39
|
-
|
|
40
|
-
**And more** - if you have a question, try asking your IDE and let it look it up for you.
|
|
12
|
+
These tools are designed to help agents retrieve precise, task-specific information — whether you're adding a feature to an agent, scaffolding a new project, or exploring how something works.
|
|
41
13
|
|
|
42
|
-
|
|
14
|
+
In this guide you'll learn how to add Mastra's MCP server to your AI tooling.
|
|
43
15
|
|
|
44
|
-
|
|
16
|
+
<YouTube id="vciV57lF0og" />
|
|
45
17
|
|
|
46
|
-
##
|
|
18
|
+
## Installation
|
|
47
19
|
|
|
48
|
-
|
|
20
|
+
### create-mastra
|
|
49
21
|
|
|
50
|
-
|
|
51
|
-
- **Windsurf**: Edit `~/.codeium/windsurf/mcp_config.json` (only supports global configuration)
|
|
52
|
-
- **VSCode**: Either move the created `.vscode` folder into the top-level of your workspace or open the created folder as your new workspace root. Edit `~/.vscode/mcp.json` in your project root. Add the following configuration:
|
|
53
|
-
- **Claude Code**: Run the `claude mcp add` command as shown below.
|
|
22
|
+
During the interactive [create-mastra](/reference/cli/create-mastra) wizard, choose one of your tools in the MCP step.
|
|
54
23
|
|
|
55
|
-
###
|
|
24
|
+
### Manual setup
|
|
56
25
|
|
|
57
|
-
|
|
58
|
-
LLM CONTEXT: This Tabs component shows MCP server configuration for different IDEs on MacOS/Linux.
|
|
59
|
-
Each tab displays the JSON configuration needed to set up the Mastra MCP docs server in that specific IDE.
|
|
60
|
-
The tabs help users find the correct configuration format for their IDE (Cursor, Windsurf, or VSCode).
|
|
61
|
-
Each tab shows the exact JSON structure and file paths needed for that IDE's MCP configuration.
|
|
62
|
-
*/}
|
|
26
|
+
If there are no specific instructions for your tool below, you may be able to add the MCP server with this common JSON configuration anyways.
|
|
63
27
|
|
|
64
|
-
|
|
65
|
-
<Tabs.Tab>
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
"mcpServers": {
|
|
69
|
-
"mastra": {
|
|
70
|
-
"command": "npx",
|
|
71
|
-
"args": ["-y", "@mastra/mcp-docs-server"]
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
</Tabs.Tab>
|
|
77
|
-
<Tabs.Tab>
|
|
78
|
-
```json
|
|
79
|
-
{
|
|
80
|
-
"mcpServers": {
|
|
81
|
-
"mastra": {
|
|
82
|
-
"command": "npx",
|
|
83
|
-
"args": ["-y", "@mastra/mcp-docs-server"]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
</Tabs.Tab>
|
|
89
|
-
<Tabs.Tab>
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"servers": {
|
|
93
|
-
"mastra": {
|
|
94
|
-
"command": "npx",
|
|
95
|
-
"args": ["-y", "@mastra/mcp-docs-server"],
|
|
96
|
-
"type": "stdio"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
</Tabs.Tab>
|
|
102
|
-
<Tabs.Tab>
|
|
103
|
-
```bash
|
|
104
|
-
claude mcp add mastra -- npx -y @mastra/mcp-docs-server
|
|
105
|
-
```
|
|
106
|
-
</Tabs.Tab>
|
|
107
|
-
</Tabs>
|
|
108
|
-
|
|
109
|
-
### Windows
|
|
110
|
-
|
|
111
|
-
{/*
|
|
112
|
-
LLM CONTEXT: This Tabs component shows MCP server configuration for different IDEs on Windows.
|
|
113
|
-
Each tab displays the Windows-specific JSON configuration needed to set up the Mastra MCP docs server.
|
|
114
|
-
The tabs help Windows users find the correct configuration format for their IDE, using cmd instead of direct npx.
|
|
115
|
-
Each tab shows the Windows-specific command structure needed for that IDE's MCP configuration.
|
|
116
|
-
On latest Windsurf and Cursor the direct npx command works, while it's still unconfirmed if this has been fixed for VSCode.
|
|
117
|
-
*/}
|
|
118
|
-
|
|
119
|
-
<Tabs items={["Cursor", "Windsurf", "VSCode", "Claude Code"]}>
|
|
120
|
-
<Tabs.Tab>
|
|
121
|
-
```json
|
|
122
|
-
{
|
|
123
|
-
"mcpServers": {
|
|
124
|
-
"mastra": {
|
|
125
|
-
"command": "npx",
|
|
126
|
-
"args": ["-y", "@mastra/mcp-docs-server"]
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
</Tabs.Tab>
|
|
132
|
-
<Tabs.Tab>
|
|
133
|
-
```json
|
|
28
|
+
```json copy
|
|
134
29
|
{
|
|
135
30
|
"mcpServers": {
|
|
136
31
|
"mastra": {
|
|
32
|
+
"type": "stdio",
|
|
137
33
|
"command": "npx",
|
|
138
34
|
"args": ["-y", "@mastra/mcp-docs-server"]
|
|
139
35
|
}
|
|
140
36
|
}
|
|
141
37
|
}
|
|
142
38
|
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"command": "cmd",
|
|
150
|
-
"args": ["/c", "npx", "-y", "@mastra/mcp-docs-server"],
|
|
151
|
-
"type": "stdio"
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
</Tabs.Tab>
|
|
157
|
-
<Tabs.Tab>
|
|
158
|
-
```bash
|
|
39
|
+
|
|
40
|
+
### Claude Code CLI
|
|
41
|
+
|
|
42
|
+
Install using the terminal command:
|
|
43
|
+
|
|
44
|
+
```bash copy
|
|
159
45
|
claude mcp add mastra -- npx -y @mastra/mcp-docs-server
|
|
160
46
|
```
|
|
161
|
-
</Tabs.Tab>
|
|
162
|
-
</Tabs>
|
|
163
47
|
|
|
164
|
-
|
|
48
|
+
[More info on using MCP servers with Claude Code](https://docs.claude.com/en/docs/claude-code/mcp)
|
|
165
49
|
|
|
166
50
|
### Cursor
|
|
167
51
|
|
|
52
|
+
Install by clicking the button below:
|
|
53
|
+
|
|
54
|
+
[](cursor://anysphere.cursor-deeplink/mcp/install?name=mastra&config=eyJjb21tYW5kIjoibnB4IC15IEBtYXN0cmEvbWNwLWRvY3Mtc2VydmVyIn0%3D)
|
|
55
|
+
|
|
168
56
|
If you followed the automatic installation, you'll see a popup when you open cursor in the bottom left corner to prompt you to enable the Mastra Docs MCP Server.
|
|
169
57
|
|
|
170
58
|
<img
|
|
@@ -173,32 +61,40 @@ If you followed the automatic installation, you'll see a popup when you open cur
|
|
|
173
61
|
width={800}
|
|
174
62
|
/>
|
|
175
63
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
64
|
+
[More info on using MCP servers with Cursor](https://cursor.com/de/docs/context/mcp)
|
|
65
|
+
|
|
66
|
+
### Visual Studio Code
|
|
67
|
+
|
|
68
|
+
1. Create a `.vscode/mcp.json` file in your workspace
|
|
69
|
+
2. Insert the following configuration:
|
|
70
|
+
|
|
71
|
+
```json copy
|
|
72
|
+
{
|
|
73
|
+
"servers": {
|
|
74
|
+
"mastra": {
|
|
75
|
+
"type": "stdio",
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": [
|
|
78
|
+
"-y",
|
|
79
|
+
"@mastra/mcp-docs-server"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
189
85
|
|
|
190
|
-
|
|
86
|
+
Once you installed the MCP server, you can use it like so:
|
|
191
87
|
|
|
192
88
|
1. Open VSCode settings.
|
|
193
89
|
2. Navigate to MCP settings.
|
|
194
90
|
3. Click "enable" on the Chat > MCP option.
|
|
195
91
|
|
|
196
|
-
<img
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/>
|
|
92
|
+
<img
|
|
93
|
+
src="/image/vscode-mcp-setting.png"
|
|
94
|
+
alt="Settings page of VSCode to enable MCP"
|
|
95
|
+
width={800}
|
|
96
|
+
className="rounded-lg"
|
|
97
|
+
/>
|
|
202
98
|
|
|
203
99
|
MCP only works in Agent mode in VSCode. Once you are in agent mode, open the `mcp.json` file and click the "start" button. Note that the "start" button will only appear if the `.vscode` folder containing `mcp.json` is in your workspace root, or the highest level of the in-editor file explorer.
|
|
204
100
|
|
|
@@ -209,7 +105,7 @@ MCP only works in Agent mode in VSCode. Once you are in agent mode, open the `mc
|
|
|
209
105
|
className="rounded-lg"
|
|
210
106
|
/>
|
|
211
107
|
|
|
212
|
-
After starting the
|
|
108
|
+
After starting the MCP server, click the tools button in the Copilot pane to see available tools.
|
|
213
109
|
|
|
214
110
|
<img
|
|
215
111
|
src="/image/vscode-mcp-running.png"
|
|
@@ -218,48 +114,57 @@ After starting the mcp server, click the tools button in the copilot pane to see
|
|
|
218
114
|
className="rounded-lg"
|
|
219
115
|
/>
|
|
220
116
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
### Documentation
|
|
117
|
+
[More info on using MCP servers with Visual Studio Code](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
|
|
224
118
|
|
|
225
|
-
|
|
119
|
+
### Windsurf
|
|
226
120
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
121
|
+
1. Open `~/.codeium/windsurf/mcp_config.json` in your editor
|
|
122
|
+
2. Insert the following configuration:
|
|
123
|
+
|
|
124
|
+
```json copy
|
|
125
|
+
{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"mastra": {
|
|
128
|
+
"command": "npx",
|
|
129
|
+
"args": ["-y", "@mastra/mcp-docs-server"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
3. Save the configuration and restart Windsurf
|
|
230
135
|
|
|
231
|
-
|
|
136
|
+
[More info on using MCP servers with Windsurf](https://docs.windsurf.com/windsurf/cascade/mcp#mcp-config-json)
|
|
232
137
|
|
|
233
|
-
|
|
138
|
+
## Usage
|
|
234
139
|
|
|
235
|
-
-
|
|
236
|
-
- Implementation patterns.
|
|
237
|
-
- Best practices.
|
|
140
|
+
Once configured, you can ask your AI tool questions about Mastra or instruct it to take actions. For these steps, it'll take the up-to-date information from Mastra's MCP server.
|
|
238
141
|
|
|
239
|
-
|
|
142
|
+
**Add features:**
|
|
240
143
|
|
|
241
|
-
|
|
144
|
+
- "Add evals to my agent and write tests"
|
|
145
|
+
- "Write me a workflow that does the following `[task]`"
|
|
146
|
+
- "Make a new tool that allows my agent to access `[3rd party API]`"
|
|
242
147
|
|
|
243
|
-
|
|
244
|
-
- Changelog and feature announcements.
|
|
245
|
-
- AI news and updates.
|
|
148
|
+
**Ask about integrations:**
|
|
246
149
|
|
|
247
|
-
|
|
150
|
+
- "Does Mastra work with the AI SDK?
|
|
151
|
+
How can I use it in my `[React/Svelte/etc]` project?"
|
|
152
|
+
- "What's the latest Mastra news around MCP?"
|
|
153
|
+
- "Does Mastra support `[provider]` speech and voice APIs? Show me an example in my code of how I can use it."
|
|
248
154
|
|
|
249
|
-
|
|
155
|
+
**Debug or update existing code:**
|
|
250
156
|
|
|
251
|
-
-
|
|
252
|
-
-
|
|
253
|
-
-
|
|
157
|
+
- "I'm running into a bug with agent memory, have there been any related changes or bug fixes recently?"
|
|
158
|
+
- "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."
|
|
159
|
+
- "I saw there are new workflow features, explain them to me and then update `[workflow]` to use them."
|
|
254
160
|
|
|
255
|
-
|
|
161
|
+
### Troubleshooting
|
|
256
162
|
|
|
257
163
|
1. **Server Not Starting**
|
|
258
164
|
|
|
259
165
|
- Ensure [npx](https://docs.npmjs.com/cli/v11/commands/npx) is installed and working.
|
|
260
166
|
- Check for conflicting MCP servers.
|
|
261
167
|
- Verify your configuration file syntax.
|
|
262
|
-
- On Windows, make sure to use the Windows-specific configuration.
|
|
263
168
|
|
|
264
169
|
2. **Tool Calls Failing**
|
|
265
170
|
- Restart the MCP server and/or your IDE.
|
|
@@ -29,6 +29,8 @@ const result = await agent.generate("What is the weather like?");
|
|
|
29
29
|
|
|
30
30
|
<Callout>
|
|
31
31
|
**[→ View all 38 providers and 7 gateways](../../models)**
|
|
32
|
+
|
|
33
|
+
Explore our complete catalog with logos, model counts, and documentation for each provider.
|
|
32
34
|
</Callout>
|
|
33
35
|
|
|
34
36
|
## Configuration
|
|
@@ -56,6 +58,6 @@ const agent = new Agent({
|
|
|
56
58
|
## Learn More
|
|
57
59
|
|
|
58
60
|
- [📚 Browse All Model Providers](../../models) - Complete list with examples
|
|
59
|
-
- [🚀 Agent Documentation](
|
|
60
|
-
- [⚙️ Environment Variables](/
|
|
61
|
-
- [🔧 Tool Configuration](/
|
|
61
|
+
- [🚀 Agent Documentation](../../reference/agents/agent.mdx) - Using models with agents
|
|
62
|
+
- [⚙️ Environment Variables](../getting-started/installation.mdx#add-your-api-key) - Configuration guide
|
|
63
|
+
- [🔧 Tool Configuration](../agents/using-tools-and-mcp.mdx#adding-tools-to-an-agent) - Adding tools to agents
|
|
@@ -278,7 +278,7 @@ await agent.network(`
|
|
|
278
278
|
},
|
|
279
279
|
{
|
|
280
280
|
name: "result",
|
|
281
|
-
type: "Promise<WorkflowResult<TOutput, TSteps>>",
|
|
281
|
+
type: "Promise<WorkflowResult<TState, TOutput, TSteps>>",
|
|
282
282
|
description: "A promise that resolves to the final workflow result",
|
|
283
283
|
},
|
|
284
284
|
{
|
|
@@ -1,19 +1,75 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "create-mastra |
|
|
2
|
+
title: "Reference: create-mastra | CLI"
|
|
3
3
|
description: Documentation for the create-mastra command, which creates a new Mastra project with interactive setup options.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
import { Tabs, Tab } from "@/components/tabs";
|
|
7
|
+
|
|
6
8
|
# create-mastra
|
|
7
9
|
|
|
8
|
-
The `create-mastra` command **creates** a new standalone Mastra project. Use this command to scaffold a complete Mastra setup in a dedicated directory.
|
|
10
|
+
The `create-mastra` command **creates** a new standalone Mastra project. Use this command to scaffold a complete Mastra setup in a dedicated directory. You can run it with additional flags to customize the setup process.
|
|
9
11
|
|
|
10
12
|
## Usage
|
|
11
13
|
|
|
14
|
+
<Tabs items={["npm", "yarn", "pnpm", "bun"]}>
|
|
15
|
+
<Tab>
|
|
16
|
+
```bash copy
|
|
17
|
+
npx create-mastra@latest
|
|
18
|
+
```
|
|
19
|
+
</Tab>
|
|
20
|
+
<Tab>
|
|
21
|
+
```bash copy
|
|
22
|
+
yarn dlx create-mastra@latest
|
|
23
|
+
```
|
|
24
|
+
</Tab>
|
|
25
|
+
<Tab>
|
|
26
|
+
```bash copy
|
|
27
|
+
pnpm create mastra@latest
|
|
28
|
+
```
|
|
29
|
+
</Tab>
|
|
30
|
+
<Tab>
|
|
31
|
+
```bash copy
|
|
32
|
+
bun create mastra@latest
|
|
33
|
+
```
|
|
34
|
+
</Tab>
|
|
35
|
+
</Tabs>
|
|
36
|
+
|
|
37
|
+
`create-mastra` automatically runs in _interactive_ mode, but you can also specify your project name and template with command line arguments.
|
|
38
|
+
|
|
39
|
+
<Tabs items={["npm", "yarn", "pnpm", "bun"]}>
|
|
40
|
+
<Tab>
|
|
41
|
+
```bash copy
|
|
42
|
+
npx create-mastra@latest my-mastra-project -- --template coding-agent
|
|
43
|
+
```
|
|
44
|
+
</Tab>
|
|
45
|
+
<Tab>
|
|
46
|
+
```bash copy
|
|
47
|
+
yarn dlx create-mastra@latest --template coding-agent
|
|
48
|
+
```
|
|
49
|
+
</Tab>
|
|
50
|
+
<Tab>
|
|
51
|
+
```bash copy
|
|
52
|
+
pnpm create mastra@latest --template coding-agent
|
|
53
|
+
```
|
|
54
|
+
</Tab>
|
|
55
|
+
<Tab>
|
|
56
|
+
```bash copy
|
|
57
|
+
bun create mastra@latest --template coding-agent
|
|
58
|
+
```
|
|
59
|
+
</Tab>
|
|
60
|
+
</Tabs>
|
|
61
|
+
|
|
62
|
+
Check out the [full list](https://mastra.ai/api/templates.json) of templates and use the `slug` as input to the `--template` CLI flag.
|
|
63
|
+
|
|
64
|
+
You can also use any GitHub repo as a template (it has to be a valid Mastra project):
|
|
65
|
+
|
|
12
66
|
```bash
|
|
13
|
-
create-mastra
|
|
67
|
+
npx create-mastra@latest my-mastra-project -- --template mastra-ai/template-coding-agent
|
|
14
68
|
```
|
|
15
69
|
|
|
16
|
-
##
|
|
70
|
+
## CLI flags
|
|
71
|
+
|
|
72
|
+
Instead of an interactive prompt you can also define these CLI flags.
|
|
17
73
|
|
|
18
74
|
<PropertiesTable
|
|
19
75
|
content={[
|
|
@@ -33,7 +89,7 @@ create-mastra [options]
|
|
|
33
89
|
{
|
|
34
90
|
name: "--default",
|
|
35
91
|
type: "boolean",
|
|
36
|
-
description: "Quick start with defaults(src, OpenAI, no examples)",
|
|
92
|
+
description: "Quick start with defaults (src, OpenAI, no examples)",
|
|
37
93
|
isOptional: true,
|
|
38
94
|
},
|
|
39
95
|
{
|