@mastra/mcp-docs-server 0.0.3 → 0.0.4-alpha.0
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/%40mastra%2Fastra.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fcomposio.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Frag.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fstabilityai.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +19 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +19 -19
- package/.docs/organized/changelogs/create-mastra.md +16 -16
- package/.docs/organized/changelogs/mastra.md +29 -29
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -1
- package/.docs/raw/agents/02-adding-tools.mdx +6 -0
- package/.docs/raw/agents/02a-mcp-guide.mdx +192 -0
- package/.docs/raw/agents/03-adding-voice.mdx +8 -8
- package/.docs/raw/evals/00-overview.mdx +2 -2
- package/.docs/raw/evals/03-running-in-ci.mdx +7 -4
- package/.docs/raw/getting-started/mcp-docs-server.mdx +5 -2
- package/.docs/raw/guides/04-research-assistant.mdx +273 -0
- package/.docs/raw/local-dev/mastra-dev.mdx +2 -2
- package/.docs/raw/rag/overview.mdx +3 -3
- package/.docs/raw/rag/retrieval.mdx +7 -4
- package/.docs/raw/rag/vector-databases.mdx +107 -40
- package/.docs/raw/reference/client-js/workflows.mdx +1 -0
- package/.docs/raw/reference/rag/libsql.mdx +3 -3
- package/.docs/raw/reference/tools/client.mdx +1 -1
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -1
- package/.docs/raw/reference/voice/sarvam.mdx +260 -0
- package/.docs/raw/reference/workflows/snapshots.mdx +204 -0
- package/.docs/raw/voice/overview.mdx +135 -0
- package/.docs/raw/voice/speech-to-text.mdx +45 -0
- package/.docs/raw/voice/text-to-speech.mdx +52 -0
- package/.docs/raw/voice/voice-to-voice.mdx +310 -0
- package/.docs/raw/workflows/dynamic-workflows.mdx +4 -0
- package/.docs/raw/workflows/steps.mdx +12 -2
- package/.docs/raw/workflows/suspend-and-resume.mdx +71 -1
- package/.docs/raw/workflows/variables.mdx +23 -3
- package/package.json +2 -2
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/voice-speechify
|
|
2
2
|
|
|
3
|
+
## 0.1.8-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [fb68a80]
|
|
8
|
+
- Updated dependencies [b56a681]
|
|
9
|
+
- Updated dependencies [248cb07]
|
|
10
|
+
- @mastra/core@0.6.4-alpha.0
|
|
11
|
+
|
|
12
|
+
## 0.1.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 404640e: AgentNetwork changeset
|
|
17
|
+
- Updated dependencies [404640e]
|
|
18
|
+
- Updated dependencies [3bce733]
|
|
19
|
+
- @mastra/core@0.6.3
|
|
20
|
+
|
|
3
21
|
## 0.1.7-alpha.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -281,22 +299,4 @@
|
|
|
281
299
|
|
|
282
300
|
### Patch Changes
|
|
283
301
|
|
|
284
|
-
|
|
285
|
-
- Updated dependencies [0d185b1]
|
|
286
|
-
- Updated dependencies [ed55f1d]
|
|
287
|
-
- Updated dependencies [06aa827]
|
|
288
|
-
- Updated dependencies [0fd78ac]
|
|
289
|
-
- Updated dependencies [2512a93]
|
|
290
|
-
- Updated dependencies [e62de74]
|
|
291
|
-
- Updated dependencies [0d25b75]
|
|
292
|
-
- Updated dependencies [fd14a3f]
|
|
293
|
-
- Updated dependencies [8d13b14]
|
|
294
|
-
- Updated dependencies [3f369a2]
|
|
295
|
-
- Updated dependencies [3ee4831]
|
|
296
|
-
- Updated dependencies [4d4e1e1]
|
|
297
|
-
- Updated dependencies [bb4f447]
|
|
298
|
-
- Updated dependencies [108793c]
|
|
299
|
-
- Updated dependencies [5f28f44]
|
|
300
|
-
- Updated dependencies [dabecf4]
|
|
301
|
-
|
|
302
|
-
... 104 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 122 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
+
## 0.2.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 933ea4d: Fix messages in thread not showing latest when switching between threads
|
|
8
|
+
- 9cba774: Fix new thread title not reflecting until refresh or new message is sent
|
|
9
|
+
- 248cb07: Allow ai-sdk Message type for messages in agent generate and stream
|
|
10
|
+
Fix sidebar horizontal overflow in playground
|
|
11
|
+
|
|
12
|
+
## 0.2.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 404640e: AgentNetwork changeset
|
|
17
|
+
|
|
3
18
|
## 0.2.1-alpha.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -283,20 +298,5 @@
|
|
|
283
298
|
|
|
284
299
|
## 0.1.0-alpha.39
|
|
285
300
|
|
|
286
|
-
### Patch Changes
|
|
287
|
-
|
|
288
|
-
- b97ca96: Tracing into default storage
|
|
289
|
-
- fee6d63: Republish
|
|
290
|
-
|
|
291
|
-
## 0.1.0-alpha.38
|
|
292
|
-
|
|
293
|
-
### Patch Changes
|
|
294
|
-
|
|
295
|
-
- 4f1d1a1: Enforce types ann cleanup package.json
|
|
296
|
-
|
|
297
|
-
## 0.1.0-alpha.37
|
|
298
|
-
|
|
299
|
-
### Patch Changes
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 268 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.4.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 933ea4d: Fix messages in thread not showing latest when switching between threads
|
|
8
|
+
- 9cba774: Fix new thread title not reflecting until refresh or new message is sent
|
|
9
|
+
- 248cb07: Allow ai-sdk Message type for messages in agent generate and stream
|
|
10
|
+
Fix sidebar horizontal overflow in playground
|
|
11
|
+
- Updated dependencies [e764fd1]
|
|
12
|
+
- Updated dependencies [fb68a80]
|
|
13
|
+
- Updated dependencies [e764fd1]
|
|
14
|
+
- Updated dependencies [05ef3e0]
|
|
15
|
+
- Updated dependencies [95c5745]
|
|
16
|
+
- Updated dependencies [b56a681]
|
|
17
|
+
- Updated dependencies [248cb07]
|
|
18
|
+
- @mastra/deployer@0.2.4-alpha.0
|
|
19
|
+
- @mastra/core@0.6.4-alpha.0
|
|
20
|
+
|
|
21
|
+
## 0.4.2
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 404640e: AgentNetwork changeset
|
|
26
|
+
- Updated dependencies [404640e]
|
|
27
|
+
- Updated dependencies [3bce733]
|
|
28
|
+
- @mastra/deployer@0.2.3
|
|
29
|
+
- @mastra/core@0.6.3
|
|
30
|
+
|
|
3
31
|
## 0.4.2-alpha.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -270,33 +298,5 @@
|
|
|
270
298
|
|
|
271
299
|
## 0.3.0-alpha.10
|
|
272
300
|
|
|
273
|
-
### Minor Changes
|
|
274
|
-
|
|
275
|
-
- dd7a09a: Added new MCPConfiguration class for managing multiple MCP server tools/toolsets. Fixed a bug where MCPClient env would overwrite PATH env var. Fixed a bug where MCP servers would be killed non-gracefully leading to printing huge errors on every code save when running mastra dev
|
|
276
|
-
|
|
277
|
-
### Patch Changes
|
|
278
|
-
|
|
279
|
-
- Updated dependencies [a910463]
|
|
280
|
-
- @mastra/core@0.5.0-alpha.10
|
|
281
|
-
- @mastra/deployer@0.1.8-alpha.10
|
|
282
|
-
|
|
283
|
-
## 0.2.9-alpha.9
|
|
284
|
-
|
|
285
|
-
### Patch Changes
|
|
286
|
-
|
|
287
|
-
- Updated dependencies [e9fbac5]
|
|
288
|
-
- Updated dependencies [1e8bcbc]
|
|
289
|
-
- Updated dependencies [aeb5e36]
|
|
290
|
-
- Updated dependencies [f2301de]
|
|
291
|
-
- @mastra/deployer@0.1.8-alpha.9
|
|
292
|
-
- @mastra/core@0.5.0-alpha.9
|
|
293
|
-
|
|
294
|
-
## 0.2.9-alpha.8
|
|
295
|
-
|
|
296
|
-
### Patch Changes
|
|
297
|
-
|
|
298
|
-
- Updated dependencies [506f1d5]
|
|
299
|
-
- @mastra/core@0.5.0-alpha.8
|
|
300
|
-
- @mastra/deployer@0.1.8-alpha.8
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 2074 more lines hidden. See full changelog in package directory.
|
|
@@ -222,3 +222,9 @@ Tools are more likely to be used effectively when:
|
|
|
222
222
|
- Unclear parameter descriptions or missing examples
|
|
223
223
|
|
|
224
224
|
Following these practices helps ensure your tools are discoverable and usable by agents while maintaining clean separation between purpose (main description) and implementation details (parameter schemas).
|
|
225
|
+
|
|
226
|
+
## Model Context Protocol (MCP) Tools
|
|
227
|
+
|
|
228
|
+
Mastra also supports tools from MCP-compatible servers through the `@mastra/mcp` package. MCP provides a standardized way for AI models to discover and interact with external tools and resources. This makes it easy to integrate third-party tools into your agents without writing custom integrations.
|
|
229
|
+
|
|
230
|
+
For detailed information about using MCP tools, including configuration options and best practices, see our [MCP guide](/docs/agents/02a-mcp-guide).
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Using MCP With Mastra | Agents | Mastra Docs"
|
|
3
|
+
description: "Use MCP in Mastra to integrate third party tools and resources in your AI agents."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using MCP With Mastra
|
|
7
|
+
|
|
8
|
+
[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is a standardized way for AI models to discover and interact with external tools and resources.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
MCP in Mastra provides a standardized way to connect to tool servers and supports both stdio and SSE-based connections.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Using pnpm:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add @mastra/mcp@latest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Using npm:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @mastra/mcp@latest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Using MCP in Your Code
|
|
29
|
+
|
|
30
|
+
The `MCPConfiguration` class provides a way to manage multiple tool servers in your Mastra applications without managing multiple MCP clients. You can configure both stdio-based and SSE-based servers:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { MCPConfiguration } from "@mastra/mcp";
|
|
34
|
+
import { Agent } from "@mastra/core/agent";
|
|
35
|
+
import { openai } from "@ai-sdk/openai";
|
|
36
|
+
|
|
37
|
+
const mcp = new MCPConfiguration({
|
|
38
|
+
servers: {
|
|
39
|
+
// stdio example
|
|
40
|
+
sequential: {
|
|
41
|
+
name: "sequential-thinking",
|
|
42
|
+
server: {
|
|
43
|
+
command: "npx",
|
|
44
|
+
args: ["-y", "@modelcontextprotocol/server-sequential-thinking"],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
// SSE example
|
|
48
|
+
weather: {
|
|
49
|
+
url: new URL("http://localhost:8080/sse"),
|
|
50
|
+
requestInit: {
|
|
51
|
+
headers: {
|
|
52
|
+
Authorization: "Bearer your-token",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Tools vs Toolsets
|
|
61
|
+
|
|
62
|
+
The `MCPConfiguration` class provides two ways to access MCP tools, each suited for different use cases:
|
|
63
|
+
|
|
64
|
+
#### Using Tools (`getTools()`)
|
|
65
|
+
|
|
66
|
+
Use this approach when:
|
|
67
|
+
|
|
68
|
+
- You have a single MCP connection
|
|
69
|
+
- The tools are used by a single user/context
|
|
70
|
+
- Tool configuration (API keys, credentials) remains constant
|
|
71
|
+
- You want to initialize an Agent with a fixed set of tools
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
const agent = new Agent({
|
|
75
|
+
name: "CLI Assistant",
|
|
76
|
+
instructions: "You help users with CLI tasks",
|
|
77
|
+
model: openai("gpt-4o-mini"),
|
|
78
|
+
tools: await mcp.getTools(), // Tools are fixed at agent creation
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Using Toolsets (`getToolsets()`)
|
|
83
|
+
|
|
84
|
+
Use this approach when:
|
|
85
|
+
|
|
86
|
+
- You need per-request tool configuration
|
|
87
|
+
- Tools need different credentials per user
|
|
88
|
+
- Running in a multi-user environment (web app, API, etc)
|
|
89
|
+
- Tool configuration needs to change dynamically
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const mcp = new MCPConfiguration({
|
|
93
|
+
servers: {
|
|
94
|
+
example: {
|
|
95
|
+
command: "npx",
|
|
96
|
+
args: ["-y", "@example/fakemcp"],
|
|
97
|
+
env: {
|
|
98
|
+
API_KEY: "your-api-key",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Get the current toolsets configured for this user
|
|
105
|
+
const toolsets = await mcp.getToolsets();
|
|
106
|
+
|
|
107
|
+
// Use the agent with user-specific tool configurations
|
|
108
|
+
const response = await agent.stream(
|
|
109
|
+
"What's new in Mastra and how's the weather?",
|
|
110
|
+
{
|
|
111
|
+
toolsets,
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## MCP Registries
|
|
117
|
+
|
|
118
|
+
MCP servers can be accessed through registries that provide curated collections of tools. Here's how to use tools from different registries:
|
|
119
|
+
|
|
120
|
+
### Composio.dev Registry
|
|
121
|
+
|
|
122
|
+
[Composio.dev](https://composio.dev) provides a registry of [SSE-based MCP servers](https://mcp.composio.dev) that can be easily integrated with Mastra. The SSE URL that's generated for Cursor is compatible with Mastra - you can use it directly in your configuration:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const mcp = new MCPConfiguration({
|
|
126
|
+
servers: {
|
|
127
|
+
googleSheets: {
|
|
128
|
+
url: new URL("https://mcp.composio.dev/googlesheets/[private-url-path]"),
|
|
129
|
+
},
|
|
130
|
+
gmail: {
|
|
131
|
+
url: new URL("https://mcp.composio.dev/gmail/[private-url-path]"),
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
When using Composio-provided tools, you can authenticate with services (like Google Sheets or Gmail) directly through conversation with your agent. The tools include authentication capabilities that guide you through the process while chatting.
|
|
138
|
+
|
|
139
|
+
Note: The Composio.dev integration is best suited for single-user scenarios like personal automation, as the SSE URL is tied to your account and can't be used for multiple users. Each URL represents a single account's authentication context.
|
|
140
|
+
|
|
141
|
+
### Smithery.ai Registry
|
|
142
|
+
|
|
143
|
+
[Smithery.ai](https://smithery.ai) provides a registry of MCP servers that you can easily use with Mastra:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// Unix/Mac
|
|
147
|
+
const mcp = new MCPConfiguration({
|
|
148
|
+
servers: {
|
|
149
|
+
sequentialThinking: {
|
|
150
|
+
command: "npx",
|
|
151
|
+
args: [
|
|
152
|
+
"-y",
|
|
153
|
+
"@smithery/cli@latest",
|
|
154
|
+
"run",
|
|
155
|
+
"@smithery-ai/server-sequential-thinking",
|
|
156
|
+
"--config",
|
|
157
|
+
"{}",
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Windows
|
|
164
|
+
const mcp = new MCPConfiguration({
|
|
165
|
+
servers: {
|
|
166
|
+
sequentialThinking: {
|
|
167
|
+
command: "cmd",
|
|
168
|
+
args: [
|
|
169
|
+
"/c",
|
|
170
|
+
"npx",
|
|
171
|
+
"-y",
|
|
172
|
+
"@smithery/cli@latest",
|
|
173
|
+
"run",
|
|
174
|
+
"@smithery-ai/server-sequential-thinking",
|
|
175
|
+
"--config",
|
|
176
|
+
"{}",
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This example is adapted from the Claude integration example in the Smithery documentation.
|
|
184
|
+
|
|
185
|
+
## Using the Mastra Documentation Server
|
|
186
|
+
|
|
187
|
+
Looking to use Mastra's MCP documentation server in your IDE? Check out our [MCP Documentation Server guide](/docs/getting-started/mcp-docs-server) to get started.
|
|
188
|
+
|
|
189
|
+
## Next Steps
|
|
190
|
+
|
|
191
|
+
- Learn more about [MCPConfiguration](/docs/reference/tools/mcp-configuration)
|
|
192
|
+
- Check out our [example projects](/examples) that use MCP
|
|
@@ -25,7 +25,7 @@ export const agent = new Agent({
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// The agent can now use voice for interaction
|
|
28
|
-
await agent.speak("Hello, I'm your AI assistant!");
|
|
28
|
+
await agent.voice.speak("Hello, I'm your AI assistant!");
|
|
29
29
|
|
|
30
30
|
// Read audio file and transcribe
|
|
31
31
|
const audioFilePath = path.join(process.cwd(), "/audio.m4a");
|
|
@@ -135,17 +135,17 @@ export const agent = new Agent({
|
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
// Establish a WebSocket connection
|
|
138
|
-
await voice.connect();
|
|
138
|
+
await agent.voice.connect();
|
|
139
139
|
|
|
140
140
|
// Start a conversation
|
|
141
|
-
|
|
141
|
+
agent.voice.speak("Hello, I'm your AI assistant!");
|
|
142
142
|
|
|
143
143
|
// Stream audio from a microphone
|
|
144
144
|
const microphoneStream = getMicrophoneStream();
|
|
145
|
-
|
|
145
|
+
agent.voice.send(microphoneStream);
|
|
146
146
|
|
|
147
147
|
// When done with the conversation
|
|
148
|
-
voice.close();
|
|
148
|
+
agent.voice.close();
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
### Event System
|
|
@@ -154,17 +154,17 @@ The realtime voice provider emits several events you can listen for:
|
|
|
154
154
|
|
|
155
155
|
```typescript
|
|
156
156
|
// Listen for speech audio data sent from voice provider
|
|
157
|
-
voice.on('speaking', ({ audio }) => {
|
|
157
|
+
agent.voice.on('speaking', ({ audio }) => {
|
|
158
158
|
// audio contains ReadableStream or Int16Array audio data
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
// Listen for transcribed text sent from both voice provider and user
|
|
162
|
-
voice.on('writing', ({ text, role }) => {
|
|
162
|
+
agent.voice.on('writing', ({ text, role }) => {
|
|
163
163
|
console.log(`${role} said: ${text}`);
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
// Listen for errors
|
|
167
|
-
voice.on('error', (error) => {
|
|
167
|
+
agent.voice.on('error', (error) => {
|
|
168
168
|
console.error('Voice error:', error);
|
|
169
169
|
});
|
|
170
170
|
```
|
|
@@ -81,8 +81,8 @@ Once you're hitting your targets:
|
|
|
81
81
|
3. Test edge cases - Add examples that cover unusual scenarios
|
|
82
82
|
4. Fine-tune - Look for ways to improve efficiency
|
|
83
83
|
|
|
84
|
-
See [Textual Evals](/docs/evals/textual-evals) for more info on what evals can do.
|
|
84
|
+
See [Textual Evals](/docs/evals/01-textual-evals) for more info on what evals can do.
|
|
85
85
|
|
|
86
86
|
For more info on how to create your own evals, see the [Custom Evals](/docs/evals/02-custom-eval) guide.
|
|
87
87
|
|
|
88
|
-
For running evals in your CI pipeline, see the [Running in CI](/docs/evals/running-in-ci) guide.
|
|
88
|
+
For running evals in your CI pipeline, see the [Running in CI](/docs/evals/03-running-in-ci) guide.
|
|
@@ -13,7 +13,8 @@ We support any testing framework that supports ESM modules. For example, you can
|
|
|
13
13
|
|
|
14
14
|
```typescript copy showLineNumbers filename="src/mastra/agents/index.test.ts"
|
|
15
15
|
import { describe, it, expect } from 'vitest';
|
|
16
|
-
import { evaluate } from
|
|
16
|
+
import { evaluate } from "@mastra/evals";
|
|
17
|
+
import { ToneConsistencyMetric } from "@mastra/evals/nlp";
|
|
17
18
|
import { myAgent } from './index';
|
|
18
19
|
|
|
19
20
|
describe('My Agent', () => {
|
|
@@ -32,7 +33,7 @@ You will need to configure a testSetup and globalSetup script for your testing f
|
|
|
32
33
|
|
|
33
34
|
### Vitest Setup
|
|
34
35
|
|
|
35
|
-
Add these files to your project to run evals in your CI/CD pipeline
|
|
36
|
+
Add these files to your project to run evals in your CI/CD pipeline:
|
|
36
37
|
|
|
37
38
|
```typescript copy showLineNumbers filename="globalSetup.ts"
|
|
38
39
|
import { globalSetup } from '@mastra/evals';
|
|
@@ -64,9 +65,11 @@ export default defineConfig({
|
|
|
64
65
|
|
|
65
66
|
## Storage Configuration
|
|
66
67
|
|
|
67
|
-
To store eval results in Mastra Storage:
|
|
68
|
+
To store eval results in Mastra Storage and capture results in the Mastra dashboard:
|
|
68
69
|
|
|
69
|
-
```typescript
|
|
70
|
+
```typescript copy showLineNumbers filename="testSetup.ts"
|
|
71
|
+
import { beforeAll } from 'vitest';
|
|
72
|
+
import { attachListeners } from '@mastra/evals';
|
|
70
73
|
import { mastra } from './your-mastra-setup';
|
|
71
74
|
|
|
72
75
|
beforeAll(async () => {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "Using with Cursor/Windsurf | Getting Started | Mastra Docs"
|
|
3
3
|
description: "Learn how to use the Mastra MCP documentation server in your IDE to turn it into an agentic Mastra expert."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
import YouTube from "../../../components/youtube";
|
|
7
|
+
|
|
6
8
|
# Mastra Tools for your agentic IDE
|
|
7
9
|
|
|
8
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.
|
|
9
11
|
|
|
10
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.
|
|
11
13
|
|
|
14
|
+
<YouTube id="vciV57lF0og" />
|
|
15
|
+
|
|
12
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.
|
|
13
17
|
|
|
14
18
|
## How it works
|
|
@@ -135,4 +139,3 @@ Track updates for Mastra and `@mastra/*` packages:
|
|
|
135
139
|
2. **Tool Calls Failing**
|
|
136
140
|
- Restart the MCP server and/or your IDE
|
|
137
141
|
- Update to the latest version of your IDE
|
|
138
|
-
|