ai 4.3.11 → 4.3.13
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 +15 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +20 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/mcp-stdio/create-child-process.test.ts +0 -93
- package/mcp-stdio/create-child-process.ts +0 -21
- package/mcp-stdio/get-environment.test.ts +0 -13
- package/mcp-stdio/get-environment.ts +0 -43
- package/mcp-stdio/index.ts +0 -4
- package/mcp-stdio/mcp-stdio-transport.test.ts +0 -249
- package/mcp-stdio/mcp-stdio-transport.ts +0 -157
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# ai
|
2
2
|
|
3
|
+
## 4.3.13
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [6c59ae7]
|
8
|
+
- @ai-sdk/ui-utils@1.2.10
|
9
|
+
- @ai-sdk/react@1.2.11
|
10
|
+
|
11
|
+
## 4.3.12
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- 1ed3755: fix (ai): don't publish mcp-stdio TypeScript files
|
16
|
+
- 46cb332: chore (ai/mcp): add `assertCapability` method to experimental MCP client
|
17
|
+
|
3
18
|
## 4.3.11
|
4
19
|
|
5
20
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -2019,9 +2019,13 @@ declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
|
|
2019
2019
|
* Tool parameters are automatically inferred from the server's JSON schema
|
2020
2020
|
* if not explicitly provided in the tools configuration
|
2021
2021
|
*
|
2022
|
+
* This client is meant to be used to communicate with a single server. To communicate and fetch tools across multiple servers, it's recommended to create a new client instance per server.
|
2023
|
+
*
|
2022
2024
|
* Not supported:
|
2023
2025
|
* - Client options (e.g. sampling, roots) as they are not needed for tool conversion
|
2024
2026
|
* - Accepting notifications
|
2027
|
+
* - Session management (when passing a sessionId to an instance of the Streamable HTTP transport)
|
2028
|
+
* - Resumable SSE streams
|
2025
2029
|
*/
|
2026
2030
|
declare class MCPClient {
|
2027
2031
|
private transport;
|
@@ -2034,6 +2038,7 @@ declare class MCPClient {
|
|
2034
2038
|
constructor({ transport: transportConfig, name, onUncaughtError, }: MCPClientConfig);
|
2035
2039
|
init(): Promise<this>;
|
2036
2040
|
close(): Promise<void>;
|
2041
|
+
private assertCapability;
|
2037
2042
|
private request;
|
2038
2043
|
private listTools;
|
2039
2044
|
private callTool;
|
package/dist/index.d.ts
CHANGED
@@ -2019,9 +2019,13 @@ declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
|
|
2019
2019
|
* Tool parameters are automatically inferred from the server's JSON schema
|
2020
2020
|
* if not explicitly provided in the tools configuration
|
2021
2021
|
*
|
2022
|
+
* This client is meant to be used to communicate with a single server. To communicate and fetch tools across multiple servers, it's recommended to create a new client instance per server.
|
2023
|
+
*
|
2022
2024
|
* Not supported:
|
2023
2025
|
* - Client options (e.g. sampling, roots) as they are not needed for tool conversion
|
2024
2026
|
* - Accepting notifications
|
2027
|
+
* - Session management (when passing a sessionId to an instance of the Streamable HTTP transport)
|
2028
|
+
* - Resumable SSE streams
|
2025
2029
|
*/
|
2026
2030
|
declare class MCPClient {
|
2027
2031
|
private transport;
|
@@ -2034,6 +2038,7 @@ declare class MCPClient {
|
|
2034
2038
|
constructor({ transport: transportConfig, name, onUncaughtError, }: MCPClientConfig);
|
2035
2039
|
init(): Promise<this>;
|
2036
2040
|
close(): Promise<void>;
|
2041
|
+
private assertCapability;
|
2037
2042
|
private request;
|
2038
2043
|
private listTools;
|
2039
2044
|
private callTool;
|
package/dist/index.js
CHANGED
@@ -7556,6 +7556,24 @@ var MCPClient = class {
|
|
7556
7556
|
await ((_a17 = this.transport) == null ? void 0 : _a17.close());
|
7557
7557
|
this.onClose();
|
7558
7558
|
}
|
7559
|
+
assertCapability(method) {
|
7560
|
+
switch (method) {
|
7561
|
+
case "initialize":
|
7562
|
+
break;
|
7563
|
+
case "tools/list":
|
7564
|
+
case "tools/call":
|
7565
|
+
if (!this.serverCapabilities.tools) {
|
7566
|
+
throw new MCPClientError({
|
7567
|
+
message: `Server does not support tools`
|
7568
|
+
});
|
7569
|
+
}
|
7570
|
+
break;
|
7571
|
+
default:
|
7572
|
+
throw new MCPClientError({
|
7573
|
+
message: `Unsupported method: ${method}`
|
7574
|
+
});
|
7575
|
+
}
|
7576
|
+
}
|
7559
7577
|
async request({
|
7560
7578
|
request,
|
7561
7579
|
resultSchema,
|
@@ -7569,6 +7587,7 @@ var MCPClient = class {
|
|
7569
7587
|
})
|
7570
7588
|
);
|
7571
7589
|
}
|
7590
|
+
this.assertCapability(request.method);
|
7572
7591
|
const signal = options == null ? void 0 : options.signal;
|
7573
7592
|
signal == null ? void 0 : signal.throwIfAborted();
|
7574
7593
|
const messageId = this.requestMessageId++;
|
@@ -7597,7 +7616,7 @@ var MCPClient = class {
|
|
7597
7616
|
resolve(result);
|
7598
7617
|
} catch (error) {
|
7599
7618
|
const parseError = new MCPClientError({
|
7600
|
-
message: "Failed to parse server
|
7619
|
+
message: "Failed to parse server response",
|
7601
7620
|
cause: error
|
7602
7621
|
});
|
7603
7622
|
reject(parseError);
|
@@ -7613,11 +7632,6 @@ var MCPClient = class {
|
|
7613
7632
|
params,
|
7614
7633
|
options
|
7615
7634
|
} = {}) {
|
7616
|
-
if (!this.serverCapabilities.tools) {
|
7617
|
-
throw new MCPClientError({
|
7618
|
-
message: `Server does not support tools`
|
7619
|
-
});
|
7620
|
-
}
|
7621
7635
|
try {
|
7622
7636
|
return this.request({
|
7623
7637
|
request: { method: "tools/list", params },
|
@@ -7633,11 +7647,6 @@ var MCPClient = class {
|
|
7633
7647
|
args,
|
7634
7648
|
options
|
7635
7649
|
}) {
|
7636
|
-
if (!this.serverCapabilities.tools) {
|
7637
|
-
throw new MCPClientError({
|
7638
|
-
message: `Server does not support tools`
|
7639
|
-
});
|
7640
|
-
}
|
7641
7650
|
try {
|
7642
7651
|
return this.request({
|
7643
7652
|
request: { method: "tools/call", params: { name: name17, arguments: args } },
|