@mastra/mcp 1.11.0-alpha.0 → 1.12.0-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @mastra/mcp
2
2
 
3
+ ## 1.12.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `MCPClient.listToolsWithErrors()` to return namespaced tools alongside per-server discovery errors. ([#18030](https://github.com/mastra-ai/mastra/pull/18030))
8
+
9
+ Example:
10
+
11
+ ```ts
12
+ const { tools, errors } = await mcp.listToolsWithErrors();
13
+
14
+ new Agent({
15
+ name: 'assistant',
16
+ tools,
17
+ });
18
+
19
+ if (Object.keys(errors).length > 0) {
20
+ console.error(errors);
21
+ }
22
+ ```
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`5bd72d2`](https://github.com/mastra-ai/mastra/commit/5bd72d255f45b5ea8ab342643bd463814a980a24), [`1cc9ee1`](https://github.com/mastra-ai/mastra/commit/1cc9ee1ba51db53020a735626d33017a60b4b5b3), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`30ebaf0`](https://github.com/mastra-ai/mastra/commit/30ebaf07bed5f4d30f2f257836c15d1bf7e40aae), [`5704634`](https://github.com/mastra-ai/mastra/commit/5704634b22133167dea337a942a34f57aaa3fa14), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`c0eda2b`](https://github.com/mastra-ai/mastra/commit/c0eda2bcd91a228427314b12c91d8b147f3a739f), [`c0eda2b`](https://github.com/mastra-ai/mastra/commit/c0eda2bcd91a228427314b12c91d8b147f3a739f), [`b13925b`](https://github.com/mastra-ai/mastra/commit/b13925bfa91aa8700f56fa54a9ce707ee7e4ba62), [`bf94ec6`](https://github.com/mastra-ai/mastra/commit/bf94ec68192d9f16e46ef7e5ac36370aeeddf35d), [`a29f371`](https://github.com/mastra-ai/mastra/commit/a29f371aef629ac8562661524a497127e93b5131), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`073f910`](https://github.com/mastra-ai/mastra/commit/073f910481e7d94b95ba3830f96531774ae95d33), [`ebbe1d3`](https://github.com/mastra-ai/mastra/commit/ebbe1d31a965a3adb0e728758f326b8122b4b55f), [`1f97ce5`](https://github.com/mastra-ai/mastra/commit/1f97ce5695463bebb4eaacf501da6fb403e20885), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`64f58c0`](https://github.com/mastra-ai/mastra/commit/64f58c04e78b40137497d47f781e897e416f22a5), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`ebbe1d3`](https://github.com/mastra-ai/mastra/commit/ebbe1d31a965a3adb0e728758f326b8122b4b55f), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`8e25a78`](https://github.com/mastra-ai/mastra/commit/8e25a78e0597575f0b0729bae8c5e190c84869b5), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`a5b22d3`](https://github.com/mastra-ai/mastra/commit/a5b22d314d62a68d801886a8d3d0eb6c089473db), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858)]:
27
+ - @mastra/core@1.46.0-alpha.0
28
+
29
+ ## 1.11.0
30
+
31
+ ### Minor Changes
32
+
33
+ - Random bump ([#18178](https://github.com/mastra-ai/mastra/pull/18178))
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [[`7c0d868`](https://github.com/mastra-ai/mastra/commit/7c0d868d97d0fdbc04c14d0166dbf44d4c5a4a62), [`d9d2273`](https://github.com/mastra-ai/mastra/commit/d9d2273c702690c9a26eab2aebea879701d4355a), [`b04369d`](https://github.com/mastra-ai/mastra/commit/b04369d6b167c698ef103981171a8bf92808e756), [`8f3c262`](https://github.com/mastra-ai/mastra/commit/8f3c262587b335588a02d96b17fd6aca34c885b3)]:
38
+ - @mastra/core@1.45.0
39
+
3
40
  ## 1.11.0-alpha.0
4
41
 
5
42
  ### Minor Changes
@@ -21,7 +21,8 @@ export type { Env, ErrorHandler, Handler, MiddlewareHandler, Next, NotFoundRespo
21
21
  /**
22
22
  * Types for context, context variable map, context renderer, and execution context.
23
23
  */
24
- export type { Context, ContextVariableMap, ContextRenderer, ExecutionContext } from './context';
24
+ export { Context } from './context';
25
+ export type { ContextVariableMap, ContextRenderer, ExecutionContext } from './context';
25
26
  /**
26
27
  * Type for HonoRequest.
27
28
  */
@@ -16,25 +16,25 @@ declare const _baseMimes: {
16
16
  readonly av1: "video/av1";
17
17
  readonly bin: "application/octet-stream";
18
18
  readonly bmp: "image/bmp";
19
- readonly css: "text/css";
20
- readonly csv: "text/csv";
19
+ readonly css: "text/css; charset=utf-8";
20
+ readonly csv: "text/csv; charset=utf-8";
21
21
  readonly eot: "application/vnd.ms-fontobject";
22
22
  readonly epub: "application/epub+zip";
23
23
  readonly gif: "image/gif";
24
24
  readonly gz: "application/gzip";
25
- readonly htm: "text/html";
26
- readonly html: "text/html";
25
+ readonly htm: "text/html; charset=utf-8";
26
+ readonly html: "text/html; charset=utf-8";
27
27
  readonly ico: "image/x-icon";
28
- readonly ics: "text/calendar";
28
+ readonly ics: "text/calendar; charset=utf-8";
29
29
  readonly jpeg: "image/jpeg";
30
30
  readonly jpg: "image/jpeg";
31
- readonly js: "text/javascript";
31
+ readonly js: "text/javascript; charset=utf-8";
32
32
  readonly json: "application/json";
33
33
  readonly jsonld: "application/ld+json";
34
34
  readonly map: "application/json";
35
35
  readonly mid: "audio/x-midi";
36
36
  readonly midi: "audio/x-midi";
37
- readonly mjs: "text/javascript";
37
+ readonly mjs: "text/javascript; charset=utf-8";
38
38
  readonly mp3: "audio/mpeg";
39
39
  readonly mp4: "video/mp4";
40
40
  readonly mpeg: "video/mpeg";
@@ -46,12 +46,12 @@ declare const _baseMimes: {
46
46
  readonly pdf: "application/pdf";
47
47
  readonly png: "image/png";
48
48
  readonly rtf: "application/rtf";
49
- readonly svg: "image/svg+xml";
49
+ readonly svg: "image/svg+xml; charset=utf-8";
50
50
  readonly tif: "image/tiff";
51
51
  readonly tiff: "image/tiff";
52
52
  readonly ts: "video/mp2t";
53
53
  readonly ttf: "font/ttf";
54
- readonly txt: "text/plain";
54
+ readonly txt: "text/plain; charset=utf-8";
55
55
  readonly wasm: "application/wasm";
56
56
  readonly webm: "video/webm";
57
57
  readonly weba: "audio/webm";
@@ -59,8 +59,8 @@ declare const _baseMimes: {
59
59
  readonly webp: "image/webp";
60
60
  readonly woff: "font/woff";
61
61
  readonly woff2: "font/woff2";
62
- readonly xhtml: "application/xhtml+xml";
63
- readonly xml: "application/xml";
62
+ readonly xhtml: "application/xhtml+xml; charset=utf-8";
63
+ readonly xml: "application/xml; charset=utf-8";
64
64
  readonly zip: "application/zip";
65
65
  readonly '3gp': "video/3gpp";
66
66
  readonly '3g2': "video/3gpp2";
@@ -562,6 +562,28 @@ export declare class MCPClient extends MastraBase {
562
562
  * ```
563
563
  */
564
564
  listTools(): Promise<Record<string, Tool<any, any, any, any>>>;
565
+ /**
566
+ * Retrieves all tools from all configured servers with namespaced names,
567
+ * along with any per-server errors.
568
+ *
569
+ * Like listTools(), but also returns errors for servers that failed to connect
570
+ * or list tools. This allows callers to report specific failure reasons per server.
571
+ *
572
+ * @returns Object with `tools` (successful tools) and `errors` (failed servers with error messages).
573
+ * Transient connection failures are retried once after reconnecting the affected server.
574
+ *
575
+ * @example
576
+ * ```typescript
577
+ * const { tools, errors } = await mcp.listToolsWithErrors();
578
+ * for (const [name, err] of Object.entries(errors)) {
579
+ * console.error(`Server ${name} failed: ${err}`);
580
+ * }
581
+ * ```
582
+ */
583
+ listToolsWithErrors(): Promise<{
584
+ tools: Record<string, Tool<any, any, any, any>>;
585
+ errors: Record<string, string>;
586
+ }>;
565
587
  /**
566
588
  * Returns toolsets organized by server name for dynamic tool injection.
567
589
  *
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/client/configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACN,QAAQ,EACR,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAO1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wHAAwH;IACxH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACnD,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,aAAa,CAAiD;IACtE,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,C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,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAK9F;;;;;;;;;;;;;;;;OAgBG;IACU,sBAAsB,IAAI,OAAO,CAAC;QAC7C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACnE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IAgCF;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAU1D;;;;;;;;;;;;;;OAcG;IACH,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQvC;IAED;;;;;;;;OAQG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;YAM3C,kBAAkB;YA0DlB,2BAA2B;YAQ3B,iBAAiB;CAuBhC"}
@@ -3,7 +3,7 @@ name: mastra-mcp
3
3
  description: Documentation for @mastra/mcp. Use when working with @mastra/mcp APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mcp"
6
- version: "1.11.0-alpha.0"
6
+ version: "1.12.0-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0-alpha.0",
2
+ "version": "1.12.0-alpha.0",
3
3
  "package": "@mastra/mcp",
4
4
  "exports": {
5
5
  "UnauthorizedError": {
@@ -167,6 +167,17 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
167
167
  new Agent({ id: 'agent', tools: await mcp.listTools() })
168
168
  ```
169
169
 
170
+ ### `listToolsWithErrors()`
171
+
172
+ Retrieves all tools from all configured servers, with tool names namespaced by their server name. Also returns per-server errors for servers that failed to connect or list tools.
173
+
174
+ ```typescript
175
+ const { tools, errors } = await mcp.listToolsWithErrors()
176
+
177
+ new Agent({ id: 'agent', tools })
178
+ console.log(errors)
179
+ ```
180
+
170
181
  ### `listToolsets()`
171
182
 
172
183
  Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed dynamically into the generate or stream method.
package/dist/index.cjs CHANGED
@@ -1934,8 +1934,31 @@ To fix this you have three different options:
1934
1934
  * ```
1935
1935
  */
1936
1936
  async listTools() {
1937
+ const result = await this.listToolsWithErrors();
1938
+ return result.tools;
1939
+ }
1940
+ /**
1941
+ * Retrieves all tools from all configured servers with namespaced names,
1942
+ * along with any per-server errors.
1943
+ *
1944
+ * Like listTools(), but also returns errors for servers that failed to connect
1945
+ * or list tools. This allows callers to report specific failure reasons per server.
1946
+ *
1947
+ * @returns Object with `tools` (successful tools) and `errors` (failed servers with error messages).
1948
+ * Transient connection failures are retried once after reconnecting the affected server.
1949
+ *
1950
+ * @example
1951
+ * ```typescript
1952
+ * const { tools, errors } = await mcp.listToolsWithErrors();
1953
+ * for (const [name, err] of Object.entries(errors)) {
1954
+ * console.error(`Server ${name} failed: ${err}`);
1955
+ * }
1956
+ * ```
1957
+ */
1958
+ async listToolsWithErrors() {
1937
1959
  this.addToInstanceCache();
1938
1960
  const connectedTools = {};
1961
+ const errors = {};
1939
1962
  for (const serverName of Object.keys(this.serverConfigs)) {
1940
1963
  try {
1941
1964
  const tools = await this.getToolsForServer(serverName);
@@ -1956,9 +1979,10 @@ To fix this you have three different options:
1956
1979
  );
1957
1980
  this.logger.trackException(mastraError);
1958
1981
  this.logger.error("Failed to list tools from server:", { error: mastraError.toString() });
1982
+ errors[serverName] = error$1 instanceof Error ? error$1.message : String(error$1);
1959
1983
  }
1960
1984
  }
1961
- return connectedTools;
1985
+ return { tools: connectedTools, errors };
1962
1986
  }
1963
1987
  /**
1964
1988
  * Returns toolsets organized by server name for dynamic tool injection.
@@ -2357,7 +2381,7 @@ function createSimpleTokenProvider(accessToken, options) {
2357
2381
  });
2358
2382
  }
2359
2383
 
2360
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/utils/stream.js
2384
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/utils/stream.js
2361
2385
  var StreamingApi = class {
2362
2386
  writer;
2363
2387
  encoder;
@@ -2436,7 +2460,7 @@ var StreamingApi = class {
2436
2460
  }
2437
2461
  };
2438
2462
 
2439
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/helper/streaming/utils.js
2463
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/helper/streaming/utils.js
2440
2464
  var isOldBunVersion = () => {
2441
2465
  const version = typeof Bun !== "undefined" ? Bun.version : void 0;
2442
2466
  if (version === void 0) {
@@ -2447,7 +2471,7 @@ var isOldBunVersion = () => {
2447
2471
  return result;
2448
2472
  };
2449
2473
 
2450
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/utils/html.js
2474
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/utils/html.js
2451
2475
  var HtmlEscapedCallbackPhase = {
2452
2476
  Stringify: 1};
2453
2477
  var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
@@ -2478,7 +2502,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
2478
2502
  }
2479
2503
  };
2480
2504
 
2481
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.21/c401a6c1b505d0adf80740e6e7d31122a2ebd9abaf1de7e5dee418ae2a608e7a/node_modules/hono/dist/helper/streaming/sse.js
2505
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/helper/streaming/sse.js
2482
2506
  var SSEStreamingApi = class extends StreamingApi {
2483
2507
  constructor(writable, readable) {
2484
2508
  super(writable, readable);