@mastra/mcp-docs-server 0.13.12-alpha.2 → 0.13.12-alpha.4
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%2Fclickhouse.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +44 -44
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Frag.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +24 -24
- package/.docs/organized/changelogs/create-mastra.md +9 -9
- package/.docs/organized/changelogs/mastra.md +42 -42
- package/.docs/organized/code-examples/agent.md +75 -11
- package/.docs/raw/deployment/server-deployment.mdx +57 -27
- package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +4 -7
- package/.docs/raw/frameworks/servers/express.mdx +135 -143
- package/.docs/raw/reference/agents/agent.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +1 -1
- package/.docs/raw/reference/agents/streamVNext.mdx +1 -1
- package/.docs/raw/reference/deployer/cloudflare.mdx +20 -131
- package/.docs/raw/reference/memory/Memory.mdx +1 -1
- package/.docs/raw/reference/voice/google-gemini-live.mdx +629 -0
- package/.docs/raw/voice/overview.mdx +21 -33
- package/.docs/raw/workflows/suspend-and-resume.mdx +2 -2
- package/package.json +4 -4
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @mastra/rag
|
|
2
2
|
|
|
3
|
+
## 1.0.9-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a741dde: generateVNext plumbing
|
|
8
|
+
- Updated dependencies [0a7f675]
|
|
9
|
+
- Updated dependencies [12cae67]
|
|
10
|
+
- Updated dependencies [5a37d0c]
|
|
11
|
+
- Updated dependencies [4bde0cb]
|
|
12
|
+
- Updated dependencies [1a80071]
|
|
13
|
+
- Updated dependencies [36a3be8]
|
|
14
|
+
- Updated dependencies [361757b]
|
|
15
|
+
- Updated dependencies [2bb9955]
|
|
16
|
+
- Updated dependencies [2454423]
|
|
17
|
+
- Updated dependencies [a44d91e]
|
|
18
|
+
- Updated dependencies [dfb91e9]
|
|
19
|
+
- Updated dependencies [a741dde]
|
|
20
|
+
- Updated dependencies [7cb3fc0]
|
|
21
|
+
- Updated dependencies [195eabb]
|
|
22
|
+
- Updated dependencies [b78b95b]
|
|
23
|
+
- @mastra/core@0.14.0-alpha.4
|
|
24
|
+
|
|
3
25
|
## 1.0.8
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -276,27 +298,5 @@
|
|
|
276
298
|
- a85fa13: Add model to createVectorQueryTool runtimeContext
|
|
277
299
|
- Updated dependencies [15e9d26]
|
|
278
300
|
- Updated dependencies [07d6d88]
|
|
279
|
-
- Updated dependencies [5d74aab]
|
|
280
|
-
- Updated dependencies [144eb0b]
|
|
281
|
-
- @mastra/core@0.10.7-alpha.2
|
|
282
|
-
|
|
283
|
-
## 1.0.0
|
|
284
|
-
|
|
285
|
-
### Major Changes
|
|
286
|
-
|
|
287
|
-
- 75136cd: Add LaTeX chunking support by adding a case for Language.LATEX in getSeparatorsForLanguage.
|
|
288
|
-
|
|
289
|
-
### Patch Changes
|
|
290
301
|
|
|
291
|
-
|
|
292
|
-
- Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
|
|
293
|
-
- Updated dependencies [63f6b7d]
|
|
294
|
-
- Updated dependencies [12a95fc]
|
|
295
|
-
- Updated dependencies [4b0f8a6]
|
|
296
|
-
- Updated dependencies [51264a5]
|
|
297
|
-
- Updated dependencies [8e6f677]
|
|
298
|
-
- Updated dependencies [d70c420]
|
|
299
|
-
- Updated dependencies [ee9af57]
|
|
300
|
-
- Updated dependencies [36f1c36]
|
|
301
|
-
|
|
302
|
-
... 2415 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 2437 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 0.14.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bc1684a: Fix lint
|
|
8
|
+
- dfb91e9: Server handlers
|
|
9
|
+
- 57f7019: Add modelVersion to agent response
|
|
10
|
+
- Updated dependencies [0a7f675]
|
|
11
|
+
- Updated dependencies [12cae67]
|
|
12
|
+
- Updated dependencies [5a37d0c]
|
|
13
|
+
- Updated dependencies [4bde0cb]
|
|
14
|
+
- Updated dependencies [1a80071]
|
|
15
|
+
- Updated dependencies [36a3be8]
|
|
16
|
+
- Updated dependencies [361757b]
|
|
17
|
+
- Updated dependencies [2bb9955]
|
|
18
|
+
- Updated dependencies [2454423]
|
|
19
|
+
- Updated dependencies [a44d91e]
|
|
20
|
+
- Updated dependencies [dfb91e9]
|
|
21
|
+
- Updated dependencies [a741dde]
|
|
22
|
+
- Updated dependencies [7cb3fc0]
|
|
23
|
+
- Updated dependencies [195eabb]
|
|
24
|
+
- Updated dependencies [b78b95b]
|
|
25
|
+
- @mastra/core@0.14.0-alpha.4
|
|
26
|
+
|
|
27
|
+
## 0.14.0-alpha.3
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [227c7e6]
|
|
32
|
+
- Updated dependencies [fd3a3eb]
|
|
33
|
+
- Updated dependencies [a8f129d]
|
|
34
|
+
- @mastra/core@0.14.0-alpha.3
|
|
35
|
+
|
|
3
36
|
## 0.14.0-alpha.2
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -266,37 +299,4 @@
|
|
|
266
299
|
|
|
267
300
|
### Patch Changes
|
|
268
301
|
|
|
269
|
-
|
|
270
|
-
- b8efbb9: feat: add flexible deleteMessages method to memory API
|
|
271
|
-
- Added `memory.deleteMessages(input)` method that accepts multiple input types:
|
|
272
|
-
- Single message ID as string: `deleteMessages('msg-123')`
|
|
273
|
-
- Array of message IDs: `deleteMessages(['msg-1', 'msg-2'])`
|
|
274
|
-
- Message object with id property: `deleteMessages({ id: 'msg-123' })`
|
|
275
|
-
- Array of message objects: `deleteMessages([{ id: 'msg-1' }, { id: 'msg-2' }])`
|
|
276
|
-
- Implemented in all storage adapters (LibSQL, PostgreSQL, Upstash, InMemory)
|
|
277
|
-
- Added REST API endpoint: `POST /api/memory/messages/delete`
|
|
278
|
-
- Updated client SDK: `thread.deleteMessages()` accepts all input types
|
|
279
|
-
- Updates thread timestamps when messages are deleted
|
|
280
|
-
- Added comprehensive test coverage and documentation
|
|
281
|
-
|
|
282
|
-
- Updated dependencies [27cc97a]
|
|
283
|
-
- Updated dependencies [41daa63]
|
|
284
|
-
- Updated dependencies [254a36b]
|
|
285
|
-
- Updated dependencies [0b89602]
|
|
286
|
-
- Updated dependencies [4d37822]
|
|
287
|
-
- Updated dependencies [ff9c125]
|
|
288
|
-
- Updated dependencies [b8efbb9]
|
|
289
|
-
- Updated dependencies [71466e7]
|
|
290
|
-
- Updated dependencies [0c99fbe]
|
|
291
|
-
- @mastra/core@0.12.0-alpha.2
|
|
292
|
-
|
|
293
|
-
## 0.12.0-alpha.1
|
|
294
|
-
|
|
295
|
-
### Patch Changes
|
|
296
|
-
|
|
297
|
-
- Updated dependencies [e0f73c6]
|
|
298
|
-
- Updated dependencies [cda801d]
|
|
299
|
-
- Updated dependencies [a77c823]
|
|
300
|
-
- @mastra/core@0.12.0-alpha.1
|
|
301
|
-
|
|
302
|
-
... 2811 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 2844 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @mastra/voice-google
|
|
2
2
|
|
|
3
|
+
## 0.10.8-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 50210fc: dependencies updates:
|
|
8
|
+
- Updated dependency [`@google-cloud/text-to-speech@^6.2.0` ↗︎](https://www.npmjs.com/package/@google-cloud/text-to-speech/v/6.2.0) (from `^6.1.0`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [0a7f675]
|
|
10
|
+
- Updated dependencies [12cae67]
|
|
11
|
+
- Updated dependencies [5a37d0c]
|
|
12
|
+
- Updated dependencies [4bde0cb]
|
|
13
|
+
- Updated dependencies [1a80071]
|
|
14
|
+
- Updated dependencies [36a3be8]
|
|
15
|
+
- Updated dependencies [361757b]
|
|
16
|
+
- Updated dependencies [2bb9955]
|
|
17
|
+
- Updated dependencies [2454423]
|
|
18
|
+
- Updated dependencies [a44d91e]
|
|
19
|
+
- Updated dependencies [dfb91e9]
|
|
20
|
+
- Updated dependencies [a741dde]
|
|
21
|
+
- Updated dependencies [7cb3fc0]
|
|
22
|
+
- Updated dependencies [195eabb]
|
|
23
|
+
- Updated dependencies [b78b95b]
|
|
24
|
+
- @mastra/core@0.14.0-alpha.4
|
|
25
|
+
|
|
3
26
|
## 0.10.7
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -275,28 +298,5 @@
|
|
|
275
298
|
- Updated dependencies [344f453]
|
|
276
299
|
- Updated dependencies [0a3ae6d]
|
|
277
300
|
- Updated dependencies [95911be]
|
|
278
|
-
- Updated dependencies [5eb5a99]
|
|
279
|
-
- Updated dependencies [7e632c5]
|
|
280
|
-
- Updated dependencies [1e9fbfa]
|
|
281
|
-
- Updated dependencies [b2ae5aa]
|
|
282
|
-
- Updated dependencies [a7292b0]
|
|
283
|
-
- Updated dependencies [0dcb9f0]
|
|
284
|
-
- @mastra/core@0.10.0-alpha.1
|
|
285
|
-
|
|
286
|
-
## 0.1.19-alpha.0
|
|
287
|
-
|
|
288
|
-
### Patch Changes
|
|
289
|
-
|
|
290
|
-
- Updated dependencies [f53a6ac]
|
|
291
|
-
- Updated dependencies [eabdcd9]
|
|
292
|
-
- Updated dependencies [90be034]
|
|
293
|
-
- Updated dependencies [99f050a]
|
|
294
|
-
- Updated dependencies [d0ee3c6]
|
|
295
|
-
- Updated dependencies [23f258c]
|
|
296
|
-
- Updated dependencies [2672a05]
|
|
297
|
-
- @mastra/core@0.9.5-alpha.0
|
|
298
|
-
|
|
299
|
-
## 0.1.18
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1096 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
+
## 0.10.22-alpha.3
|
|
4
|
+
|
|
5
|
+
## 0.10.22-alpha.2
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- 36928f0: Use right icon for anthropic in model switcher
|
|
10
|
+
|
|
3
11
|
## 0.10.22-alpha.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -291,12 +299,4 @@
|
|
|
291
299
|
|
|
292
300
|
## 0.10.6
|
|
293
301
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
- 5d74aab: vNext network in playground
|
|
297
|
-
- 9102d89: Fix final output not showing on playground for previously suspended steps
|
|
298
|
-
- 21ffb97: Make dynamic form handle schema better
|
|
299
|
-
- f9b4350: fix icons not showing on all agents
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
... 1206 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 1214 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.10.22-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1d59515: Add options to playground based on modelVersion
|
|
8
|
+
- Updated dependencies [0a7f675]
|
|
9
|
+
- Updated dependencies [12cae67]
|
|
10
|
+
- Updated dependencies [96518cc]
|
|
11
|
+
- Updated dependencies [5a37d0c]
|
|
12
|
+
- Updated dependencies [4bde0cb]
|
|
13
|
+
- Updated dependencies [e1aed55]
|
|
14
|
+
- Updated dependencies [1a80071]
|
|
15
|
+
- Updated dependencies [36a3be8]
|
|
16
|
+
- Updated dependencies [c712849]
|
|
17
|
+
- Updated dependencies [361757b]
|
|
18
|
+
- Updated dependencies [2bb9955]
|
|
19
|
+
- Updated dependencies [2454423]
|
|
20
|
+
- Updated dependencies [a44d91e]
|
|
21
|
+
- Updated dependencies [dfb91e9]
|
|
22
|
+
- Updated dependencies [a741dde]
|
|
23
|
+
- Updated dependencies [95e1330]
|
|
24
|
+
- Updated dependencies [7cb3fc0]
|
|
25
|
+
- Updated dependencies [195eabb]
|
|
26
|
+
- Updated dependencies [33eb340]
|
|
27
|
+
- Updated dependencies [b78b95b]
|
|
28
|
+
- @mastra/core@0.14.0-alpha.4
|
|
29
|
+
- @mastra/deployer@0.14.0-alpha.4
|
|
30
|
+
- @mastra/mcp@0.10.12-alpha.1
|
|
31
|
+
|
|
32
|
+
## 0.10.22-alpha.2
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 36928f0: Use right icon for anthropic in model switcher
|
|
37
|
+
- Updated dependencies [227c7e6]
|
|
38
|
+
- Updated dependencies [fd3a3eb]
|
|
39
|
+
- Updated dependencies [04dcd66]
|
|
40
|
+
- Updated dependencies [a8f129d]
|
|
41
|
+
- @mastra/core@0.14.0-alpha.3
|
|
42
|
+
- @mastra/deployer@0.14.0-alpha.3
|
|
43
|
+
|
|
3
44
|
## 0.10.22-alpha.1
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
@@ -257,46 +298,5 @@
|
|
|
257
298
|
- Updated dependencies [b4a8df0]
|
|
258
299
|
- @mastra/core@0.12.1-alpha.0
|
|
259
300
|
- @mastra/mcp@0.10.9-alpha.0
|
|
260
|
-
- @mastra/deployer@0.12.1-alpha.0
|
|
261
|
-
|
|
262
|
-
## 0.10.16
|
|
263
|
-
|
|
264
|
-
### Patch Changes
|
|
265
301
|
|
|
266
|
-
|
|
267
|
-
- f442224: speech to text using voice config
|
|
268
|
-
- 7a7754f: Fast follow scorers fixing input types, improve llm scorer reliability, fix ui to display scores that are 0
|
|
269
|
-
- d8dec5e: add a cta to invite to deploy to cloud
|
|
270
|
-
- 6336993: Fix workflow input form overflow
|
|
271
|
-
- d5cc460: This change implements a fix to sourcemap mappings being off due to `removeDeployer` Babel plugin missing source map config.
|
|
272
|
-
- f42c4c2: update peer deps for packages to latest core range
|
|
273
|
-
- a5681f2: fix: pagination breaks trace grouping
|
|
274
|
-
- 89d2f4e: add TTS to the playground
|
|
275
|
-
- Updated dependencies [510e2c8]
|
|
276
|
-
- Updated dependencies [2f72fb2]
|
|
277
|
-
- Updated dependencies [27cc97a]
|
|
278
|
-
- Updated dependencies [832691b]
|
|
279
|
-
- Updated dependencies [557bb9d]
|
|
280
|
-
- Updated dependencies [27cc97a]
|
|
281
|
-
- Updated dependencies [3f89307]
|
|
282
|
-
- Updated dependencies [9eda7d4]
|
|
283
|
-
- Updated dependencies [9d49408]
|
|
284
|
-
- Updated dependencies [bc6b44a]
|
|
285
|
-
- Updated dependencies [41daa63]
|
|
286
|
-
- Updated dependencies [ad0a58b]
|
|
287
|
-
- Updated dependencies [254a36b]
|
|
288
|
-
- Updated dependencies [2ecf658]
|
|
289
|
-
- Updated dependencies [7a7754f]
|
|
290
|
-
- Updated dependencies [fc92d80]
|
|
291
|
-
- Updated dependencies [e0f73c6]
|
|
292
|
-
- Updated dependencies [0b89602]
|
|
293
|
-
- Updated dependencies [4d37822]
|
|
294
|
-
- Updated dependencies [23a6a7c]
|
|
295
|
-
- Updated dependencies [cda801d]
|
|
296
|
-
- Updated dependencies [a77c823]
|
|
297
|
-
- Updated dependencies [ff9c125]
|
|
298
|
-
- Updated dependencies [09bca64]
|
|
299
|
-
- Updated dependencies [9802f42]
|
|
300
|
-
- Updated dependencies [d5cc460]
|
|
301
|
-
|
|
302
|
-
... 4912 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 4953 more lines hidden. See full changelog in package directory.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@ai-sdk/google": "^1.2.22",
|
|
7
7
|
"@ai-sdk/openai": "^1.3.23",
|
|
8
|
+
"@ai-sdk/openai-v5": "npm:@ai-sdk/openai@2.0.0",
|
|
8
9
|
"@mastra/client-js": "latest",
|
|
9
10
|
"@mastra/core": "latest",
|
|
10
11
|
"@mastra/evals": "latest",
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
"@mastra/memory": "latest",
|
|
15
16
|
"@mastra/voice-openai": "latest",
|
|
16
17
|
"ai": "^4.3.16",
|
|
18
|
+
"ai-v5": "npm:ai@^5.0.0",
|
|
17
19
|
"fetch-to-node": "^2.1.0",
|
|
18
20
|
"mastra": "latest",
|
|
19
21
|
"typescript": "^5.8.3",
|
|
@@ -474,7 +476,6 @@ import { Agent, InputProcessor } from '@mastra/core/agent';
|
|
|
474
476
|
import { cookingTool } from '../tools/index.js';
|
|
475
477
|
import { myWorkflow } from '../workflows/index.js';
|
|
476
478
|
import { PIIDetector, LanguageDetector, PromptInjectionDetector, ModerationProcessor } from '@mastra/core/processors';
|
|
477
|
-
import { MCPClient } from '@mastra/mcp';
|
|
478
479
|
import { createAnswerRelevancyScorer } from '@mastra/evals/scorers/llm';
|
|
479
480
|
|
|
480
481
|
const memory = new Memory();
|
|
@@ -511,8 +512,8 @@ export const chefAgent = new Agent({
|
|
|
511
512
|
description: 'A chef agent that can help you cook great meals with whatever ingredients you have available.',
|
|
512
513
|
instructions: `
|
|
513
514
|
YOU MUST USE THE TOOL cooking-tool
|
|
514
|
-
You are Michel, a practical and experienced home chef who helps people cook great meals with whatever
|
|
515
|
-
ingredients they have available. Your first priority is understanding what ingredients and equipment the user has access to, then suggesting achievable recipes.
|
|
515
|
+
You are Michel, a practical and experienced home chef who helps people cook great meals with whatever
|
|
516
|
+
ingredients they have available. Your first priority is understanding what ingredients and equipment the user has access to, then suggesting achievable recipes.
|
|
516
517
|
You explain cooking steps clearly and offer substitutions when needed, maintaining a friendly and encouraging tone throughout.
|
|
517
518
|
`,
|
|
518
519
|
model: openai('gpt-4o-mini'),
|
|
@@ -599,8 +600,8 @@ const moderationDetector = new ModerationProcessor({
|
|
|
599
600
|
export const chefAgentResponses = new Agent({
|
|
600
601
|
name: 'Chef Agent Responses',
|
|
601
602
|
instructions: `
|
|
602
|
-
You are Michel, a practical and experienced home chef who helps people cook great meals with whatever
|
|
603
|
-
ingredients they have available. Your first priority is understanding what ingredients and equipment the user has access to, then suggesting achievable recipes.
|
|
603
|
+
You are Michel, a practical and experienced home chef who helps people cook great meals with whatever
|
|
604
|
+
ingredients they have available. Your first priority is understanding what ingredients and equipment the user has access to, then suggesting achievable recipes.
|
|
604
605
|
You explain cooking steps clearly and offer substitutions when needed, maintaining a friendly and encouraging tone throughout.
|
|
605
606
|
`,
|
|
606
607
|
model: openai.responses('gpt-4o'),
|
|
@@ -608,6 +609,7 @@ export const chefAgentResponses = new Agent({
|
|
|
608
609
|
tools: async () => {
|
|
609
610
|
return {
|
|
610
611
|
web_search_preview: openai.tools.webSearchPreview(),
|
|
612
|
+
cooking_tool: cookingTool,
|
|
611
613
|
};
|
|
612
614
|
},
|
|
613
615
|
workflows: {
|
|
@@ -695,6 +697,58 @@ export const evalAgent = new Agent({
|
|
|
695
697
|
|
|
696
698
|
```
|
|
697
699
|
|
|
700
|
+
### mastra/agents/model-v2-agent.ts
|
|
701
|
+
```typescript
|
|
702
|
+
import { Agent } from '@mastra/core/agent';
|
|
703
|
+
import { openai as openai_v5 } from '@ai-sdk/openai-v5';
|
|
704
|
+
import { createTool } from '@mastra/core/tools';
|
|
705
|
+
import { z } from 'zod';
|
|
706
|
+
import { cookingTool } from '../tools';
|
|
707
|
+
import { myWorkflow } from '../workflows';
|
|
708
|
+
import { Memory } from '@mastra/memory';
|
|
709
|
+
|
|
710
|
+
export const weatherInfo = createTool({
|
|
711
|
+
id: 'weather-info',
|
|
712
|
+
description: 'Fetches the current weather information for a given city',
|
|
713
|
+
inputSchema: z.object({
|
|
714
|
+
city: z.string(),
|
|
715
|
+
}),
|
|
716
|
+
execute: async ({ context }) => {
|
|
717
|
+
return {
|
|
718
|
+
city: context.city,
|
|
719
|
+
weather: 'sunny',
|
|
720
|
+
temperature_celsius: 19,
|
|
721
|
+
temperature_fahrenheit: 66,
|
|
722
|
+
humidity: 50,
|
|
723
|
+
wind: '10 mph',
|
|
724
|
+
};
|
|
725
|
+
},
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
const memory = new Memory();
|
|
729
|
+
|
|
730
|
+
export const chefModelV2Agent = new Agent({
|
|
731
|
+
name: 'Chef Agent V2 Model',
|
|
732
|
+
description: 'A chef agent that can help you cook great meals with whatever ingredients you have available.',
|
|
733
|
+
instructions: `
|
|
734
|
+
YOU MUST USE THE TOOL cooking-tool
|
|
735
|
+
You are Michel, a practical and experienced home chef who helps people cook great meals with whatever
|
|
736
|
+
ingredients they have available. Your first priority is understanding what ingredients and equipment the user has access to, then suggesting achievable recipes.
|
|
737
|
+
You explain cooking steps clearly and offer substitutions when needed, maintaining a friendly and encouraging tone throughout.
|
|
738
|
+
`,
|
|
739
|
+
model: openai_v5('gpt-4o-mini'),
|
|
740
|
+
tools: {
|
|
741
|
+
cookingTool,
|
|
742
|
+
weatherInfo,
|
|
743
|
+
},
|
|
744
|
+
workflows: {
|
|
745
|
+
myWorkflow,
|
|
746
|
+
},
|
|
747
|
+
memory,
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
```
|
|
751
|
+
|
|
698
752
|
### mastra/index.ts
|
|
699
753
|
```typescript
|
|
700
754
|
import { Mastra } from '@mastra/core';
|
|
@@ -704,13 +758,21 @@ import { LibSQLStore } from '@mastra/libsql';
|
|
|
704
758
|
import { agentThatHarassesYou, chefAgent, chefAgentResponses, dynamicAgent, evalAgent } from './agents/index';
|
|
705
759
|
import { myMcpServer, myMcpServerTwo } from './mcp/server';
|
|
706
760
|
import { myWorkflow } from './workflows';
|
|
761
|
+
import { chefModelV2Agent } from './agents/model-v2-agent';
|
|
707
762
|
|
|
708
763
|
const storage = new LibSQLStore({
|
|
709
764
|
url: 'file:./mastra.db',
|
|
710
765
|
});
|
|
711
766
|
|
|
712
767
|
export const mastra = new Mastra({
|
|
713
|
-
agents: {
|
|
768
|
+
agents: {
|
|
769
|
+
chefAgent,
|
|
770
|
+
chefAgentResponses,
|
|
771
|
+
dynamicAgent,
|
|
772
|
+
agentThatHarassesYou,
|
|
773
|
+
evalAgent,
|
|
774
|
+
chefModelV2Agent,
|
|
775
|
+
},
|
|
714
776
|
logger: new PinoLogger({ name: 'Chef', level: 'debug' }),
|
|
715
777
|
storage,
|
|
716
778
|
mcpServers: {
|
|
@@ -995,14 +1057,14 @@ import { z } from 'zod';
|
|
|
995
1057
|
|
|
996
1058
|
export const cookingTool = createTool({
|
|
997
1059
|
id: 'cooking-tool',
|
|
998
|
-
description: 'My tool description',
|
|
1060
|
+
description: 'My cooking tool description',
|
|
999
1061
|
inputSchema: z.object({
|
|
1000
1062
|
ingredient: z.string(),
|
|
1001
1063
|
}),
|
|
1002
1064
|
execute: async ({ context }, options) => {
|
|
1003
|
-
console.log('My tool is running!', context.ingredient);
|
|
1065
|
+
console.log('My cooking tool is running!', context.ingredient);
|
|
1004
1066
|
if (options?.toolCallId) {
|
|
1005
|
-
console.log('
|
|
1067
|
+
console.log('Cooking tool call ID:', options.toolCallId);
|
|
1006
1068
|
}
|
|
1007
1069
|
return 'My tool result';
|
|
1008
1070
|
},
|
|
@@ -1051,9 +1113,11 @@ const step2 = createStep({
|
|
|
1051
1113
|
outputSchema: z.object({
|
|
1052
1114
|
result: z.string(),
|
|
1053
1115
|
}),
|
|
1054
|
-
execute: async ({ inputData, mastra }) => {
|
|
1116
|
+
execute: async ({ inputData, mastra, aiTracingContext }) => {
|
|
1055
1117
|
const agent = mastra.getAgent('chefAgentResponses');
|
|
1056
|
-
const response = await agent.generate(inputData.result
|
|
1118
|
+
const response = await agent.generate(inputData.result, {
|
|
1119
|
+
aiTracingContext,
|
|
1120
|
+
});
|
|
1057
1121
|
return {
|
|
1058
1122
|
result: 'suh',
|
|
1059
1123
|
};
|
|
@@ -1,41 +1,75 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Deploy
|
|
3
|
-
description: "
|
|
2
|
+
title: "Deploy a Mastra Server"
|
|
3
|
+
description: "Learn how to deploy a Mastra server with build settings and deployment options."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { FileTree } from "nextra/components";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# Deploy a Mastra Server
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- Container platforms (Docker, Kubernetes)
|
|
12
|
-
- Platform as a Service (Heroku, Railway)
|
|
13
|
-
- Self-hosted servers
|
|
10
|
+
Mastra runs as a standard Node.js server and can be deployed across a wide range of environments.
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
## Default project structure
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
The [getting started guide](/docs/getting-started/installation) scaffolds a project with sensible defaults to help you begin quickly. By default, the CLI organizes application files under the `src/mastra/` directory, resulting in a structure similar to the following:
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
<FileTree>
|
|
17
|
+
<FileTree.Folder name="src" defaultOpen>
|
|
18
|
+
<FileTree.Folder name="mastra" defaultOpen>
|
|
19
|
+
<FileTree.Folder name="agents" />
|
|
20
|
+
<FileTree.Folder name="tools" />
|
|
21
|
+
<FileTree.Folder name="workflows" />
|
|
22
|
+
<FileTree.File name="index.ts" />
|
|
23
|
+
</FileTree.Folder>
|
|
24
|
+
</FileTree.Folder>
|
|
25
|
+
<FileTree.File name="package.json" />
|
|
26
|
+
<FileTree.File name="tsconfig.json" />
|
|
27
|
+
</FileTree>
|
|
28
|
+
|
|
29
|
+
## Building
|
|
30
|
+
|
|
31
|
+
The `mastra build` command starts the build process:
|
|
20
32
|
|
|
21
33
|
```bash copy
|
|
22
|
-
# Build from current directory
|
|
23
34
|
mastra build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Customizing the input directory
|
|
24
38
|
|
|
25
|
-
|
|
26
|
-
|
|
39
|
+
If your Mastra files are located elsewhere, use the `--dir` flag to specify the custom location. The `--dir` flag tells Mastra where to find your entry point file (`index.ts` or `index.js`) and related directories.
|
|
40
|
+
|
|
41
|
+
```bash copy
|
|
42
|
+
mastra build --dir ./my-project/mastra
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
## Build process
|
|
46
|
+
|
|
47
|
+
The build process follows these steps:
|
|
30
48
|
|
|
31
|
-
1. Locates entry file
|
|
32
|
-
2. Creates `.mastra
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
1. **Locates entry file**: Finds `index.ts` or `index.js` in your specified directory (default: `src/mastra/`).
|
|
50
|
+
2. **Creates build directory**: Generates a `.mastra/` directory containing:
|
|
51
|
+
- **`.build`**: Contains dependency analysis, bundled dependencies, and build configuration files.
|
|
52
|
+
- **`output`**: Contains the production-ready application bundle with `index.mjs`, `instrumentation.mjs`, and project-specific files.
|
|
53
|
+
3. **Copies static assets**: Copies the `public/` folder contents to the `output` directory for serving static files.
|
|
54
|
+
4. **Bundles code**: Uses Rollup with tree shaking and source maps for optimization.
|
|
55
|
+
5. **Generates server**: Creates a [Hono](https://hono.dev) HTTP server ready for deployment.
|
|
35
56
|
|
|
36
|
-
|
|
57
|
+
### Build output structure
|
|
37
58
|
|
|
38
|
-
|
|
59
|
+
After building, Mastra creates a `.mastra/` directory with the following structure:
|
|
60
|
+
|
|
61
|
+
<FileTree>
|
|
62
|
+
<FileTree.Folder name=".mastra" defaultOpen>
|
|
63
|
+
<FileTree.Folder name=".build" />
|
|
64
|
+
<FileTree.Folder name="output" />
|
|
65
|
+
</FileTree.Folder>
|
|
66
|
+
</FileTree>
|
|
67
|
+
|
|
68
|
+
### `public` folder
|
|
69
|
+
|
|
70
|
+
If a `public` folder exists in `src/mastra`, its contents are copied into the `.build/output` directory during the build process.
|
|
71
|
+
|
|
72
|
+
## Running the Server
|
|
39
73
|
|
|
40
74
|
Start the HTTP server:
|
|
41
75
|
|
|
@@ -43,14 +77,10 @@ Start the HTTP server:
|
|
|
43
77
|
node .mastra/output/index.mjs
|
|
44
78
|
```
|
|
45
79
|
|
|
46
|
-
|
|
80
|
+
## Enable Telemetry
|
|
47
81
|
|
|
48
|
-
|
|
82
|
+
To enable telemetry and observability, load the instrumentation file:
|
|
49
83
|
|
|
50
84
|
```bash copy
|
|
51
85
|
node --import=./.mastra/output/instrumentation.mjs .mastra/output/index.mjs
|
|
52
86
|
```
|
|
53
|
-
|
|
54
|
-
## Serverless Deployment
|
|
55
|
-
|
|
56
|
-
Mastra also supports serverless deployment on Cloudflare Workers, Vercel, and Netlify. See [Serverless Platforms](/docs/deployment/serverless-platforms/) for more information.
|
|
@@ -24,14 +24,11 @@ import { CloudflareDeployer } from "@mastra/deployer-cloudflare";
|
|
|
24
24
|
export const mastra = new Mastra({
|
|
25
25
|
// ...
|
|
26
26
|
deployer: new CloudflareDeployer({
|
|
27
|
-
scope: "your-account-id",
|
|
28
27
|
projectName: "hello-mastra",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
})
|
|
28
|
+
env: {
|
|
29
|
+
NODE_ENV: "production",
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
35
32
|
});
|
|
36
33
|
```
|
|
37
34
|
|