@mastra/mcp 0.1.0-alpha.41 → 0.1.0-alpha.43
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/CHANGELOG.md +16 -0
- package/package.json +5 -8
- package/dist/index.d.ts +0 -42
- package/dist/index.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.43
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4f1d1a1: Enforce types ann cleanup package.json
|
|
8
|
+
- Updated dependencies [66a03ec]
|
|
9
|
+
- Updated dependencies [4f1d1a1]
|
|
10
|
+
- @mastra/core@0.2.0-alpha.101
|
|
11
|
+
|
|
12
|
+
## 0.1.0-alpha.42
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [9d1796d]
|
|
17
|
+
- @mastra/core@0.2.0-alpha.100
|
|
18
|
+
|
|
3
19
|
## 0.1.0-alpha.41
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.43",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,21 +20,18 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.1.1",
|
|
22
22
|
"date-fns": "^4.1.0",
|
|
23
|
-
"dotenv": "^16.3.1",
|
|
24
23
|
"zod": "^3.24.1",
|
|
25
|
-
"@mastra/core": "^0.2.0-alpha.
|
|
24
|
+
"@mastra/core": "^0.2.0-alpha.101"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
27
|
"@ai-sdk/anthropic": "^1.1.6",
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@tsconfig/recommended": "^1.0.7",
|
|
32
|
-
"@types/node": "^22.9.0",
|
|
28
|
+
"@microsoft/api-extractor": "^7.49.2",
|
|
29
|
+
"@types/node": "^22.13.1",
|
|
33
30
|
"tsup": "^8.0.1",
|
|
34
31
|
"vitest": "^3.0.4"
|
|
35
32
|
},
|
|
36
33
|
"scripts": {
|
|
37
|
-
"build": "tsup src/index.ts --format esm --dts --clean --treeshake",
|
|
34
|
+
"build": "tsup src/index.ts --format esm --experimental-dts --clean --treeshake",
|
|
38
35
|
"build:watch": "pnpm build --watch",
|
|
39
36
|
"test": "vitest run"
|
|
40
37
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
|
-
import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
3
|
-
import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
-
|
|
5
|
-
declare class MastraMCPClient {
|
|
6
|
-
name: string;
|
|
7
|
-
private transport;
|
|
8
|
-
private client;
|
|
9
|
-
constructor({ name, version, server, capabilities, }: {
|
|
10
|
-
name: string;
|
|
11
|
-
server: StdioServerParameters;
|
|
12
|
-
capabilities?: ClientCapabilities;
|
|
13
|
-
version?: string;
|
|
14
|
-
});
|
|
15
|
-
connect(): Promise<void>;
|
|
16
|
-
disconnect(): Promise<void>;
|
|
17
|
-
resources(): Promise<zod.objectOutputType<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
18
|
-
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
19
|
-
}, {
|
|
20
|
-
nextCursor: zod.ZodOptional<zod.ZodString>;
|
|
21
|
-
}>, {
|
|
22
|
-
resources: zod.ZodArray<zod.ZodObject<{
|
|
23
|
-
uri: zod.ZodString;
|
|
24
|
-
name: zod.ZodString;
|
|
25
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
26
|
-
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
27
|
-
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
28
|
-
uri: zod.ZodString;
|
|
29
|
-
name: zod.ZodString;
|
|
30
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
31
|
-
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
32
|
-
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
33
|
-
uri: zod.ZodString;
|
|
34
|
-
name: zod.ZodString;
|
|
35
|
-
description: zod.ZodOptional<zod.ZodString>;
|
|
36
|
-
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
37
|
-
}, zod.ZodTypeAny, "passthrough">>, "many">;
|
|
38
|
-
}>, zod.ZodTypeAny, "passthrough">>;
|
|
39
|
-
tools(): Promise<Record<string, any>>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { MastraMCPClient };
|
package/dist/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core/tools';
|
|
2
|
-
import { jsonSchemaToModel } from '@mastra/core/utils';
|
|
3
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
-
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
5
|
-
import { ListResourcesResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
|
|
7
|
-
// src/client.ts
|
|
8
|
-
var MastraMCPClient = class {
|
|
9
|
-
name;
|
|
10
|
-
transport;
|
|
11
|
-
client;
|
|
12
|
-
constructor({
|
|
13
|
-
name,
|
|
14
|
-
version = "1.0.0",
|
|
15
|
-
server,
|
|
16
|
-
capabilities = {}
|
|
17
|
-
}) {
|
|
18
|
-
this.name = name;
|
|
19
|
-
this.transport = new StdioClientTransport(server);
|
|
20
|
-
this.client = new Client(
|
|
21
|
-
{
|
|
22
|
-
name,
|
|
23
|
-
version
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
capabilities
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
async connect() {
|
|
31
|
-
return await this.client.connect(this.transport);
|
|
32
|
-
}
|
|
33
|
-
async disconnect() {
|
|
34
|
-
return await this.client.close();
|
|
35
|
-
}
|
|
36
|
-
async resources() {
|
|
37
|
-
return await this.client.request({ method: "resources/list" }, ListResourcesResultSchema);
|
|
38
|
-
}
|
|
39
|
-
async tools() {
|
|
40
|
-
const { tools } = await this.client.listTools();
|
|
41
|
-
const toolsRes = {};
|
|
42
|
-
tools.forEach((tool) => {
|
|
43
|
-
const s = jsonSchemaToModel(tool.inputSchema);
|
|
44
|
-
const mastraTool = createTool({
|
|
45
|
-
id: `${this.name}_${tool.name}`,
|
|
46
|
-
description: tool.description,
|
|
47
|
-
inputSchema: s,
|
|
48
|
-
execute: async ({ context }) => {
|
|
49
|
-
try {
|
|
50
|
-
const res = await this.client.callTool({
|
|
51
|
-
name: tool.name,
|
|
52
|
-
arguments: context
|
|
53
|
-
});
|
|
54
|
-
return res;
|
|
55
|
-
} catch (e) {
|
|
56
|
-
console.log("Error calling tool", tool.name);
|
|
57
|
-
console.error(e);
|
|
58
|
-
throw e;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
if (tool.name) {
|
|
63
|
-
toolsRes[tool.name] = mastraTool;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
return toolsRes;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export { MastraMCPClient };
|