@mastra/mcp 1.17.1 → 1.17.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/CHANGELOG.md +54 -0
- package/dist/client/client.d.ts +24 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +47 -7
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/error-utils.d.ts +20 -0
- package/dist/client/error-utils.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-tools-mcp-client.md +41 -9
- package/dist/index.cjs +240 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +238 -81
- package/dist/index.js.map +1 -1
- package/dist/server/promptActions.d.ts +2 -4
- package/dist/server/promptActions.d.ts.map +1 -1
- package/dist/server/server.d.ts +0 -1
- package/dist/server/server.d.ts.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 1.17.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Preserve structured HTTP status and transport codes in aggregate MCP discovery errors while retaining legacy string errors. ([#22218](https://github.com/mastra-ai/mastra/pull/22218))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
const { errorDetails } = await mcp.listToolsWithErrors();
|
|
11
|
+
if (errorDetails.weather?.httpStatus === 503) {
|
|
12
|
+
// Apply a transient-failure policy without parsing the legacy error string.
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- Fixed dynamic prompt providers leaking prompts across authenticated callers. ([#22214](https://github.com/mastra-ai/mastra/pull/22214))
|
|
17
|
+
|
|
18
|
+
- Fixed MCP tool results with structured output dropping the result-level `_meta` from the server's CallToolResult. The metadata (for example `_meta.ui.resourceUri`, which MCP Apps hosts use to detect and render an app) is now preserved on the returned structured result and can be read with the new `getMcpCallToolMeta` helper. The existing hidden MCP content channel is also now readable via the exported `getMcpCallToolContent` helper. Fixes https://github.com/mastra-ai/mastra/issues/21278 ([#22102](https://github.com/mastra-ai/mastra/pull/22102))
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`79f04a7`](https://github.com/mastra-ai/mastra/commit/79f04a7f6c6829da541139f638f2f1d267916e08), [`65edab1`](https://github.com/mastra-ai/mastra/commit/65edab1c233d17b8f163bad12fca410d0e6f16b1), [`1e47b75`](https://github.com/mastra-ai/mastra/commit/1e47b7520cab4cfaa8daed52f17e2e6d14ff7539), [`ab20a38`](https://github.com/mastra-ai/mastra/commit/ab20a38d0275f8d85e0f3833bd87ef487bcc609f), [`fd4d5fe`](https://github.com/mastra-ai/mastra/commit/fd4d5fe4f943699b85db5e74404f190d5a6b8c2a), [`ae8790c`](https://github.com/mastra-ai/mastra/commit/ae8790c4bfaa088d2ab279d1dcc06f326b9fd109), [`2c85f42`](https://github.com/mastra-ai/mastra/commit/2c85f428e04ccd63ea31a7ec80b5b327afdad555), [`11bbeb9`](https://github.com/mastra-ai/mastra/commit/11bbeb9b108ef2264e05acefc6dafb9cbb342921), [`48ef1f1`](https://github.com/mastra-ai/mastra/commit/48ef1f1d24eedafbb07f64e659a81b52b67b8bf6), [`aa3a85d`](https://github.com/mastra-ai/mastra/commit/aa3a85daf094c683bb97efdf4b6a696d2e474af5), [`d29d06f`](https://github.com/mastra-ai/mastra/commit/d29d06fe00bbd35b4571150ea04c59d2ed783c71), [`e6516df`](https://github.com/mastra-ai/mastra/commit/e6516dfcdae4f4ac0e7971d84359a81385ee602f), [`1a485f3`](https://github.com/mastra-ai/mastra/commit/1a485f3538f5ec64d58bd8b5e1e99de0c695c87b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`8661d7d`](https://github.com/mastra-ai/mastra/commit/8661d7d7179f0a024456aabdd8679bcecd09ac28), [`dbbfeb8`](https://github.com/mastra-ai/mastra/commit/dbbfeb85ec949dc9ebc0755e1ad262e4f5eba8db), [`575e343`](https://github.com/mastra-ai/mastra/commit/575e343900451021d96110916497d334af7bc252), [`0b2a3d1`](https://github.com/mastra-ai/mastra/commit/0b2a3d1783875c5b97b7b36ab3d03d7360e0dde7), [`6bb5d71`](https://github.com/mastra-ai/mastra/commit/6bb5d7193fe9166b219f0fccae17db7a5ae86e65), [`3cc9d00`](https://github.com/mastra-ai/mastra/commit/3cc9d00b2b4333e0377a5e9df5eff92c17ce7630), [`cacb839`](https://github.com/mastra-ai/mastra/commit/cacb8392d9e74189b56d857290b0615f98a2683d), [`57de7d6`](https://github.com/mastra-ai/mastra/commit/57de7d644ba7146edb4e9e6111ec4fa98c3a59e9), [`c8e4cea`](https://github.com/mastra-ai/mastra/commit/c8e4ceac9a390d78c8327dff3cdb2861dd71957f), [`ed01e9a`](https://github.com/mastra-ai/mastra/commit/ed01e9a807514a904374bf687a7b8f18750f6f78), [`b47b26e`](https://github.com/mastra-ai/mastra/commit/b47b26e6fe95cb8a3482be2c5e52de157fe59d0b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`733a537`](https://github.com/mastra-ai/mastra/commit/733a537489a858b5880b2e98809334fba895a221), [`e8e299c`](https://github.com/mastra-ai/mastra/commit/e8e299cc6abdfc39947e2fec25803493015d3882), [`edfc548`](https://github.com/mastra-ai/mastra/commit/edfc548886bc7bae17b681f8b6b41a47eb32bcd2), [`b05f486`](https://github.com/mastra-ai/mastra/commit/b05f48612984d5fe2447ea2d6cdd5c604d285b97), [`a8a4871`](https://github.com/mastra-ai/mastra/commit/a8a4871215f51da95c47129602157ce5372f634a), [`eb9ecaa`](https://github.com/mastra-ai/mastra/commit/eb9ecaa89c36e889749e3b825cfc507ce7f7980b), [`4ff3ee2`](https://github.com/mastra-ai/mastra/commit/4ff3ee2bff7ed07528b4817f8f49639031c72a4d), [`9207dfa`](https://github.com/mastra-ai/mastra/commit/9207dfab8062e5fc68b751684797ff86fe0b4e70), [`5165cdc`](https://github.com/mastra-ai/mastra/commit/5165cdcdcf50e144bb8113278535196cc9b07065), [`e737014`](https://github.com/mastra-ai/mastra/commit/e737014e0fc7035759762bb5b48baef1d6c0f6a7), [`6bb5d71`](https://github.com/mastra-ai/mastra/commit/6bb5d7193fe9166b219f0fccae17db7a5ae86e65), [`f591643`](https://github.com/mastra-ai/mastra/commit/f591643becdf0be9bddce6ba1748e64bc30d77f1), [`63796ba`](https://github.com/mastra-ai/mastra/commit/63796ba0fda60253be17535e68f6bbbf1e6ffa09), [`b1ad324`](https://github.com/mastra-ai/mastra/commit/b1ad324d657f3544b0701332aef7eb10e9a36258), [`61c566d`](https://github.com/mastra-ai/mastra/commit/61c566dd2f2cde2b23ed8f139924e530d4202214), [`c24754c`](https://github.com/mastra-ai/mastra/commit/c24754c1fb6fe144e5051e536e98c8a18b0214ac), [`12c61d2`](https://github.com/mastra-ai/mastra/commit/12c61d280c8cb208bc3c8dbcbe5dcc60cf9d1cd0), [`c46eb09`](https://github.com/mastra-ai/mastra/commit/c46eb09ce4987509af57a0ac582c61241a6dd2f1), [`9ee8120`](https://github.com/mastra-ai/mastra/commit/9ee8120ce17f76b9f617489e05a283353742690a), [`d975e92`](https://github.com/mastra-ai/mastra/commit/d975e924d4936f46c386bd3dee39c671720289f6), [`45dd6ee`](https://github.com/mastra-ai/mastra/commit/45dd6ee089bd7df0d0c98a10098e483fd388e04a), [`4e9a228`](https://github.com/mastra-ai/mastra/commit/4e9a2283d5fd6ed1b70a2751eb3dc2cbf82ada20), [`d6ce34a`](https://github.com/mastra-ai/mastra/commit/d6ce34aeceb06ddf3d595a1eed5cc74f481a46a1), [`f95f468`](https://github.com/mastra-ai/mastra/commit/f95f468cf1e7c2b924a13826494f98b8f2ccd581), [`30ed33e`](https://github.com/mastra-ai/mastra/commit/30ed33ee14084a26019aba15fceadda6d6ddefaf), [`04a815f`](https://github.com/mastra-ai/mastra/commit/04a815fc8971d29e97fcdcc5008a1eb472fc00ff), [`1cfa878`](https://github.com/mastra-ai/mastra/commit/1cfa8784d8da0dfaa0317e5048bc48b6084a5ea5), [`9a12ef3`](https://github.com/mastra-ai/mastra/commit/9a12ef3fccf3f4186db0f294f4ee1f02cf4d8db2), [`32d3583`](https://github.com/mastra-ai/mastra/commit/32d358332cb8ac2306b83b73cf3536e74dbd435e), [`7960688`](https://github.com/mastra-ai/mastra/commit/7960688828e04eaf3106e34f7758fa580257eef6), [`91ad69d`](https://github.com/mastra-ai/mastra/commit/91ad69d64994c89199b0c55399e64ed91c61df2f), [`8dc408d`](https://github.com/mastra-ai/mastra/commit/8dc408d34438f9e13297f792c11a5cfd6cf952e1), [`c92def1`](https://github.com/mastra-ai/mastra/commit/c92def10a13c822972c96f0a4ca6ffc1f4258aed), [`63041eb`](https://github.com/mastra-ai/mastra/commit/63041eb4c50b520a0a80e03d4cd6ea99f67715a0), [`c118318`](https://github.com/mastra-ai/mastra/commit/c1183181c9804303db4b511c2e2648f8b714712b), [`c5eaec5`](https://github.com/mastra-ai/mastra/commit/c5eaec5a860d80d0e3805e67db0414b87ac8cbed), [`fc07c64`](https://github.com/mastra-ai/mastra/commit/fc07c6465043e08e99193a6751a01c56ffc2e7a1), [`cced745`](https://github.com/mastra-ai/mastra/commit/cced745a056ec2225c5bc702e32d848847aa8b65), [`542dee2`](https://github.com/mastra-ai/mastra/commit/542dee254167f974ff8cbbbfc0ce10f9a2616a7b), [`3c19dce`](https://github.com/mastra-ai/mastra/commit/3c19dcef8e73062a80627a4927eae3ec11145afd), [`aca2869`](https://github.com/mastra-ai/mastra/commit/aca2869b2031982f3c4a2f52525c9be7cf123ef8), [`a58483c`](https://github.com/mastra-ai/mastra/commit/a58483cff1a9d41fce7c931843f48cb0ac450f64), [`a58483c`](https://github.com/mastra-ai/mastra/commit/a58483cff1a9d41fce7c931843f48cb0ac450f64), [`e6f8450`](https://github.com/mastra-ai/mastra/commit/e6f845074d478527026b18d85031b23353e1d0a4), [`895e9df`](https://github.com/mastra-ai/mastra/commit/895e9dfc17d6f34299eca64e317ded9e5f5e5ef8), [`e66b2ba`](https://github.com/mastra-ai/mastra/commit/e66b2ba100db63eaeab6e21e1ea34b113f2ec781), [`3e8727e`](https://github.com/mastra-ai/mastra/commit/3e8727e11ec1a5d733acedb5c872896394be18c1)]:
|
|
21
|
+
- @mastra/core@1.62.0
|
|
22
|
+
|
|
23
|
+
## 1.17.2-alpha.2
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Preserve structured HTTP status and transport codes in aggregate MCP discovery errors while retaining legacy string errors. ([#22218](https://github.com/mastra-ai/mastra/pull/22218))
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
const { errorDetails } = await mcp.listToolsWithErrors();
|
|
31
|
+
if (errorDetails.weather?.httpStatus === 503) {
|
|
32
|
+
// Apply a transient-failure policy without parsing the legacy error string.
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`ae8790c`](https://github.com/mastra-ai/mastra/commit/ae8790c4bfaa088d2ab279d1dcc06f326b9fd109), [`04a815f`](https://github.com/mastra-ai/mastra/commit/04a815fc8971d29e97fcdcc5008a1eb472fc00ff), [`cced745`](https://github.com/mastra-ai/mastra/commit/cced745a056ec2225c5bc702e32d848847aa8b65)]:
|
|
37
|
+
- @mastra/core@1.62.0-alpha.7
|
|
38
|
+
|
|
39
|
+
## 1.17.2-alpha.1
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Fixed dynamic prompt providers leaking prompts across authenticated callers. ([#22214](https://github.com/mastra-ai/mastra/pull/22214))
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [[`c8e4cea`](https://github.com/mastra-ai/mastra/commit/c8e4ceac9a390d78c8327dff3cdb2861dd71957f), [`ed01e9a`](https://github.com/mastra-ai/mastra/commit/ed01e9a807514a904374bf687a7b8f18750f6f78), [`4e9a228`](https://github.com/mastra-ai/mastra/commit/4e9a2283d5fd6ed1b70a2751eb3dc2cbf82ada20), [`63041eb`](https://github.com/mastra-ai/mastra/commit/63041eb4c50b520a0a80e03d4cd6ea99f67715a0)]:
|
|
46
|
+
- @mastra/core@1.62.0-alpha.6
|
|
47
|
+
|
|
48
|
+
## 1.17.2-alpha.0
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Fixed MCP tool results with structured output dropping the result-level `_meta` from the server's CallToolResult. The metadata (for example `_meta.ui.resourceUri`, which MCP Apps hosts use to detect and render an app) is now preserved on the returned structured result and can be read with the new `getMcpCallToolMeta` helper. The existing hidden MCP content channel is also now readable via the exported `getMcpCallToolContent` helper. Fixes https://github.com/mastra-ai/mastra/issues/21278 ([#22102](https://github.com/mastra-ai/mastra/pull/22102))
|
|
53
|
+
|
|
54
|
+
- Updated dependencies [[`2c85f42`](https://github.com/mastra-ai/mastra/commit/2c85f428e04ccd63ea31a7ec80b5b327afdad555), [`11bbeb9`](https://github.com/mastra-ai/mastra/commit/11bbeb9b108ef2264e05acefc6dafb9cbb342921), [`1a485f3`](https://github.com/mastra-ai/mastra/commit/1a485f3538f5ec64d58bd8b5e1e99de0c695c87b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`8661d7d`](https://github.com/mastra-ai/mastra/commit/8661d7d7179f0a024456aabdd8679bcecd09ac28), [`575e343`](https://github.com/mastra-ai/mastra/commit/575e343900451021d96110916497d334af7bc252), [`cacb839`](https://github.com/mastra-ai/mastra/commit/cacb8392d9e74189b56d857290b0615f98a2683d), [`b47b26e`](https://github.com/mastra-ai/mastra/commit/b47b26e6fe95cb8a3482be2c5e52de157fe59d0b), [`0d37487`](https://github.com/mastra-ai/mastra/commit/0d37487d9f349388a3f1cef6a536cf9dcc4b6273), [`c46eb09`](https://github.com/mastra-ai/mastra/commit/c46eb09ce4987509af57a0ac582c61241a6dd2f1), [`30ed33e`](https://github.com/mastra-ai/mastra/commit/30ed33ee14084a26019aba15fceadda6d6ddefaf), [`91ad69d`](https://github.com/mastra-ai/mastra/commit/91ad69d64994c89199b0c55399e64ed91c61df2f), [`8dc408d`](https://github.com/mastra-ai/mastra/commit/8dc408d34438f9e13297f792c11a5cfd6cf952e1), [`c92def1`](https://github.com/mastra-ai/mastra/commit/c92def10a13c822972c96f0a4ca6ffc1f4258aed), [`c5eaec5`](https://github.com/mastra-ai/mastra/commit/c5eaec5a860d80d0e3805e67db0414b87ac8cbed), [`e66b2ba`](https://github.com/mastra-ai/mastra/commit/e66b2ba100db63eaeab6e21e1ea34b113f2ec781)]:
|
|
55
|
+
- @mastra/core@1.62.0-alpha.3
|
|
56
|
+
|
|
3
57
|
## 1.17.1
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
package/dist/client/client.d.ts
CHANGED
|
@@ -21,8 +21,32 @@ export type MCPServerAuthState = 'needs-auth' | 'authorized';
|
|
|
21
21
|
/**
|
|
22
22
|
* Non-enumerable metadata attached to structured tool execute results so
|
|
23
23
|
* `toModelOutput` can read MCP `content` without changing the execute return shape.
|
|
24
|
+
*
|
|
25
|
+
* When a tool has an `outputSchema` and the server returns `structuredContent`,
|
|
26
|
+
* `execute()` returns that structured value directly. The rest of the
|
|
27
|
+
* CallToolResult envelope is preserved on non-enumerable symbols:
|
|
28
|
+
* - {@link MCP_CALL_TOOL_CONTENT} holds the MCP `content` blocks (model-facing text).
|
|
29
|
+
* - {@link MCP_CALL_TOOL_META} holds the result-level `_meta` (e.g. `ui.resourceUri`
|
|
30
|
+
* used by MCP Apps hosts), with `ui.serverId` stamped by the client.
|
|
31
|
+
*
|
|
32
|
+
* Read them with {@link getMcpCallToolContent} and {@link getMcpCallToolMeta}.
|
|
33
|
+
* Note: scalar or `null` structured results cannot carry properties, so these
|
|
34
|
+
* channels are only available when `structuredContent` is an object or array.
|
|
24
35
|
*/
|
|
25
36
|
export declare const MCP_CALL_TOOL_CONTENT: unique symbol;
|
|
37
|
+
/** Non-enumerable result-level `_meta` attached to structured tool execute results. */
|
|
38
|
+
export declare const MCP_CALL_TOOL_META: unique symbol;
|
|
39
|
+
/**
|
|
40
|
+
* Read the MCP `content` blocks preserved on a structured tool execute result.
|
|
41
|
+
* Returns `undefined` for scalar results or results without a hidden content channel.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getMcpCallToolContent(output: unknown): unknown;
|
|
44
|
+
/**
|
|
45
|
+
* Read the result-level `_meta` preserved on a structured tool execute result
|
|
46
|
+
* (e.g. `_meta.ui.resourceUri` for MCP Apps detection). Returns `undefined` for
|
|
47
|
+
* scalar results or results whose CallToolResult had no `_meta`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getMcpCallToolMeta(output: unknown): Record<string, unknown> | undefined;
|
|
26
50
|
/**
|
|
27
51
|
* Internal MCP client implementation for connecting to a single MCP server.
|
|
28
52
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,KAAK,EAAmB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAUhE,OAAO,KAAK,EAEV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAE3B,kBAAkB,EAEnB,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAA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AM,IAAI,GAAG,IAAI;IAOpE,4BAA4B,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAyB/D,8BAA8B,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAO9D,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAc3B;;;;;;OAMG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IAY/E;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,6BAA6B,CAAA;KAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IA6BrG,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAmBhE;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IA0M9B,OAAO,CAAC,mBAAmB;CAQ5B"}
|
|
@@ -4,6 +4,7 @@ import type { MCPServerBase } from '@mastra/core/mcp';
|
|
|
4
4
|
import type { Tool } from '@mastra/core/tools';
|
|
5
5
|
import type { ElicitRequest, ElicitResult, ProgressNotification, Prompt, Resource, ResourceTemplateType } from '@modelcontextprotocol/client';
|
|
6
6
|
import type { MastraMCPServerDefinition, MCPServerAuthState } from './client.js';
|
|
7
|
+
import type { MCPDiscoveryErrorDetails } from './error-utils.js';
|
|
7
8
|
import type { SerializableMCPToolCatalog, SerializableMCPToolDefinition } from './types.js';
|
|
8
9
|
/** Options for aggregate discovery across configured MCP servers. */
|
|
9
10
|
export interface MCPDiscoveryOptions {
|
|
@@ -200,8 +201,18 @@ export declare class MCPClient extends MastraBase {
|
|
|
200
201
|
* const resources = await mcp.resources.list();
|
|
201
202
|
* console.log(resources.weatherServer); // Array of resources
|
|
202
203
|
* ```
|
|
203
|
-
|
|
204
|
+
*/
|
|
204
205
|
list: () => Promise<Record<string, Resource[]>>;
|
|
206
|
+
/**
|
|
207
|
+
* Lists resources while preserving per-server discovery failures.
|
|
208
|
+
* The existing `list()` method remains the success-only convenience API.
|
|
209
|
+
*/
|
|
210
|
+
listWithErrors: (options?: MCPDiscoveryOptions) => Promise<{
|
|
211
|
+
resources: Record<string, Resource[]>;
|
|
212
|
+
errors: Record<string, string>;
|
|
213
|
+
errorDetails: Record<string, MCPDiscoveryErrorDetails>;
|
|
214
|
+
durations?: Record<string, number>;
|
|
215
|
+
}>;
|
|
205
216
|
/**
|
|
206
217
|
* Lists all available resource templates from all configured servers.
|
|
207
218
|
*
|
|
@@ -217,6 +228,16 @@ export declare class MCPClient extends MastraBase {
|
|
|
217
228
|
* ```
|
|
218
229
|
*/
|
|
219
230
|
templates: () => Promise<Record<string, ResourceTemplateType[]>>;
|
|
231
|
+
/**
|
|
232
|
+
* Lists resource templates while preserving per-server discovery failures.
|
|
233
|
+
* The existing `templates()` method remains the success-only convenience API.
|
|
234
|
+
*/
|
|
235
|
+
templatesWithErrors: (options?: MCPDiscoveryOptions) => Promise<{
|
|
236
|
+
templates: Record<string, ResourceTemplateType[]>;
|
|
237
|
+
errors: Record<string, string>;
|
|
238
|
+
errorDetails: Record<string, MCPDiscoveryErrorDetails>;
|
|
239
|
+
durations?: Record<string, number>;
|
|
240
|
+
}>;
|
|
220
241
|
/**
|
|
221
242
|
* Reads the content of a specific resource from a server.
|
|
222
243
|
*
|
|
@@ -402,6 +423,16 @@ export declare class MCPClient extends MastraBase {
|
|
|
402
423
|
* ```
|
|
403
424
|
*/
|
|
404
425
|
list: () => Promise<Record<string, Prompt[]>>;
|
|
426
|
+
/**
|
|
427
|
+
* Lists prompts while preserving per-server discovery failures.
|
|
428
|
+
* The existing `list()` method remains the success-only convenience API.
|
|
429
|
+
*/
|
|
430
|
+
listWithErrors: (options?: MCPDiscoveryOptions) => Promise<{
|
|
431
|
+
prompts: Record<string, Prompt[]>;
|
|
432
|
+
errors: Record<string, string>;
|
|
433
|
+
errorDetails: Record<string, MCPDiscoveryErrorDetails>;
|
|
434
|
+
durations?: Record<string, number>;
|
|
435
|
+
}>;
|
|
405
436
|
/**
|
|
406
437
|
* Retrieves a specific prompt with its messages from a server.
|
|
407
438
|
*
|
|
@@ -713,20 +744,21 @@ export declare class MCPClient extends MastraBase {
|
|
|
713
744
|
* Like listTools(), but also returns errors for servers that failed to connect
|
|
714
745
|
* or list tools. This allows callers to report specific failure reasons per server.
|
|
715
746
|
*
|
|
716
|
-
* @returns Object with `tools
|
|
747
|
+
* @returns Object with successful `tools`, legacy string `errors`, and structured `errorDetails`.
|
|
717
748
|
* Transient connection failures are retried once after reconnecting the affected server.
|
|
718
749
|
*
|
|
719
750
|
* @example
|
|
720
751
|
* ```typescript
|
|
721
|
-
* const { tools, errors } = await mcp.listToolsWithErrors();
|
|
752
|
+
* const { tools, errors, errorDetails } = await mcp.listToolsWithErrors();
|
|
722
753
|
* for (const [name, err] of Object.entries(errors)) {
|
|
723
|
-
* console.error(`Server ${name} failed: ${err}
|
|
754
|
+
* console.error(`Server ${name} failed: ${err}`, errorDetails[name]);
|
|
724
755
|
* }
|
|
725
756
|
* ```
|
|
726
757
|
*/
|
|
727
758
|
listToolsWithErrors(options?: MCPDiscoveryOptions): Promise<{
|
|
728
759
|
tools: Record<string, Tool<any, any, any, any>>;
|
|
729
760
|
errors: Record<string, string>;
|
|
761
|
+
errorDetails: Record<string, MCPDiscoveryErrorDetails>;
|
|
730
762
|
durations?: Record<string, number>;
|
|
731
763
|
}>;
|
|
732
764
|
/**
|
|
@@ -759,20 +791,21 @@ export declare class MCPClient extends MastraBase {
|
|
|
759
791
|
* Like listToolsets(), but also returns errors for servers that failed to connect
|
|
760
792
|
* or list tools. This allows callers to report specific failure reasons per server.
|
|
761
793
|
*
|
|
762
|
-
* @returns Object with `toolsets
|
|
794
|
+
* @returns Object with successful `toolsets`, legacy string `errors`, and structured `errorDetails`.
|
|
763
795
|
* Transient connection failures are retried once after reconnecting the affected server.
|
|
764
796
|
*
|
|
765
797
|
* @example
|
|
766
798
|
* ```typescript
|
|
767
|
-
* const { toolsets, errors } = await mcp.listToolsetsWithErrors();
|
|
799
|
+
* const { toolsets, errors, errorDetails } = await mcp.listToolsetsWithErrors();
|
|
768
800
|
* for (const [name, err] of Object.entries(errors)) {
|
|
769
|
-
* console.error(`Server ${name} failed: ${err}
|
|
801
|
+
* console.error(`Server ${name} failed: ${err}`, errorDetails[name]);
|
|
770
802
|
* }
|
|
771
803
|
* ```
|
|
772
804
|
*/
|
|
773
805
|
listToolsetsWithErrors(options?: MCPDiscoveryOptions): Promise<{
|
|
774
806
|
toolsets: Record<string, Record<string, Tool<any, any, any, any>>>;
|
|
775
807
|
errors: Record<string, string>;
|
|
808
|
+
errorDetails: Record<string, MCPDiscoveryErrorDetails>;
|
|
776
809
|
durations?: Record<string, number>;
|
|
777
810
|
}>;
|
|
778
811
|
/**
|
|
@@ -804,10 +837,13 @@ export declare class MCPClient extends MastraBase {
|
|
|
804
837
|
*
|
|
805
838
|
* Useful when caching a catalog, since it lets you avoid persisting a partial manifest that
|
|
806
839
|
* silently omits a server which happened to be down at discovery time.
|
|
840
|
+
* `errors` remains a string map for compatibility; `errorDetails` preserves
|
|
841
|
+
* machine-readable transport status and error codes when available.
|
|
807
842
|
*/
|
|
808
843
|
listToolDefinitionsWithErrors(options?: MCPDiscoveryOptions): Promise<{
|
|
809
844
|
definitions: SerializableMCPToolCatalog;
|
|
810
845
|
errors: Record<string, string>;
|
|
846
|
+
errorDetails: Record<string, MCPDiscoveryErrorDetails>;
|
|
811
847
|
durations?: Record<string, number>;
|
|
812
848
|
}>;
|
|
813
849
|
/**
|
|
@@ -848,6 +884,10 @@ export declare class MCPClient extends MastraBase {
|
|
|
848
884
|
toolsFromDefinitions({ definitions: catalog, }: {
|
|
849
885
|
definitions: SerializableMCPToolCatalog;
|
|
850
886
|
}): Promise<Record<string, Tool<any, any, any, any>>>;
|
|
887
|
+
private listResourcesWithErrors;
|
|
888
|
+
private listResourceTemplatesWithErrors;
|
|
889
|
+
private listPromptsWithErrors;
|
|
890
|
+
private discoverValuesWithErrors;
|
|
851
891
|
/**
|
|
852
892
|
* Runs a per-server discovery `operation` against every configured server
|
|
853
893
|
* concurrently, isolating and logging per-server failures. Results are
|
|
@@ -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,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
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,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MA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;;;;;;;;;;;OAcG;IACH,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQvC;IAED;;;;;;;;OAQG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAMzD,OAAO,CAAC,eAAe;YAQT,iBAAiB;YAiCjB,kBAAkB;IAchC,OAAO,CAAC,kBAAkB;YAyBZ,2BAA2B;YAI3B,kBAAkB;YAIlB,iBAAiB;CAuBhC"}
|
|
@@ -1,2 +1,22 @@
|
|
|
1
1
|
export declare function isReconnectableMCPError(error: unknown): boolean;
|
|
2
|
+
/** Structured transport metadata for a failed aggregate MCP discovery. */
|
|
3
|
+
export interface MCPDiscoveryErrorDetails {
|
|
4
|
+
/** Human-readable failure message. Includes `(HTTP nnn)` when an HTTP status is available. */
|
|
5
|
+
message: string;
|
|
6
|
+
/** HTTP response status reported by the MCP transport. */
|
|
7
|
+
httpStatus?: number;
|
|
8
|
+
/** Deepest error code in the cause chain, such as an MCP SDK, network, or application error code. */
|
|
9
|
+
code?: string | number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Preserve machine-readable transport metadata before aggregate discovery turns
|
|
13
|
+
* a thrown error into its legacy per-server string.
|
|
14
|
+
*
|
|
15
|
+
* MCP SDK 2 keeps an HTTP response status on `SdkHttpError.status` while
|
|
16
|
+
* `code` is a string SDK code. Older transports and wrappers have also used
|
|
17
|
+
* `statusCode`; only explicit status fields are treated as HTTP metadata so a
|
|
18
|
+
* numeric SDK or application `code` is not mislabeled. The walk is bounded and
|
|
19
|
+
* cycle-safe because application errors may wrap arbitrary third-party causes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getMCPDiscoveryErrorDetails(error: unknown): MCPDiscoveryErrorDetails;
|
|
2
22
|
//# sourceMappingURL=error-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/client/error-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAuB/D"}
|
|
1
|
+
{"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/client/error-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAuB/D;AAED,0EAA0E;AAC1E,MAAM,WAAW,wBAAwB;IACvC,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qGAAqG;IACrG,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAoCD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAmDpF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { LoggingLevel, LogMessage, LogHandler, MastraMCPServerDefinition, ElicitationHandler, ProgressHandler, InternalMastraMCPClientOptions, RequireToolApproval, RequireToolApprovalFn, RequireToolApprovalContext, ToolAnnotations, SerializableMCPToolDefinition, SerializableMCPToolCatalog, } from './types.js';
|
|
2
2
|
export * from './client.js';
|
|
3
3
|
export * from './configuration.js';
|
|
4
|
+
export type { MCPDiscoveryErrorDetails } from './error-utils.js';
|
|
4
5
|
export * from './oauth-provider.js';
|
|
5
6
|
export * from './oauth-callback-server.js';
|
|
6
7
|
export { MCPClientServerProxy } from './server-proxy.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,EACf,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,EACf,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -232,15 +232,17 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
|
|
|
232
232
|
Set `perServerTimeoutMs` to limit how long discovery waits for each server. Servers that finish within the limit remain in `tools`. Timed-out servers appear in `errors`, and `durations` reports each server's discovery time in milliseconds.
|
|
233
233
|
|
|
234
234
|
```typescript
|
|
235
|
-
const { tools, errors, durations } = await mcp.listToolsWithErrors({
|
|
235
|
+
const { tools, errors, errorDetails, durations } = await mcp.listToolsWithErrors({
|
|
236
236
|
perServerTimeoutMs: 3_000,
|
|
237
237
|
})
|
|
238
238
|
|
|
239
239
|
new Agent({ id: 'agent', tools })
|
|
240
|
-
console.log(errors, durations)
|
|
240
|
+
console.log(errors, errorDetails, durations)
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
`errors` remains a string map for backward compatibility. `errorDetails` provides the same message plus machine-readable `httpStatus` and transport `code` fields when the underlying error exposes them. When an HTTP status is available, the legacy message also includes an `(HTTP nnn)` suffix.
|
|
244
|
+
|
|
245
|
+
When called without options, the method omits only `durations`; `tools`, `errors`, and `errorDetails` are always returned.
|
|
244
246
|
|
|
245
247
|
### `listToolsets()`
|
|
246
248
|
|
|
@@ -257,15 +259,15 @@ const res = await agent.stream(prompt, {
|
|
|
257
259
|
Returns toolsets grouped by server name, along with per-server discovery errors. Set `perServerTimeoutMs` to limit each server independently and include per-server `durations` in milliseconds.
|
|
258
260
|
|
|
259
261
|
```typescript
|
|
260
|
-
const { toolsets, errors, durations } = await mcp.listToolsetsWithErrors({
|
|
262
|
+
const { toolsets, errors, errorDetails, durations } = await mcp.listToolsetsWithErrors({
|
|
261
263
|
perServerTimeoutMs: 3_000,
|
|
262
264
|
})
|
|
263
265
|
|
|
264
266
|
const res = await agent.stream(prompt, { toolsets })
|
|
265
|
-
console.log(errors, durations)
|
|
267
|
+
console.log(errors, errorDetails, durations)
|
|
266
268
|
```
|
|
267
269
|
|
|
268
|
-
When called without options, the method
|
|
270
|
+
When called without options, the method omits only `durations`; `toolsets`, `errors`, and `errorDetails` are always returned.
|
|
269
271
|
|
|
270
272
|
### `listToolDefinitions()`
|
|
271
273
|
|
|
@@ -286,7 +288,7 @@ Like `listToolDefinitions()`, but also returns per-server errors for servers tha
|
|
|
286
288
|
Set `perServerTimeoutMs` to limit each server independently. When options are provided, `durations` reports each server's discovery time in milliseconds.
|
|
287
289
|
|
|
288
290
|
```typescript
|
|
289
|
-
const { definitions, errors, durations } = await mcp.listToolDefinitionsWithErrors({
|
|
291
|
+
const { definitions, errors, errorDetails, durations } = await mcp.listToolDefinitionsWithErrors({
|
|
290
292
|
perServerTimeoutMs: 3_000,
|
|
291
293
|
})
|
|
292
294
|
|
|
@@ -294,10 +296,10 @@ if (Object.keys(errors).length === 0) {
|
|
|
294
296
|
await cache.set('mcp-tools', JSON.stringify(definitions))
|
|
295
297
|
}
|
|
296
298
|
|
|
297
|
-
console.log(durations)
|
|
299
|
+
console.log(errorDetails, durations)
|
|
298
300
|
```
|
|
299
301
|
|
|
300
|
-
When called without options, the method
|
|
302
|
+
When called without options, the method omits only `durations`; `definitions`, `errors`, and `errorDetails` are always returned.
|
|
301
303
|
|
|
302
304
|
### `toolFromDefinition()`
|
|
303
305
|
|
|
@@ -441,6 +443,18 @@ for (const serverName in resourcesByServer) {
|
|
|
441
443
|
}
|
|
442
444
|
```
|
|
443
445
|
|
|
446
|
+
#### `resources.listWithErrors(options?)`
|
|
447
|
+
|
|
448
|
+
Preserves successful resources while reporting failed servers through legacy string `errors` and structured `errorDetails`. Pass `perServerTimeoutMs` to bound each server independently and include `durations`.
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
const { resources, errors, errorDetails, durations } = await mcpClient.resources.listWithErrors({
|
|
452
|
+
perServerTimeoutMs: 3_000,
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
console.log(resources, errors, errorDetails, durations)
|
|
456
|
+
```
|
|
457
|
+
|
|
444
458
|
#### `resources.templates()`
|
|
445
459
|
|
|
446
460
|
Retrieves all available resource templates from all connected MCP servers, grouped by server name.
|
|
@@ -458,6 +472,15 @@ for (const serverName in templatesByServer) {
|
|
|
458
472
|
}
|
|
459
473
|
```
|
|
460
474
|
|
|
475
|
+
#### `resources.templatesWithErrors(options?)`
|
|
476
|
+
|
|
477
|
+
Returns successful resource templates together with per-server string `errors`, structured `errorDetails`, and optional `durations`.
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
const { templates, errors, errorDetails } = await mcpClient.resources.templatesWithErrors()
|
|
481
|
+
console.log(templates, errors, errorDetails)
|
|
482
|
+
```
|
|
483
|
+
|
|
461
484
|
#### `resources.read(serverName: string, uri: string)`
|
|
462
485
|
|
|
463
486
|
Reads the content of a specific resource from a server.
|
|
@@ -711,6 +734,15 @@ for (const serverName in promptsByServer) {
|
|
|
711
734
|
}
|
|
712
735
|
```
|
|
713
736
|
|
|
737
|
+
#### `prompts.listWithErrors(options?)`
|
|
738
|
+
|
|
739
|
+
Returns successful prompts together with per-server string `errors`, structured `errorDetails`, and optional `durations`.
|
|
740
|
+
|
|
741
|
+
```typescript
|
|
742
|
+
const { prompts, errors, errorDetails } = await mcpClient.prompts.listWithErrors()
|
|
743
|
+
console.log(prompts, errors, errorDetails)
|
|
744
|
+
```
|
|
745
|
+
|
|
714
746
|
#### `prompts.get({ serverName, name, args?, version? })`
|
|
715
747
|
|
|
716
748
|
Retrieves a specific prompt and its messages from a server.
|