@ai-sdk/mcp 2.0.66 → 2.0.67
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 +12 -0
- package/dist/index.d.ts +51 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/tool/mcp-sse-transport.ts +9 -1
- package/src/tool/oauth.ts +5 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.67",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ai-sdk/provider": "4.0.
|
|
35
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
34
|
+
"@ai-sdk/provider": "4.0.22",
|
|
35
|
+
"@ai-sdk/provider-utils": "5.0.54",
|
|
36
36
|
"cross-spawn": "^7.0.6",
|
|
37
37
|
"pkce-challenge": "^5.0.1"
|
|
38
38
|
},
|
package/src/index.ts
CHANGED
|
@@ -190,6 +190,10 @@ export class SseMCPTransport implements MCPTransport {
|
|
|
190
190
|
const { done, value } = await reader.read();
|
|
191
191
|
|
|
192
192
|
if (done) {
|
|
193
|
+
if (this.abortController?.signal.aborted) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
if (this.connected) {
|
|
194
198
|
this.connected = false;
|
|
195
199
|
throw new MCPClientError({
|
|
@@ -197,7 +201,11 @@ export class SseMCPTransport implements MCPTransport {
|
|
|
197
201
|
'MCP SSE Transport Error: Connection closed unexpectedly',
|
|
198
202
|
});
|
|
199
203
|
}
|
|
200
|
-
|
|
204
|
+
|
|
205
|
+
throw new MCPClientError({
|
|
206
|
+
message:
|
|
207
|
+
'MCP SSE Transport Error: Connection closed before endpoint event was received',
|
|
208
|
+
});
|
|
201
209
|
}
|
|
202
210
|
|
|
203
211
|
const { event, data } = value;
|
package/src/tool/oauth.ts
CHANGED
|
@@ -1285,14 +1285,11 @@ export async function auth(
|
|
|
1285
1285
|
|
|
1286
1286
|
await provider.invalidateCredentials?.('all');
|
|
1287
1287
|
return await authInternal(provider, options);
|
|
1288
|
-
} else if (error instanceof InvalidGrantError) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
} else {
|
|
1294
|
-
await provider.invalidateCredentials?.('tokens');
|
|
1295
|
-
}
|
|
1288
|
+
} else if (error instanceof InvalidGrantError && refreshAttempt.tokens) {
|
|
1289
|
+
// Only invalidate the tokens used by a failed refresh.
|
|
1290
|
+
await provider.invalidateCredentials?.('tokens', {
|
|
1291
|
+
tokens: refreshAttempt.tokens,
|
|
1292
|
+
});
|
|
1296
1293
|
return await authInternal(provider, options);
|
|
1297
1294
|
}
|
|
1298
1295
|
|