@mastra/mcp 0.10.1 → 0.10.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +17 -0
- package/dist/_tsup-dts-rollup.d.cts +3 -0
- package/dist/_tsup-dts-rollup.d.ts +3 -0
- package/dist/index.cjs +8 -4
- package/dist/index.js +8 -4
- package/integration-tests/package.json +1 -1
- package/package.json +3 -3
- package/src/server/server.test.ts +1 -1
- package/src/server/server.ts +11 -2
- package/integration-tests/node_modules/.bin/mastra +0 -21
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mcp@0.10.
|
|
2
|
+
> @mastra/mcp@0.10.2-alpha.1 build /home/runner/work/mastra/mastra/packages/mcp
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 17620ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 17814ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m58.50 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 1043ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m58.29 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 1403ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.10.2-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f0d559f: Fix peerdeps for alpha channel
|
|
8
|
+
- Updated dependencies [1e8bb40]
|
|
9
|
+
- @mastra/core@0.10.2-alpha.2
|
|
10
|
+
|
|
11
|
+
## 0.10.2-alpha.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 592a2db: Added different icons for agents and workflows in mcp tools list
|
|
16
|
+
- Updated dependencies [592a2db]
|
|
17
|
+
- Updated dependencies [e5dc18d]
|
|
18
|
+
- @mastra/core@0.10.2-alpha.0
|
|
19
|
+
|
|
3
20
|
## 0.10.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ import { MCPServerBase } from '@mastra/core/mcp';
|
|
|
9
9
|
import type { MCPServerConfig } from '@mastra/core/mcp';
|
|
10
10
|
import type { MCPServerHonoSSEOptions } from '@mastra/core/mcp';
|
|
11
11
|
import type { MCPServerSSEOptions } from '@mastra/core/mcp';
|
|
12
|
+
import type { MCPToolType } from '@mastra/core/mcp';
|
|
12
13
|
import { objectInputType } from 'zod';
|
|
13
14
|
import { objectOutputType } from 'zod';
|
|
14
15
|
import { objectUtil } from 'zod';
|
|
@@ -486,6 +487,7 @@ declare class MCPServer extends MCPServerBase {
|
|
|
486
487
|
name: string;
|
|
487
488
|
description?: string;
|
|
488
489
|
inputSchema: any;
|
|
490
|
+
toolType?: MCPToolType;
|
|
489
491
|
}>;
|
|
490
492
|
};
|
|
491
493
|
/**
|
|
@@ -497,6 +499,7 @@ declare class MCPServer extends MCPServerBase {
|
|
|
497
499
|
name: string;
|
|
498
500
|
description?: string;
|
|
499
501
|
inputSchema: any;
|
|
502
|
+
toolType?: MCPToolType;
|
|
500
503
|
} | undefined;
|
|
501
504
|
/**
|
|
502
505
|
* Executes a specific tool provided by this MCP server.
|
|
@@ -9,6 +9,7 @@ import { MCPServerBase } from '@mastra/core/mcp';
|
|
|
9
9
|
import type { MCPServerConfig } from '@mastra/core/mcp';
|
|
10
10
|
import type { MCPServerHonoSSEOptions } from '@mastra/core/mcp';
|
|
11
11
|
import type { MCPServerSSEOptions } from '@mastra/core/mcp';
|
|
12
|
+
import type { MCPToolType } from '@mastra/core/mcp';
|
|
12
13
|
import { objectInputType } from 'zod';
|
|
13
14
|
import { objectOutputType } from 'zod';
|
|
14
15
|
import { objectUtil } from 'zod';
|
|
@@ -486,6 +487,7 @@ declare class MCPServer extends MCPServerBase {
|
|
|
486
487
|
name: string;
|
|
487
488
|
description?: string;
|
|
488
489
|
inputSchema: any;
|
|
490
|
+
toolType?: MCPToolType;
|
|
489
491
|
}>;
|
|
490
492
|
};
|
|
491
493
|
/**
|
|
@@ -497,6 +499,7 @@ declare class MCPServer extends MCPServerBase {
|
|
|
497
499
|
name: string;
|
|
498
500
|
description?: string;
|
|
499
501
|
inputSchema: any;
|
|
502
|
+
toolType?: MCPToolType;
|
|
500
503
|
} | undefined;
|
|
501
504
|
/**
|
|
502
505
|
* Executes a specific tool provided by this MCP server.
|
package/dist/index.cjs
CHANGED
|
@@ -955,7 +955,8 @@ var MCPServer = class extends mcp.MCPServerBase {
|
|
|
955
955
|
name: agentToolName,
|
|
956
956
|
description: coreTool.description,
|
|
957
957
|
parameters: coreTool.parameters,
|
|
958
|
-
execute: coreTool.execute
|
|
958
|
+
execute: coreTool.execute,
|
|
959
|
+
toolType: "agent"
|
|
959
960
|
};
|
|
960
961
|
this.logger.info(`Registered agent '${agent$1.name}' (key: '${agentKey}') as tool: '${agentToolName}'`);
|
|
961
962
|
}
|
|
@@ -1021,7 +1022,8 @@ var MCPServer = class extends mcp.MCPServerBase {
|
|
|
1021
1022
|
name: workflowToolName,
|
|
1022
1023
|
description: coreTool.description,
|
|
1023
1024
|
parameters: coreTool.parameters,
|
|
1024
|
-
execute: coreTool.execute
|
|
1025
|
+
execute: coreTool.execute,
|
|
1026
|
+
toolType: "workflow"
|
|
1025
1027
|
};
|
|
1026
1028
|
this.logger.info(`Registered workflow '${workflow.id}' (key: '${workflowKey}') as tool: '${workflowToolName}'`);
|
|
1027
1029
|
}
|
|
@@ -1560,7 +1562,8 @@ var MCPServer = class extends mcp.MCPServerBase {
|
|
|
1560
1562
|
id: toolId,
|
|
1561
1563
|
name: tool.name,
|
|
1562
1564
|
description: tool.description,
|
|
1563
|
-
inputSchema: tool.parameters?.jsonSchema || tool.parameters
|
|
1565
|
+
inputSchema: tool.parameters?.jsonSchema || tool.parameters,
|
|
1566
|
+
toolType: tool.toolType
|
|
1564
1567
|
}))
|
|
1565
1568
|
};
|
|
1566
1569
|
}
|
|
@@ -1579,7 +1582,8 @@ var MCPServer = class extends mcp.MCPServerBase {
|
|
|
1579
1582
|
return {
|
|
1580
1583
|
name: tool.name,
|
|
1581
1584
|
description: tool.description,
|
|
1582
|
-
inputSchema: tool.parameters?.jsonSchema || tool.parameters
|
|
1585
|
+
inputSchema: tool.parameters?.jsonSchema || tool.parameters,
|
|
1586
|
+
toolType: tool.toolType
|
|
1583
1587
|
};
|
|
1584
1588
|
}
|
|
1585
1589
|
/**
|
package/dist/index.js
CHANGED
|
@@ -949,7 +949,8 @@ var MCPServer = class extends MCPServerBase {
|
|
|
949
949
|
name: agentToolName,
|
|
950
950
|
description: coreTool.description,
|
|
951
951
|
parameters: coreTool.parameters,
|
|
952
|
-
execute: coreTool.execute
|
|
952
|
+
execute: coreTool.execute,
|
|
953
|
+
toolType: "agent"
|
|
953
954
|
};
|
|
954
955
|
this.logger.info(`Registered agent '${agent.name}' (key: '${agentKey}') as tool: '${agentToolName}'`);
|
|
955
956
|
}
|
|
@@ -1015,7 +1016,8 @@ var MCPServer = class extends MCPServerBase {
|
|
|
1015
1016
|
name: workflowToolName,
|
|
1016
1017
|
description: coreTool.description,
|
|
1017
1018
|
parameters: coreTool.parameters,
|
|
1018
|
-
execute: coreTool.execute
|
|
1019
|
+
execute: coreTool.execute,
|
|
1020
|
+
toolType: "workflow"
|
|
1019
1021
|
};
|
|
1020
1022
|
this.logger.info(`Registered workflow '${workflow.id}' (key: '${workflowKey}') as tool: '${workflowToolName}'`);
|
|
1021
1023
|
}
|
|
@@ -1554,7 +1556,8 @@ var MCPServer = class extends MCPServerBase {
|
|
|
1554
1556
|
id: toolId,
|
|
1555
1557
|
name: tool.name,
|
|
1556
1558
|
description: tool.description,
|
|
1557
|
-
inputSchema: tool.parameters?.jsonSchema || tool.parameters
|
|
1559
|
+
inputSchema: tool.parameters?.jsonSchema || tool.parameters,
|
|
1560
|
+
toolType: tool.toolType
|
|
1558
1561
|
}))
|
|
1559
1562
|
};
|
|
1560
1563
|
}
|
|
@@ -1573,7 +1576,8 @@ var MCPServer = class extends MCPServerBase {
|
|
|
1573
1576
|
return {
|
|
1574
1577
|
name: tool.name,
|
|
1575
1578
|
description: tool.description,
|
|
1576
|
-
inputSchema: tool.parameters?.jsonSchema || tool.parameters
|
|
1579
|
+
inputSchema: tool.parameters?.jsonSchema || tool.parameters,
|
|
1580
|
+
toolType: tool.toolType
|
|
1577
1581
|
};
|
|
1578
1582
|
}
|
|
1579
1583
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp",
|
|
3
|
-
"version": "0.10.1",
|
|
3
|
+
"version": "0.10.2-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"zod": "^3.0.0",
|
|
35
|
-
"@mastra/core": "^0.10.0"
|
|
35
|
+
"@mastra/core": "^0.10.1-alpha.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@ai-sdk/anthropic": "^1.1.15",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"zod": "^3.24.3",
|
|
52
52
|
"zod-to-json-schema": "^3.24.5",
|
|
53
53
|
"@internal/lint": "0.0.7",
|
|
54
|
-
"@mastra/core": "0.10.
|
|
54
|
+
"@mastra/core": "0.10.2-alpha.2"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
|
@@ -1077,7 +1077,7 @@ describe('MCPServer - Workflow to Tool Conversion', () => {
|
|
|
1077
1077
|
const inputData = { data: 'Hello Workflow' };
|
|
1078
1078
|
if (workflowTool && workflowTool.execute) {
|
|
1079
1079
|
const result = await workflowTool.execute(inputData, { toolCallId: 'mcp-wf-call-123', messages: [] });
|
|
1080
|
-
expect(result).
|
|
1080
|
+
expect(result).toMatchObject({
|
|
1081
1081
|
status: 'success',
|
|
1082
1082
|
steps: {
|
|
1083
1083
|
input: { data: 'Hello Workflow' },
|
package/src/server/server.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
ConvertedTool,
|
|
13
13
|
MCPServerHonoSSEOptions,
|
|
14
14
|
MCPServerSSEOptions,
|
|
15
|
+
MCPToolType,
|
|
15
16
|
} from '@mastra/core/mcp';
|
|
16
17
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
17
18
|
import type { Workflow } from '@mastra/core/workflows';
|
|
@@ -217,6 +218,7 @@ export class MCPServer extends MCPServerBase {
|
|
|
217
218
|
description: coreTool.description,
|
|
218
219
|
parameters: coreTool.parameters,
|
|
219
220
|
execute: coreTool.execute!,
|
|
221
|
+
toolType: 'agent',
|
|
220
222
|
};
|
|
221
223
|
this.logger.info(`Registered agent '${agent.name}' (key: '${agentKey}') as tool: '${agentToolName}'`);
|
|
222
224
|
}
|
|
@@ -295,6 +297,7 @@ export class MCPServer extends MCPServerBase {
|
|
|
295
297
|
description: coreTool.description,
|
|
296
298
|
parameters: coreTool.parameters,
|
|
297
299
|
execute: coreTool.execute!,
|
|
300
|
+
toolType: 'workflow',
|
|
298
301
|
};
|
|
299
302
|
this.logger.info(`Registered workflow '${workflow.id}' (key: '${workflowKey}') as tool: '${workflowToolName}'`);
|
|
300
303
|
}
|
|
@@ -903,7 +906,9 @@ export class MCPServer extends MCPServerBase {
|
|
|
903
906
|
* This leverages the same tool information used by the internal ListTools MCP request.
|
|
904
907
|
* @returns An object containing an array of tool information.
|
|
905
908
|
*/
|
|
906
|
-
public getToolListInfo(): {
|
|
909
|
+
public getToolListInfo(): {
|
|
910
|
+
tools: Array<{ name: string; description?: string; inputSchema: any; toolType?: MCPToolType }>;
|
|
911
|
+
} {
|
|
907
912
|
this.logger.debug(`Getting tool list information for MCPServer '${this.name}'`);
|
|
908
913
|
return {
|
|
909
914
|
tools: Object.entries(this.convertedTools).map(([toolId, tool]) => ({
|
|
@@ -911,6 +916,7 @@ export class MCPServer extends MCPServerBase {
|
|
|
911
916
|
name: tool.name,
|
|
912
917
|
description: tool.description,
|
|
913
918
|
inputSchema: tool.parameters?.jsonSchema || tool.parameters,
|
|
919
|
+
toolType: tool.toolType,
|
|
914
920
|
})),
|
|
915
921
|
};
|
|
916
922
|
}
|
|
@@ -920,7 +926,9 @@ export class MCPServer extends MCPServerBase {
|
|
|
920
926
|
* @param toolId The ID/name of the tool to retrieve.
|
|
921
927
|
* @returns Tool information (name, description, inputSchema) or undefined if not found.
|
|
922
928
|
*/
|
|
923
|
-
public getToolInfo(
|
|
929
|
+
public getToolInfo(
|
|
930
|
+
toolId: string,
|
|
931
|
+
): { name: string; description?: string; inputSchema: any; toolType?: MCPToolType } | undefined {
|
|
924
932
|
const tool = this.convertedTools[toolId];
|
|
925
933
|
if (!tool) {
|
|
926
934
|
this.logger.debug(`Tool '${toolId}' not found on MCPServer '${this.name}'`);
|
|
@@ -931,6 +939,7 @@ export class MCPServer extends MCPServerBase {
|
|
|
931
939
|
name: tool.name,
|
|
932
940
|
description: tool.description,
|
|
933
941
|
inputSchema: tool.parameters?.jsonSchema || tool.parameters,
|
|
942
|
+
toolType: tool.toolType,
|
|
934
943
|
};
|
|
935
944
|
}
|
|
936
945
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/mastra/mastra/packages/cli/dist/node_modules:/home/runner/work/mastra/mastra/packages/cli/node_modules:/home/runner/work/mastra/mastra/packages/node_modules:/home/runner/work/mastra/mastra/node_modules:/home/runner/work/mastra/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/mastra/mastra/packages/cli/dist/node_modules:/home/runner/work/mastra/mastra/packages/cli/node_modules:/home/runner/work/mastra/mastra/packages/node_modules:/home/runner/work/mastra/mastra/node_modules:/home/runner/work/mastra/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../mastra/dist/index.js" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../mastra/dist/index.js" "$@"
|
|
21
|
-
fi
|