@mastra/mcp 0.10.6 → 0.10.8-alpha.0

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/mcp@0.10.6-alpha.1 build /home/runner/work/mastra/mastra/packages/mcp
2
+ > @mastra/mcp@0.10.8-alpha.0 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
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 22460ms
9
+ TSC ⚡️ Build success in 22811ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 29484ms
16
+ DTS ⚡️ Build success in 31810ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
20
  ESM dist/index.js 88.94 KB
21
- ESM ⚡️ Build success in 2100ms
21
+ ESM ⚡️ Build success in 2367ms
22
22
  CJS dist/index.cjs 89.72 KB
23
- CJS ⚡️ Build success in 2103ms
23
+ CJS ⚡️ Build success in 2366ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp
2
2
 
3
+ ## 0.10.8-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - f42c4c2: update peer deps for packages to latest core range
8
+ - @mastra/core@0.12.0-alpha.5
9
+
10
+ ## 0.10.7
11
+
12
+ ### Patch Changes
13
+
14
+ - ce088f5: Update all peerdeps to latest core
15
+ - @mastra/core@0.11.1
16
+
3
17
  ## 0.10.6
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1022,7 +1022,7 @@ var MCPConfiguration = class extends MCPClient {
1022
1022
  }
1023
1023
  };
1024
1024
 
1025
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/utils/stream.js
1025
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/utils/stream.js
1026
1026
  var StreamingApi = class {
1027
1027
  writer;
1028
1028
  encoder;
@@ -1089,7 +1089,7 @@ var StreamingApi = class {
1089
1089
  }
1090
1090
  };
1091
1091
 
1092
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/helper/streaming/utils.js
1092
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/helper/streaming/utils.js
1093
1093
  var isOldBunVersion = () => {
1094
1094
  const version = typeof Bun !== "undefined" ? Bun.version : void 0;
1095
1095
  if (version === void 0) {
@@ -1100,7 +1100,7 @@ var isOldBunVersion = () => {
1100
1100
  return result;
1101
1101
  };
1102
1102
 
1103
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/utils/html.js
1103
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/utils/html.js
1104
1104
  var HtmlEscapedCallbackPhase = {
1105
1105
  Stringify: 1};
1106
1106
  var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
@@ -1131,7 +1131,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
1131
1131
  }
1132
1132
  };
1133
1133
 
