@ai-sdk/mcp 1.0.71 → 1.0.73
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 +14 -0
- package/dist/index.js +17 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -22
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-stdio/index.js +19 -4
- package/dist/mcp-stdio/index.js.map +1 -1
- package/dist/mcp-stdio/index.mjs +9 -4
- package/dist/mcp-stdio/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/error/mcp-client-error.ts +1 -1
- package/src/tool/mcp-sse-transport.ts +13 -18
- package/src/tool/mcp-stdio/create-child-process.ts +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/mcp
|
|
2
2
|
|
|
3
|
+
## 1.0.73
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b8e4215: fix(mcp): support spawning command shims such as `npx` on Windows
|
|
8
|
+
- Updated dependencies [2d172fb]
|
|
9
|
+
- @ai-sdk/provider-utils@4.0.47
|
|
10
|
+
|
|
11
|
+
## 1.0.72
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 0075ed5: fix(mcp): reject SSE requests when POST responses are unsuccessful
|
|
16
|
+
|
|
3
17
|
## 1.0.71
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1527,7 +1527,7 @@ var SseMCPTransport = class {
|
|
|
1527
1527
|
const transportSignal = (_b3 = this.abortController) == null ? void 0 : _b3.signal;
|
|
1528
1528
|
const requestSignal = (options == null ? void 0 : options.signal) == null ? transportSignal : transportSignal == null ? options.signal : AbortSignal.any([transportSignal, options.signal]);
|
|
1529
1529
|
const attempt = async (triedAuth = false) => {
|
|
1530
|
-
var _a4, _b4
|
|
1530
|
+
var _a4, _b4;
|
|
1531
1531
|
try {
|
|
1532
1532
|
const headers = await this.commonHeaders({
|
|
1533
1533
|
"Content-Type": "application/json"
|
|
@@ -1543,38 +1543,33 @@ var SseMCPTransport = class {
|
|
|
1543
1543
|
if (response.status === 401 && this.authProvider && !triedAuth) {
|
|
1544
1544
|
const { resourceMetadataUrl, scope } = extractWWWAuthenticateParams(response);
|
|
1545
1545
|
this.resourceMetadataUrl = resourceMetadataUrl;
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
const error = new UnauthorizedError();
|
|
1555
|
-
(_a4 = this.onerror) == null ? void 0 : _a4.call(this, error);
|
|
1556
|
-
return;
|
|
1557
|
-
}
|
|
1558
|
-
} catch (error) {
|
|
1559
|
-
(_b4 = this.onerror) == null ? void 0 : _b4.call(this, error);
|
|
1560
|
-
return;
|
|
1546
|
+
const result = await auth(this.authProvider, {
|
|
1547
|
+
serverUrl: this.url,
|
|
1548
|
+
resourceMetadataUrl: this.resourceMetadataUrl,
|
|
1549
|
+
scope,
|
|
1550
|
+
fetchFn: this.fetchFn
|
|
1551
|
+
});
|
|
1552
|
+
if (result !== "AUTHORIZED") {
|
|
1553
|
+
throw new UnauthorizedError();
|
|
1561
1554
|
}
|
|
1562
1555
|
return attempt(true);
|
|
1563
1556
|
}
|
|
1564
1557
|
if (!response.ok) {
|
|
1565
1558
|
const text = await response.text().catch(() => null);
|
|
1566
1559
|
const error = new MCPClientError({
|
|
1567
|
-
message: `MCP SSE Transport Error: POSTing to endpoint (HTTP ${response.status}): ${text}
|
|
1560
|
+
message: `MCP SSE Transport Error: POSTing to endpoint (HTTP ${response.status}): ${text}`,
|
|
1561
|
+
statusCode: response.status,
|
|
1562
|
+
url: endpoint.href,
|
|
1563
|
+
responseBody: text != null ? text : void 0
|
|
1568
1564
|
});
|
|
1569
|
-
|
|
1570
|
-
return;
|
|
1565
|
+
throw error;
|
|
1571
1566
|
}
|
|
1572
1567
|
} catch (error) {
|
|
1573
|
-
if ((
|
|
1568
|
+
if ((_a4 = options == null ? void 0 : options.signal) == null ? void 0 : _a4.aborted) {
|
|
1574
1569
|
throw error;
|
|
1575
1570
|
}
|
|
1576
|
-
(
|
|
1577
|
-
|
|
1571
|
+
(_b4 = this.onerror) == null ? void 0 : _b4.call(this, error);
|
|
1572
|
+
throw error;
|
|
1578
1573
|
}
|
|
1579
1574
|
};
|
|
1580
1575
|
await attempt();
|