@mastra/mcp-docs-server 0.13.2-alpha.0 → 0.13.2-alpha.1
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%2Fagui.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Flance.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +11 -0
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Frag.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +14 -14
- package/.docs/organized/changelogs/create-mastra.md +7 -7
- package/.docs/organized/changelogs/mastra.md +27 -27
- package/.docs/organized/code-examples/a2a.md +1 -1
- package/.docs/organized/code-examples/agent-network.md +125 -7
- package/.docs/organized/code-examples/agent.md +1 -1
- package/.docs/organized/code-examples/agui.md +4 -4
- package/.docs/organized/code-examples/ai-sdk-useChat.md +6 -6
- package/.docs/organized/code-examples/assistant-ui.md +5 -5
- package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +5 -5
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +5 -5
- package/.docs/organized/code-examples/client-side-tools.md +6 -6
- package/.docs/organized/code-examples/crypto-chatbot.md +4 -4
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -1
- package/.docs/organized/code-examples/fireworks-r1.md +1 -1
- package/.docs/organized/code-examples/mcp-configuration.md +2 -2
- package/.docs/organized/code-examples/mcp-registry-registry.md +1 -1
- package/.docs/organized/code-examples/memory-per-resource-example.md +236 -0
- package/.docs/organized/code-examples/memory-with-mem0.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/openapi-spec-writer.md +5 -5
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/organized/code-examples/stock-price-tool.md +1 -1
- package/.docs/organized/code-examples/weather-agent.md +1 -1
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +53 -10
- package/.docs/raw/mastra-cloud/dashboard.mdx +100 -0
- package/.docs/raw/mastra-cloud/observability.mdx +24 -138
- package/.docs/raw/mastra-cloud/overview.mdx +50 -42
- package/.docs/raw/mastra-cloud/setting-up.mdx +51 -87
- package/.docs/raw/memory/overview.mdx +4 -0
- package/.docs/raw/memory/working-memory.mdx +88 -1
- package/.docs/raw/observability/nextjs-tracing.mdx +2 -2
- package/.docs/raw/reference/storage/libsql.mdx +1 -0
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -0
- package/.docs/raw/reference/workflows/sleep.mdx +43 -0
- package/.docs/raw/reference/workflows/sleepUntil.mdx +43 -0
- package/.docs/raw/reference/workflows/waitForEvent.mdx +49 -0
- package/.docs/raw/storage/overview.mdx +50 -1
- package/.docs/raw/tools-mcp/mcp-overview.mdx +52 -0
- package/.docs/raw/workflows/inngest-workflow.mdx +1 -1
- package/.docs/raw/workflows/pausing-execution.mdx +60 -0
- package/package.json +6 -6
- package/.docs/raw/mastra-cloud/deploying.mdx +0 -142
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"tailwind-merge": "^2.6.0",
|
|
71
71
|
"tailwindcss-animate": "^1.0.7",
|
|
72
72
|
"usehooks-ts": "^3.1.1",
|
|
73
|
-
"zod": "^3.25.
|
|
73
|
+
"zod": "^3.25.67"
|
|
74
74
|
},
|
|
75
75
|
"pnpm": {
|
|
76
76
|
"overrides": {
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
"@types/d3-scale": "^4.0.9",
|
|
87
87
|
"@types/node": "^22.15.29",
|
|
88
88
|
"@types/pdf-parse": "^1.1.4",
|
|
89
|
-
"@types/react": "^19.1",
|
|
90
|
-
"@types/react-dom": "^19.1",
|
|
89
|
+
"@types/react": "^19.1.8",
|
|
90
|
+
"@types/react-dom": "^19.1.6",
|
|
91
91
|
"drizzle-kit": "^0.31.0",
|
|
92
|
-
"eslint": "^9.
|
|
92
|
+
"eslint": "^9.29.0",
|
|
93
93
|
"eslint-config-next": "15.3.3",
|
|
94
94
|
"eslint-config-prettier": "^9.1.0",
|
|
95
95
|
"eslint-import-resolver-typescript": "^3.10.1",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@mastra/core": "latest",
|
|
20
20
|
"@mastra/mcp": "latest",
|
|
21
21
|
"@mastra/memory": "latest",
|
|
22
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.13.0",
|
|
23
23
|
"chalk": "^5.4.1",
|
|
24
|
-
"zod": "^3.25.
|
|
24
|
+
"zod": "^3.25.67",
|
|
25
25
|
"zod-to-json-schema": "^3.24.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
### package.json
|
|
2
|
+
```json
|
|
3
|
+
{
|
|
4
|
+
"name": "memory-per-resource-example",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"private": true,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "tsx src/example.ts"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@ai-sdk/openai": "^0.0.68",
|
|
13
|
+
"@mastra/core": "latest",
|
|
14
|
+
"@mastra/memory": "latest",
|
|
15
|
+
"@mastra/libsql": "latest",
|
|
16
|
+
"chalk": "^5.3.0",
|
|
17
|
+
"dotenv": "^16.4.7",
|
|
18
|
+
"ora": "^8.1.1",
|
|
19
|
+
"tsx": "^4.19.2"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^20.19.0",
|
|
23
|
+
"typescript": "^5.8.3"
|
|
24
|
+
},
|
|
25
|
+
"pnpm": {
|
|
26
|
+
"overrides": {
|
|
27
|
+
"@mastra/core": "link:../../packages/core",
|
|
28
|
+
"@mastra/memory": "link:../../packages/memory",
|
|
29
|
+
"@mastra/libsql": "link:../../stores/libsql"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### example.ts
|
|
37
|
+
```typescript
|
|
38
|
+
import { maskStreamTags } from '@mastra/core/utils';
|
|
39
|
+
import chalk from 'chalk';
|
|
40
|
+
import { randomUUID } from 'crypto';
|
|
41
|
+
import ora from 'ora';
|
|
42
|
+
import Readline from 'readline';
|
|
43
|
+
|
|
44
|
+
import 'dotenv/config';
|
|
45
|
+
|
|
46
|
+
import { mastra } from './mastra';
|
|
47
|
+
|
|
48
|
+
const agent = mastra.getAgent('assistantAgent');
|
|
49
|
+
|
|
50
|
+
// 🆕 EXAMPLE: Per-Resource Working Memory
|
|
51
|
+
// This demonstrates how working memory persists across different conversation threads
|
|
52
|
+
// for the same user (resourceId), but is separate for different users.
|
|
53
|
+
|
|
54
|
+
console.log(chalk.bold.blue('\n🆕 Per-Resource Working Memory Example\n'));
|
|
55
|
+
console.log(chalk.gray('This example shows how working memory persists across conversation threads'));
|
|
56
|
+
console.log(chalk.gray('for the same user, but stays separate for different users.\n'));
|
|
57
|
+
|
|
58
|
+
// Simulate different users
|
|
59
|
+
const USERS = {
|
|
60
|
+
alice: 'user-alice-123',
|
|
61
|
+
bob: 'user-bob-456',
|
|
62
|
+
demo: 'demo-user-789',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Let user choose which user to simulate
|
|
66
|
+
console.log(chalk.yellow('Choose a user to simulate:'));
|
|
67
|
+
console.log(chalk.cyan('1. Alice (user-alice-123)'));
|
|
68
|
+
console.log(chalk.cyan('2. Bob (user-bob-456)'));
|
|
69
|
+
console.log(chalk.cyan('3. Demo User (demo-user-789)'));
|
|
70
|
+
console.log(chalk.gray('4. Or just press Enter to use a random user\n'));
|
|
71
|
+
|
|
72
|
+
const rl = Readline.createInterface({
|
|
73
|
+
input: process.stdin,
|
|
74
|
+
output: process.stdout,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const userChoice = await new Promise<string>(resolve => {
|
|
78
|
+
rl.question(chalk.yellow('Enter choice (1-4 or Enter): '), answer => {
|
|
79
|
+
resolve(answer.trim());
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
let resourceId: string;
|
|
84
|
+
let userName: string;
|
|
85
|
+
|
|
86
|
+
switch (userChoice) {
|
|
87
|
+
case '1':
|
|
88
|
+
resourceId = USERS.alice;
|
|
89
|
+
userName = 'Alice';
|
|
90
|
+
break;
|
|
91
|
+
case '2':
|
|
92
|
+
resourceId = USERS.bob;
|
|
93
|
+
userName = 'Bob';
|
|
94
|
+
break;
|
|
95
|
+
case '3':
|
|
96
|
+
resourceId = USERS.demo;
|
|
97
|
+
userName = 'Demo User';
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
resourceId = `user-${randomUUID()}`;
|
|
101
|
+
userName = 'Random User';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Always generate a new thread ID to demonstrate cross-thread persistence
|
|
105
|
+
const threadId = randomUUID();
|
|
106
|
+
|
|
107
|
+
console.log(chalk.green(`\n✅ Simulating: ${userName}`));
|
|
108
|
+
console.log(chalk.gray(`📧 Resource ID: ${resourceId}`));
|
|
109
|
+
console.log(chalk.gray(`🧵 Thread ID: ${threadId}`));
|
|
110
|
+
console.log(chalk.bold.yellow('\n💡 TIP: Run this example multiple times with the same user choice'));
|
|
111
|
+
console.log(chalk.bold.yellow(' to see how working memory persists across conversation threads!\n'));
|
|
112
|
+
|
|
113
|
+
async function logResponse(res: Awaited<ReturnType<typeof agent.stream>>) {
|
|
114
|
+
console.log(chalk.blue('\n🤖 Assistant:'));
|
|
115
|
+
|
|
116
|
+
const memorySpinner = ora('💾 Updating memory...');
|
|
117
|
+
|
|
118
|
+
// Mask working memory updates with a spinner
|
|
119
|
+
const maskedStream = maskStreamTags(res.textStream, 'working_memory', {
|
|
120
|
+
onStart: () => memorySpinner.start(),
|
|
121
|
+
onEnd: () => {
|
|
122
|
+
if (memorySpinner.isSpinning) {
|
|
123
|
+
memorySpinner.succeed(chalk.green('💾 Memory updated!'));
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
for await (const chunk of maskedStream) {
|
|
129
|
+
process.stdout.write(chunk);
|
|
130
|
+
}
|
|
131
|
+
console.log('\n');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function main() {
|
|
135
|
+
// Start the conversation
|
|
136
|
+
await logResponse(
|
|
137
|
+
await agent.stream(
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
role: 'system',
|
|
141
|
+
content: `New conversation thread started at ${new Date().toISOString()}.
|
|
142
|
+
This may be a returning user - check your working memory to see if you know them already.
|
|
143
|
+
If this is a new user, introduce yourself and learn about them.
|
|
144
|
+
If this is a returning user, greet them warmly and reference what you remember!`,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
{ threadId, resourceId },
|
|
148
|
+
),
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// Interactive chat loop
|
|
152
|
+
while (true) {
|
|
153
|
+
const userInput: string = await new Promise(resolve => {
|
|
154
|
+
rl.question(chalk.yellow('\n💬 You: '), answer => {
|
|
155
|
+
resolve(answer);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
if (userInput.toLowerCase() === 'exit' || userInput.toLowerCase() === 'quit') {
|
|
160
|
+
console.log(chalk.gray('\n👋 Goodbye! Run the example again to see memory persistence!\n'));
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
await logResponse(await agent.stream(userInput, { threadId, resourceId }));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
rl.close();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
main().catch(console.error);
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### mastra/agents/index.ts
|
|
175
|
+
```typescript
|
|
176
|
+
import { openai } from '@ai-sdk/openai';
|
|
177
|
+
import { Agent } from '@mastra/core/agent';
|
|
178
|
+
import { Memory } from '@mastra/memory';
|
|
179
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
180
|
+
|
|
181
|
+
// Create LibSQL storage for persistent per-resource working memory
|
|
182
|
+
const storage = new LibSQLStore({
|
|
183
|
+
url: 'file:./memory-demo.db',
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
export const memory = new Memory({
|
|
187
|
+
storage,
|
|
188
|
+
options: {
|
|
189
|
+
lastMessages: 5,
|
|
190
|
+
workingMemory: {
|
|
191
|
+
enabled: true,
|
|
192
|
+
scope: 'resource', // 🆕 NEW: Per-resource working memory!
|
|
193
|
+
template: `# User Profile
|
|
194
|
+
- **Name**:
|
|
195
|
+
- **Location**:
|
|
196
|
+
- **Interests**:
|
|
197
|
+
- **Preferences**:
|
|
198
|
+
- **Goals**:
|
|
199
|
+
- **Important Notes**:
|
|
200
|
+
`,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export const assistantAgent = new Agent({
|
|
206
|
+
name: 'Personal Assistant',
|
|
207
|
+
instructions: `You are a helpful personal assistant with persistent memory across ALL conversations.
|
|
208
|
+
|
|
209
|
+
🆕 IMPORTANT: You have resource-scoped working memory! This means:
|
|
210
|
+
- Everything you learn about this user persists across ALL conversation threads
|
|
211
|
+
- Even if they start a completely new conversation, you'll remember them
|
|
212
|
+
- You should build up a comprehensive profile of the user over time
|
|
213
|
+
|
|
214
|
+
Always use <working_memory> tags to update what you know about the user:
|
|
215
|
+
- Their name and personal details
|
|
216
|
+
- Their interests and preferences
|
|
217
|
+
- Their goals and what they're working on
|
|
218
|
+
- Any important context from previous conversations
|
|
219
|
+
|
|
220
|
+
When you first meet someone, ask for their name and learn about them. In subsequent conversations (even new threads), greet them by name and reference what you remember!`,
|
|
221
|
+
model: openai('gpt-4o-mini'),
|
|
222
|
+
memory,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### mastra/index.ts
|
|
228
|
+
```typescript
|
|
229
|
+
import { Mastra } from '@mastra/core';
|
|
230
|
+
import { assistantAgent } from './agents';
|
|
231
|
+
|
|
232
|
+
export const mastra = new Mastra({
|
|
233
|
+
agents: { assistantAgent },
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
```
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"clsx": "^2.1.1",
|
|
26
26
|
"lucide-react": "^0.454.0",
|
|
27
27
|
"next": "15.2.4",
|
|
28
|
-
"react": "^19.
|
|
29
|
-
"react-dom": "^19.
|
|
28
|
+
"react": "^19.1.0",
|
|
29
|
+
"react-dom": "^19.1.0",
|
|
30
30
|
"react-syntax-highlighter": "^15.6.1",
|
|
31
31
|
"sharp": "^0.33.5",
|
|
32
32
|
"tailwind-merge": "^2.6.0",
|
|
33
33
|
"tailwindcss-animate": "^1.0.7",
|
|
34
34
|
"vaul": "^1.1.2",
|
|
35
|
-
"zod": "^3.25.
|
|
35
|
+
"zod": "^3.25.67"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@libsql/client": "^0.15.4",
|
|
39
39
|
"@types/js-yaml": "^4.0.9",
|
|
40
40
|
"@types/node": "^20.17.57",
|
|
41
|
-
"@types/react": "^19.
|
|
42
|
-
"@types/react-dom": "^19.
|
|
41
|
+
"@types/react": "^19.1.8",
|
|
42
|
+
"@types/react-dom": "^19.1.6",
|
|
43
43
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
44
44
|
"eslint": "^8.57.1",
|
|
45
45
|
"eslint-config-next": "15.3.3",
|
|
@@ -85,24 +85,24 @@ The current version of the integration leverages `MastraClient` to format Mastra
|
|
|
85
85
|
{/*
|
|
86
86
|
LLM CONTEXT: This Tabs component shows installation commands for the Mastra AGUI package.
|
|
87
87
|
Each tab displays the installation command for that specific package manager.
|
|
88
|
-
This installs the alpha version of @mastra
|
|
89
|
-
All commands install the same @mastra
|
|
88
|
+
This installs the alpha version of @ag-ui/mastra which provides CopilotKit integration capabilities.
|
|
89
|
+
All commands install the same @ag-ui/mastra package but use different package manager syntax.
|
|
90
90
|
*/}
|
|
91
91
|
|
|
92
92
|
<Tabs items={["npm", "yarn", "pnpm"]}>
|
|
93
93
|
<Tabs.Tab>
|
|
94
94
|
```bash copy
|
|
95
|
-
npm install @mastra
|
|
95
|
+
npm install @ag-ui/mastra
|
|
96
96
|
```
|
|
97
97
|
</Tabs.Tab>
|
|
98
98
|
<Tabs.Tab>
|
|
99
99
|
```bash copy
|
|
100
|
-
yarn add @mastra
|
|
100
|
+
yarn add @ag-ui/mastra
|
|
101
101
|
```
|
|
102
102
|
</Tabs.Tab>
|
|
103
103
|
<Tabs.Tab>
|
|
104
104
|
```bash copy
|
|
105
|
-
pnpm add @mastra
|
|
105
|
+
pnpm add @ag-ui/mastra
|
|
106
106
|
```
|
|
107
107
|
</Tabs.Tab>
|
|
108
108
|
</Tabs>
|
|
@@ -114,7 +114,7 @@ import { Mastra } from "@mastra/core/mastra";
|
|
|
114
114
|
import { PinoLogger } from "@mastra/loggers";
|
|
115
115
|
import { LibSQLStore } from "@mastra/libsql";
|
|
116
116
|
import { CopilotRuntime, copilotRuntimeNodeHttpEndpoint, ExperimentalEmptyAdapter } from "@copilotkit/runtime";
|
|
117
|
-
import { registerCopilotKit } from "@mastra
|
|
117
|
+
import { registerCopilotKit } from "@ag-ui/mastra";
|
|
118
118
|
import { weatherAgent } from "./agents/weather-agent";
|
|
119
119
|
|
|
120
120
|
const serviceAdapter = new ExperimentalEmptyAdapter();
|
|
@@ -231,6 +231,7 @@ import {
|
|
|
231
231
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
232
232
|
} from "@copilotkit/runtime";
|
|
233
233
|
import { NextRequest } from "next/server";
|
|
234
|
+
import { MastraAgent } from "@ag-ui/mastra";
|
|
234
235
|
|
|
235
236
|
export const POST = async (req: NextRequest) => {
|
|
236
237
|
// Clone the request before reading the body
|
|
@@ -238,11 +239,52 @@ export const POST = async (req: NextRequest) => {
|
|
|
238
239
|
const body = await clonedReq.json();
|
|
239
240
|
const resourceId = body.resourceId || "TEST";
|
|
240
241
|
|
|
241
|
-
const mastraAgents =
|
|
242
|
-
mastra,
|
|
242
|
+
const mastraAgents = MastraAgent.getLocalAgents({
|
|
243
243
|
resourceId,
|
|
244
|
+
mastra,
|
|
245
|
+
runtimeContext,
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const runtime = new CopilotRuntime({
|
|
249
|
+
agents: mastraAgents,
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
|
|
253
|
+
runtime,
|
|
254
|
+
serviceAdapter: new ExperimentalEmptyAdapter(),
|
|
255
|
+
endpoint: "/api/copilotkit",
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// Use the original request for handleRequest
|
|
259
|
+
return handleRequest(req);
|
|
260
|
+
};
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Using with Mastra Client SDK
|
|
264
|
+
|
|
265
|
+
```typescript copy
|
|
266
|
+
import { MastraClient } from "@mastra/client-js";
|
|
267
|
+
import {
|
|
268
|
+
CopilotRuntime,
|
|
269
|
+
ExperimentalEmptyAdapter,
|
|
270
|
+
copilotRuntimeNextJSAppRouterEndpoint,
|
|
271
|
+
} from "@copilotkit/runtime";
|
|
272
|
+
import { NextRequest } from "next/server";
|
|
273
|
+
import { MastraAgent } from "@ag-ui/mastra";
|
|
274
|
+
|
|
275
|
+
export const POST = async (req: NextRequest) => {
|
|
276
|
+
// Clone the request before reading the body
|
|
277
|
+
const clonedReq = req.clone();
|
|
278
|
+
const body = await clonedReq.json();
|
|
279
|
+
const resourceId = body.resourceId || "TEST";
|
|
280
|
+
|
|
281
|
+
const baseUrl = process.env.MASTRA_BASE_URL || "http://localhost:4111";
|
|
282
|
+
const mastraClient = new MastraClient({
|
|
283
|
+
baseUrl,
|
|
244
284
|
});
|
|
245
285
|
|
|
286
|
+
const mastraAgents = await MastraAgent.getRemoteAgents({ mastraClient });
|
|
287
|
+
|
|
246
288
|
const runtime = new CopilotRuntime({
|
|
247
289
|
agents: mastraAgents,
|
|
248
290
|
});
|
|
@@ -258,7 +300,8 @@ export const POST = async (req: NextRequest) => {
|
|
|
258
300
|
};
|
|
259
301
|
```
|
|
260
302
|
|
|
261
|
-
|
|
303
|
+
|
|
304
|
+
## Using Typed Runtime Context
|
|
262
305
|
|
|
263
306
|
For better type safety, you can specify the type of your runtime context:
|
|
264
307
|
|
|
@@ -266,7 +309,7 @@ For better type safety, you can specify the type of your runtime context:
|
|
|
266
309
|
import { Mastra } from "@mastra/core/mastra";
|
|
267
310
|
import { PinoLogger } from "@mastra/loggers";
|
|
268
311
|
import { LibSQLStore } from "@mastra/libsql";
|
|
269
|
-
import { registerCopilotKit } from "@mastra
|
|
312
|
+
import { registerCopilotKit } from "@ag-ui/mastra";
|
|
270
313
|
import { weatherAgent } from "./agents";
|
|
271
314
|
|
|
272
315
|
// Define your runtime context type
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Understanding the Mastra Cloud Dashboard
|
|
3
|
+
description: Details of each feature available in Mastra Cloud
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { MastraCloudCallout } from '@/components/mastra-cloud-callout'
|
|
7
|
+
|
|
8
|
+
# Navigating the Dashboard
|
|
9
|
+
|
|
10
|
+
This page explains how to navigate the Mastra Cloud dashboard, where you can configure your project, view deployment details, and interact with agents and workflows using the built-in [Playground](/docs/mastra-cloud/dashboard#playground).
|
|
11
|
+
|
|
12
|
+
<MastraCloudCallout />
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
The **Overview** page provides details about your application, including its domain URL, status, latest deployment, and connected agents and workflows.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
Key features:
|
|
21
|
+
|
|
22
|
+
Each project shows its current deployment status, active domains, and environment variables, so you can quickly understand how your application is running.
|
|
23
|
+
|
|
24
|
+
## Deployments
|
|
25
|
+
|
|
26
|
+
The **Deployments** page shows recent builds and gives you quick access to detailed build logs. Click any row to view more information about a specific deployment.
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
Key features:
|
|
31
|
+
|
|
32
|
+
Each deployment includes its current status, the Git branch it was deployed from, and a title generated from the commit hash.
|
|
33
|
+
|
|
34
|
+
## Logs
|
|
35
|
+
|
|
36
|
+
The **Logs** page is where you'll find detailed information to help debug and monitor your application's behavior in the production environment.
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
Key features:
|
|
41
|
+
|
|
42
|
+
Each log includes a severity level and detailed messages showing agent, workflow, and storage activity.
|
|
43
|
+
|
|
44
|
+
## Settings
|
|
45
|
+
|
|
46
|
+
On the **Settings** page you can modify the configuration of your application.
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
Key features:
|
|
51
|
+
|
|
52
|
+
You can manage environment variables, edit key project settings like the name and branch, configure storage with LibSQLStore, and set a stable URL for your endpoints.
|
|
53
|
+
|
|
54
|
+
> Changes to configuration require a new deployment before taking effect.
|
|
55
|
+
|
|
56
|
+
## Playground
|
|
57
|
+
|
|
58
|
+
### Agents
|
|
59
|
+
|
|
60
|
+
On the **Agents** page you'll see all agents used in your application. Click any agent to interact using the chat interface.
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
Key features:
|
|
65
|
+
|
|
66
|
+
Test your agents in real time using the chat interface, review traces of each interaction, and see evaluation scores for every response.
|
|
67
|
+
|
|
68
|
+
### Workflows
|
|
69
|
+
|
|
70
|
+
On the **Workflows** page you'll see all workflows used in your application. Click any workflow to interact using the runner interface.
|
|
71
|
+
|
|
72
|
+

|
|
73
|
+
|
|
74
|
+
Key features:
|
|
75
|
+
|
|
76
|
+
Visualize your workflow with a step-by-step graph, view execution traces, and run workflows directly using the built-in runner.
|
|
77
|
+
|
|
78
|
+
### Tools
|
|
79
|
+
|
|
80
|
+
On the **Tools** page you'll see all tools used by your agents. Click any tool to interact using the input interface.
|
|
81
|
+
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
Key features:
|
|
85
|
+
|
|
86
|
+
Test your tools by providing an input that matches the schema and viewing the structured output.
|
|
87
|
+
|
|
88
|
+
## MCP Servers
|
|
89
|
+
|
|
90
|
+
The **MCP Servers** page lists all MCP Servers included in your application. Click any MCP Server for more information.
|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+
Key features:
|
|
95
|
+
|
|
96
|
+
Each MCP Server includes API endpoints for HTTP and SSE, along with IDE configuration snippets for tools like Cursor and Windsurf.
|
|
97
|
+
|
|
98
|
+
## Next steps
|
|
99
|
+
|
|
100
|
+
- [Understanding Tracing and Logs](/docs/mastra-cloud/observability)
|