1134
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/helper/streaming/sse.js
1134
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/helper/streaming/sse.js
1135
1135
  var SSEStreamingApi = class extends StreamingApi {
1136
1136
  constructor(writable, readable) {
1137
1137
  super(writable, readable);
package/dist/index.js CHANGED
@@ -1015,7 +1015,7 @@ var MCPConfiguration = class extends MCPClient {
1015
1015
  }
1016
1016
  };
1017
1017
 
1018
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/utils/stream.js
1018
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/utils/stream.js
1019
1019
  var StreamingApi = class {
1020
1020
  writer;
1021
1021
  encoder;
@@ -1082,7 +1082,7 @@ var StreamingApi = class {
1082
1082
  }
1083
1083
  };
1084
1084
 
1085
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/helper/streaming/utils.js
1085
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/helper/streaming/utils.js
1086
1086
  var isOldBunVersion = () => {
1087
1087
  const version = typeof Bun !== "undefined" ? Bun.version : void 0;
1088
1088
  if (version === void 0) {
@@ -1093,7 +1093,7 @@ var isOldBunVersion = () => {
1093
1093
  return result;
1094
1094
  };
1095
1095
 
1096
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/utils/html.js
1096
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/utils/html.js
1097
1097
  var HtmlEscapedCallbackPhase = {
1098
1098
  Stringify: 1};
1099
1099
  var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
@@ -1124,7 +1124,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
1124
1124
  }
1125
1125
  };
1126
1126
 
1127
- // ../../node_modules/.pnpm/hono@4.8.4/node_modules/hono/dist/helper/streaming/sse.js
1127
+ // ../../node_modules/.pnpm/hono@4.8.9/node_modules/hono/dist/helper/streaming/sse.js
1128
1128
  var SSEStreamingApi = class extends StreamingApi {
1129
1129
  constructor(writable, readable) {
1130
1130
  super(writable, readable);
@@ -10,9 +10,9 @@ case `uname` in
10
10
  esac
11
11
 
12
12
  if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.2_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_bcb3b08cf6e48f0a4d90e52d1b155bc5/node_modules/vitest/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.2_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_bcb3b08cf6e48f0a4d90e52d1b155bc5/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules"
13
+ export NODE_PATH="/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.9_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_0090e69ea15e68f4eaa34b37eb448faf/node_modules/vitest/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.9_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_0090e69ea15e68f4eaa34b37eb448faf/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules"
14
14
  else
15
- export NODE_PATH="/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.2_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_bcb3b08cf6e48f0a4d90e52d1b155bc5/node_modules/vitest/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.2_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_bcb3b08cf6e48f0a4d90e52d1b155bc5/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules:$NODE_PATH"
15
+ export NODE_PATH="/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.9_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_0090e69ea15e68f4eaa34b37eb448faf/node_modules/vitest/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.9_@vitest+ui@3.2.3_jiti@2.4.2_jsdom@_0090e69ea15e68f4eaa34b37eb448faf/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules:$NODE_PATH"
16
16
  fi
17
17
  if [ -x "$basedir/node" ]; then
18
18
  exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@"
@@ -20,10 +20,10 @@
20
20
  "@types/node": "^20.17.57",
21
21
  "get-port": "^7.1.0",
22
22
  "mastra": "workspace:*",
23
- "typescript": "^5.8.2",
23
+ "typescript": "^5.8.3",
24
24
  "vitest": "^3.2.4"
25
25
  },
26
26
  "peerDependencies": {
27
- "@mastra/core": "^0.10.0-alpha.0"
27
+ "@mastra/core": ">=0.10.7-0 <0.13.0-0"
28
28
  }
29
29
  }
@@ -3,18 +3,32 @@ import { createTool } from '@mastra/core';
3
3
  import { Agent } from '@mastra/core/agent';
4
4
  import { z } from 'zod';
5
5
  import { weatherTool } from '../tools/weather';
6
+ import { MCPClient } from '@mastra/mcp';
7
+
8
+ const client = new MCPClient({
9
+ id: 'weather-server',
10
+ servers: {
11
+ weather: {
12
+ url: new URL(`http://localhost:4114/api/mcp/myMcpServer/mcp`),
13
+ },
14
+ },
15
+ });
6
16
 
7
17
  export const weatherAgent = new Agent({
8
18
  name: 'test',
9
19
  instructions:
10
20
  'You are a weather agent. When asked about weather in any city, use the get_weather tool with the city name as the postal code. When asked for clipboard contents you also get that.',
11
21
  model: openai('gpt-4o'),
12
- tools: {
13
- get_weather: weatherTool,
14
- clipboard: createTool({
15
- id: 'clipboard',
16
- description: 'Returns the contents of the users clipboard',
17
- inputSchema: z.object({}),
18
- }),
22
+ tools: async () => {
23
+ const tools = await client.getTools();
24
+ return {
25
+ get_weather: weatherTool,
26
+ clipboard: createTool({
27
+ id: 'clipboard',
28
+ description: 'Returns the contents of the users clipboard',
29
+ inputSchema: z.object({}),
30
+ }),
31
+ ...tools,
32
+ };
19
33
  },
20
34
  });
@@ -9,4 +9,7 @@ export const mastra = new Mastra({
9
9
  mcpServers: {
10
10
  myMcpServer,
11
11
  },
12
+ server: {
13
+ port: 4114,
14
+ },
12
15
  });
@@ -2,21 +2,18 @@ import { spawn } from 'node:child_process';
2
2
  import { MCPClient } from '@mastra/mcp';
3
3
  import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
4
4
  import { ServerInfo } from '@mastra/core/mcp';
5
- import getPort from 'get-port';
6
5
  import path from 'node:path';
7
6
 
8
7
  vi.setConfig({ testTimeout: 20000, hookTimeout: 20000 });
9
8
 
10
9
  describe('MCPServer through Mastra HTTP Integration (Subprocess)', () => {
11
10
  let mastraServer: ReturnType<typeof spawn>;
12
- let port: number;
11
+ const port: number = 4114;
13
12
  const mcpServerId = 'myMcpServer';
14
13
  const testToolId = 'calculator';
15
14
  let client: MCPClient;
16
15
 
17
16
  beforeAll(async () => {
18
- port = await getPort();
19
-
20
17
  mastraServer = spawn(
21
18
  'pnpm',
22
19
  [
@@ -228,5 +225,14 @@ describe('MCPServer through Mastra HTTP Integration (Subprocess)', () => {
228
225
  expect(body.next).toBeNull();
229
226
  }
230
227
  });
228
+
229
+ it('Should be able to get lazy loaded tools', async () => {
230
+ const agent = await fetch(`http://localhost:${port}/api/agents/test`);
231
+ const agentJson = await agent.json();
232
+ const tools = agentJson.tools;
233
+
234
+ expect(tools).toHaveProperty('weather_fetchWeather');
235
+ expect(Object.keys(tools).length).toBe(4);
236
+ });
231
237
  });
232
238
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp",
3
- "version": "0.10.6",
3
+ "version": "0.10.8-alpha.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,28 +31,28 @@
31
31
  "zod-from-json-schema": "^0.0.5"
32
32
  },
33
33
  "peerDependencies": {
34
- "@mastra/core": "^0.10.2-alpha.0",
34
+ "@mastra/core": ">=0.10.2-0 <0.13.0-0",
35
35
  "zod": "^3.0.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@ai-sdk/anthropic": "^1.2.12",
39
39
  "@ai-sdk/openai": "^1.3.22",
40
- "@hono/node-server": "^1.14.4",
41
- "@mendable/firecrawl-js": "^1.25.5",
40
+ "@hono/node-server": "^1.17.1",
41
+ "@mendable/firecrawl-js": "^1.29.2",
42
42
  "@microsoft/api-extractor": "^7.52.8",
43
43
  "@types/node": "^20.19.0",
44
44
  "ai": "4.3.16",
45
- "eslint": "^9.29.0",
45
+ "eslint": "^9.30.1",
46
46
  "hono-mcp-server-sse-transport": "0.0.7",
47
- "hono": "^4.8.4",
47
+ "hono": "^4.8.9",
48
48
  "tsup": "^8.5.0",
49
49
  "tsx": "^4.19.4",
50
50
  "typescript": "^5.8.3",
51
51
  "vitest": "^3.2.4",
52
52
  "zod": "^3.25.67",
53
53
  "zod-to-json-schema": "^3.24.5",
54
- "@internal/lint": "0.0.18",
55
- "@mastra/core": "0.10.11"
54
+ "@mastra/core": "0.12.0-alpha.5",
55
+ "@internal/lint": "0.0.23"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
@@ -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