@ai-sdk/mcp 1.0.40 → 1.0.42
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 +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -6
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-stdio/index.d.mts +4 -0
- package/dist/mcp-stdio/index.d.ts +4 -0
- package/package.json +2 -2
- package/src/tool/mcp-client.ts +21 -4
- package/src/tool/mcp-http-transport.ts +2 -1
- package/src/tool/mcp-sse-transport.ts +2 -1
- package/src/tool/mcp-transport.ts +5 -0
- package/src/tool/mock-mcp-transport.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1085,10 +1085,11 @@ var SseMCPTransport = class {
|
|
|
1085
1085
|
this.fetchFn = fetchFn != null ? fetchFn : globalThis.fetch;
|
|
1086
1086
|
}
|
|
1087
1087
|
async commonHeaders(base) {
|
|
1088
|
+
var _a3;
|
|
1088
1089
|
const headers = {
|
|
1089
1090
|
...this.headers,
|
|
1090
1091
|
...base,
|
|
1091
|
-
"mcp-protocol-version": LATEST_PROTOCOL_VERSION
|
|
1092
|
+
"mcp-protocol-version": (_a3 = this.protocolVersion) != null ? _a3 : LATEST_PROTOCOL_VERSION
|
|
1092
1093
|
};
|
|
1093
1094
|
if (this.authProvider) {
|
|
1094
1095
|
const tokens = await this.authProvider.tokens();
|
|
@@ -1303,10 +1304,11 @@ var HttpMCPTransport = class {
|
|
|
1303
1304
|
this.fetchFn = fetchFn != null ? fetchFn : globalThis.fetch;
|
|
1304
1305
|
}
|
|
1305
1306
|
async commonHeaders(base) {
|
|
1307
|
+
var _a3;
|
|
1306
1308
|
const headers = {
|
|
1307
1309
|
...this.headers,
|
|
1308
1310
|
...base,
|
|
1309
|
-
"mcp-protocol-version": LATEST_PROTOCOL_VERSION
|
|
1311
|
+
"mcp-protocol-version": (_a3 = this.protocolVersion) != null ? _a3 : LATEST_PROTOCOL_VERSION
|
|
1310
1312
|
};
|
|
1311
1313
|
if (this.sessionId) {
|
|
1312
1314
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -1695,6 +1697,9 @@ var DefaultMCPClient = class {
|
|
|
1695
1697
|
get serverInfo() {
|
|
1696
1698
|
return this._serverInfo;
|
|
1697
1699
|
}
|
|
1700
|
+
get instructions() {
|
|
1701
|
+
return this._serverInstructions;
|
|
1702
|
+
}
|
|
1698
1703
|
async init() {
|
|
1699
1704
|
try {
|
|
1700
1705
|
await this.transport.start();
|
|
@@ -1722,6 +1727,8 @@ var DefaultMCPClient = class {
|
|
|
1722
1727
|
}
|
|
1723
1728
|
this.serverCapabilities = result.capabilities;
|
|
1724
1729
|
this._serverInfo = result.serverInfo;
|
|
1730
|
+
this._serverInstructions = result.instructions;
|
|
1731
|
+
this.transport.protocolVersion = result.protocolVersion;
|
|
1725
1732
|
await this.notification({
|
|
1726
1733
|
method: "notifications/initialized"
|
|
1727
1734
|
});
|
|
@@ -1978,8 +1985,8 @@ var DefaultMCPClient = class {
|
|
|
1978
1985
|
const toolWithExecute = schemas === "automatic" ? dynamicTool({
|
|
1979
1986
|
description,
|
|
1980
1987
|
title: resolvedTitle,
|
|
1981
|
-
|
|
1982
|
-
|
|
1988
|
+
metadata: {
|
|
1989
|
+
clientName: this.clientInfo.name
|
|
1983
1990
|
},
|
|
1984
1991
|
inputSchema: jsonSchema({
|
|
1985
1992
|
...inputSchema,
|
|
@@ -1991,8 +1998,8 @@ var DefaultMCPClient = class {
|
|
|
1991
1998
|
}) : tool({
|
|
1992
1999
|
description,
|
|
1993
2000
|
title: resolvedTitle,
|
|
1994
|
-
|
|
1995
|
-
|
|
2001
|
+
metadata: {
|
|
2002
|
+
clientName: this.clientInfo.name
|
|
1996
2003
|
},
|
|
1997
2004
|
inputSchema: schemas[name3].inputSchema,
|
|
1998
2005
|
...outputSchema != null ? { outputSchema } : {},
|