@mastra/mcp-docs-server 0.13.9-alpha.1 → 0.13.9-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%2Ftypes-builder.md +1 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Flance.md +13 -0
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +14 -0
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Frag.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +15 -15
- 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 +13 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +14 -14
- package/.docs/organized/changelogs/create-mastra.md +3 -3
- package/.docs/organized/changelogs/mastra.md +18 -18
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +83 -40
- package/.docs/raw/agents/overview.mdx +1 -0
- package/.docs/raw/course/02-agent-tools-mcp/14-getting-github-mcp-url.md +27 -8
- package/.docs/raw/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +1 -1
- package/.docs/raw/memory/memory-processors.mdx +4 -3
- package/.docs/raw/workflows/using-with-agents-and-tools.mdx +25 -0
- package/package.json +6 -6
|
@@ -20,15 +20,21 @@
|
|
|
20
20
|
import { mastra } from './mastra';
|
|
21
21
|
|
|
22
22
|
async function main() {
|
|
23
|
-
const
|
|
24
|
-
const { start } = myWorkflow.createRun();
|
|
23
|
+
const run = await mastra.getWorkflow('myWorkflow').createRunAsync();
|
|
25
24
|
try {
|
|
26
|
-
const res = await start({
|
|
27
|
-
|
|
28
|
-
inputValue:
|
|
25
|
+
const res = await run.start({
|
|
26
|
+
inputData: {
|
|
27
|
+
inputValue: 12,
|
|
29
28
|
},
|
|
30
29
|
});
|
|
31
|
-
|
|
30
|
+
|
|
31
|
+
if (res.status === 'success') {
|
|
32
|
+
console.log(res.result);
|
|
33
|
+
} else if (res.status === 'failed') {
|
|
34
|
+
console.log('Workflow failed:', res.error);
|
|
35
|
+
} else {
|
|
36
|
+
console.log('Workflow suspended:', res.suspended);
|
|
37
|
+
}
|
|
32
38
|
} catch (e) {
|
|
33
39
|
console.log(e);
|
|
34
40
|
}
|
|
@@ -54,64 +60,101 @@ export const mastra = new Mastra({
|
|
|
54
60
|
|
|
55
61
|
### mastra/workflows/index.ts
|
|
56
62
|
```typescript
|
|
57
|
-
import {
|
|
63
|
+
import { createStep, createWorkflow } from '@mastra/core/workflows';
|
|
58
64
|
import { z } from 'zod';
|
|
59
65
|
|
|
60
|
-
const stepOne =
|
|
66
|
+
const stepOne = createStep({
|
|
61
67
|
id: 'stepOne',
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
inputSchema: z.object({
|
|
69
|
+
inputValue: z.number(),
|
|
70
|
+
}),
|
|
71
|
+
outputSchema: z.object({
|
|
72
|
+
doubledValue: z.number(),
|
|
73
|
+
isOriginalOdd: z.boolean(), // Track original parity
|
|
74
|
+
}),
|
|
75
|
+
execute: async ({ inputData }) => {
|
|
76
|
+
const doubledValue = inputData.inputValue * 2;
|
|
77
|
+
const isOriginalOdd = inputData.inputValue % 2 === 1;
|
|
78
|
+
return { doubledValue, isOriginalOdd };
|
|
66
79
|
},
|
|
67
80
|
});
|
|
68
81
|
|
|
69
|
-
const stepTwo =
|
|
82
|
+
const stepTwo = createStep({
|
|
70
83
|
id: 'stepTwo',
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
inputSchema: z.object({
|
|
85
|
+
doubledValue: z.number(),
|
|
86
|
+
isOriginalOdd: z.boolean(),
|
|
87
|
+
}),
|
|
88
|
+
outputSchema: z.object({
|
|
89
|
+
incrementedValue: z.number(),
|
|
90
|
+
}),
|
|
91
|
+
execute: async ({ inputData }) => {
|
|
92
|
+
// Increment only if original input was odd
|
|
93
|
+
const incrementedValue = inputData.doubledValue + (inputData.isOriginalOdd ? 1 : 0);
|
|
77
94
|
return { incrementedValue };
|
|
78
95
|
},
|
|
79
96
|
});
|
|
80
97
|
|
|
81
|
-
const stepThree =
|
|
98
|
+
const stepThree = createStep({
|
|
82
99
|
id: 'stepThree',
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
inputSchema: z.object({
|
|
101
|
+
incrementedValue: z.number(),
|
|
102
|
+
}),
|
|
103
|
+
outputSchema: z.object({
|
|
104
|
+
tripledValue: z.number(),
|
|
105
|
+
}),
|
|
106
|
+
execute: async ({ inputData, getStepResult }) => {
|
|
107
|
+
try {
|
|
108
|
+
const stepTwoResult = getStepResult(stepTwo);
|
|
109
|
+
if (!stepTwoResult || typeof stepTwoResult.incrementedValue !== 'number') {
|
|
110
|
+
throw new Error('stepTwo failed or returned invalid data');
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
throw new Error(`stepTwo failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const tripledValue = inputData.incrementedValue * 3;
|
|
86
117
|
return { tripledValue };
|
|
87
118
|
},
|
|
88
119
|
});
|
|
89
120
|
|
|
90
|
-
const stepFour =
|
|
121
|
+
const stepFour = createStep({
|
|
91
122
|
id: 'stepFour',
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
inputSchema: z.object({
|
|
124
|
+
tripledValue: z.number(),
|
|
125
|
+
}),
|
|
126
|
+
outputSchema: z.object({
|
|
127
|
+
isEven: z.boolean(),
|
|
128
|
+
}),
|
|
129
|
+
execute: async ({ inputData, getStepResult }) => {
|
|
130
|
+
try {
|
|
131
|
+
const stepThreeResult = getStepResult(stepThree);
|
|
132
|
+
if (!stepThreeResult || typeof stepThreeResult.tripledValue !== 'number') {
|
|
133
|
+
throw new Error('stepThree failed or returned invalid data');
|
|
134
|
+
}
|
|
135
|
+
} catch (error) {
|
|
136
|
+
throw new Error(`stepThree failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
95
137
|
}
|
|
96
|
-
|
|
97
|
-
const isEven =
|
|
138
|
+
|
|
139
|
+
const isEven = inputData.tripledValue % 2 === 0;
|
|
98
140
|
return { isEven };
|
|
99
141
|
},
|
|
100
142
|
});
|
|
101
143
|
|
|
102
|
-
export const myWorkflow =
|
|
103
|
-
|
|
104
|
-
|
|
144
|
+
export const myWorkflow = createWorkflow({
|
|
145
|
+
id: 'my-workflow',
|
|
146
|
+
inputSchema: z.object({
|
|
105
147
|
inputValue: z.number(),
|
|
106
148
|
}),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
149
|
+
outputSchema: z.object({
|
|
150
|
+
isEven: z.boolean(),
|
|
151
|
+
}),
|
|
152
|
+
})
|
|
153
|
+
.then(stepOne)
|
|
154
|
+
.then(stepTwo)
|
|
155
|
+
.then(stepThree)
|
|
156
|
+
.then(stepFour);
|
|
114
157
|
|
|
115
|
-
|
|
158
|
+
myWorkflow.commit();
|
|
116
159
|
|
|
117
160
|
```
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
# Getting a
|
|
1
|
+
# Getting a Smithery GitHub MCP URL
|
|
2
2
|
|
|
3
|
-
First, you'll need to get a
|
|
3
|
+
First, you'll need to get a Smithery GitHub MCP URL. This typically requires:
|
|
4
4
|
|
|
5
|
-
1. Setting up
|
|
6
|
-
2.
|
|
7
|
-
3. Getting your unique MCP URL
|
|
5
|
+
1. Setting up a Smithery account
|
|
6
|
+
2. Creating a personal access token with your GitHub account
|
|
7
|
+
3. Getting your unique MCP URL via the Smithery packages
|
|
8
8
|
|
|
9
|
-
For this example, we'll use an environment variable to store the
|
|
9
|
+
For this example, we'll use an environment variable to store the Smithery API key and profile name which can be found in the Smithery interface.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# Add this to your .env file
|
|
13
|
-
|
|
13
|
+
SMITHERY_API_KEY=your_smithery_api_key
|
|
14
|
+
SMITHERY_PROFILE=your_smithery_profile_name
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
Using an environment variable keeps your configuration secure and flexible.
|
|
17
|
+
Using an environment variable keeps your configuration secure and flexible. It also prevents sensitive information from being committed to your repository.
|
|
18
|
+
|
|
19
|
+
We will use the Smithery packages to authenticate and create a streamable HTTP URL for the MCP server configuration
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install @smithery/sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { createSmitheryUrl } from "@smithery/sdk";
|
|
27
|
+
|
|
28
|
+
const smitheryGithubMCPServerUrl = createSmitheryUrl(
|
|
29
|
+
"https://server.smithery.ai/@smithery-ai/github",
|
|
30
|
+
{
|
|
31
|
+
apiKey: process.env.SMITHERY_API_KEY,
|
|
32
|
+
profile: process.env.SMITHERY_PROFILE,
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
```
|
|
@@ -97,9 +97,10 @@ const memoryWithMultipleProcessors = new Memory({
|
|
|
97
97
|
|
|
98
98
|
You can create custom logic by extending the base `MemoryProcessor` class.
|
|
99
99
|
|
|
100
|
-
```typescript copy showLineNumbers {
|
|
101
|
-
import { Memory
|
|
102
|
-
import {
|
|
100
|
+
```typescript copy showLineNumbers {5-20,24-27}
|
|
101
|
+
import { Memory } from "@mastra/memory";
|
|
102
|
+
import { CoreMessage, MemoryProcessorOpts } from "@mastra/core";
|
|
103
|
+
import { MemoryProcessor } from "@mastra/core/memory";
|
|
103
104
|
|
|
104
105
|
class ConversationOnlyFilter extends MemoryProcessor {
|
|
105
106
|
constructor() {
|
|
@@ -258,6 +258,31 @@ export const cityCoordinatesTool = createTool({
|
|
|
258
258
|
});
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
+
## Using workflows in agents
|
|
262
|
+
|
|
263
|
+
You can also use Workflows in Agents. This agent is able to choose between using the test tool or the test workflow.
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
import { openai } from "@ai-sdk/openai";
|
|
267
|
+
import { Agent } from "@mastra/core/agent";
|
|
268
|
+
import { testTool } from "../tools/test-tool";
|
|
269
|
+
import { testWorkflow } from "../workflows/test-workflow";
|
|
270
|
+
|
|
271
|
+
export const testAgent = new Agent({
|
|
272
|
+
name: "test-agent",
|
|
273
|
+
description: "Create facts for a country based on the city",
|
|
274
|
+
instructions: `Return an interesting fact about the country based on the city provided`,
|
|
275
|
+
model: openai("gpt-4o"),
|
|
276
|
+
workflows: {
|
|
277
|
+
test_workflow: testWorkflow
|
|
278
|
+
},
|
|
279
|
+
tools: {
|
|
280
|
+
test_tool: testTool
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
|
|
261
286
|
## Exposing workflows with `MCPServer`
|
|
262
287
|
|
|
263
288
|
You can convert your workflows into tools by passing them into an instance of a Mastra `MCPServer`. This allows any MCP-compatible client to access your workflow.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.9-alpha.
|
|
3
|
+
"version": "0.13.9-alpha.2",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
33
|
"zod": "^3.25.67",
|
|
34
34
|
"zod-to-json-schema": "^3.24.5",
|
|
35
|
-
"@mastra/core": "0.13.0-alpha.
|
|
36
|
-
"@mastra/mcp": "^0.10.
|
|
35
|
+
"@mastra/core": "0.13.0-alpha.2",
|
|
36
|
+
"@mastra/mcp": "^0.10.10-alpha.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@hono/node-server": "^1.17.1",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@wong2/mcp-cli": "^1.10.0",
|
|
44
44
|
"cross-env": "^7.0.3",
|
|
45
45
|
"eslint": "^9.30.1",
|
|
46
|
-
"hono": "^4.8.
|
|
46
|
+
"hono": "^4.8.11",
|
|
47
47
|
"tsup": "^8.5.0",
|
|
48
48
|
"tsx": "^4.19.4",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
51
|
+
"@mastra/core": "0.13.0-alpha.2",
|
|
52
|
+
"@internal/lint": "0.0.26"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",
|