@ai-sdk/mcp 2.0.54 → 2.0.56
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.d.ts +10 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/tool/oauth.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.56",
|
|
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.18",
|
|
35
|
+
"@ai-sdk/provider-utils": "5.0.46",
|
|
36
36
|
"cross-spawn": "^7.0.6",
|
|
37
37
|
"pkce-challenge": "^5.0.1"
|
|
38
38
|
},
|
package/src/tool/oauth.ts
CHANGED
|
@@ -91,6 +91,16 @@ export interface OAuthClientProvider {
|
|
|
91
91
|
| OAuthClientInformation
|
|
92
92
|
| undefined
|
|
93
93
|
| Promise<OAuthClientInformation | undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Returns whether the current client information was obtained through
|
|
96
|
+
* dynamic client registration.
|
|
97
|
+
*
|
|
98
|
+
* Return `true` only when the current client information was saved after a
|
|
99
|
+
* dynamic registration response. When this method is omitted or returns
|
|
100
|
+
* `false`, the client information is treated as pre-registered and is not
|
|
101
|
+
* automatically invalidated after client authentication errors.
|
|
102
|
+
*/
|
|
103
|
+
isClientInformationDynamicallyRegistered?(): boolean | Promise<boolean>;
|
|
94
104
|
saveClientInformation?(
|
|
95
105
|
clientInformation: OAuthClientInformation,
|
|
96
106
|
): void | Promise<void>;
|
|
@@ -1259,6 +1269,13 @@ export async function auth(
|
|
|
1259
1269
|
error instanceof InvalidClientError ||
|
|
1260
1270
|
error instanceof UnauthorizedClientError
|
|
1261
1271
|
) {
|
|
1272
|
+
if (
|
|
1273
|
+
options.authorizationCode !== undefined ||
|
|
1274
|
+
!(await provider.isClientInformationDynamicallyRegistered?.())
|
|
1275
|
+
) {
|
|
1276
|
+
throw error;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1262
1279
|
await provider.invalidateCredentials?.('all');
|
|
1263
1280
|
return await authInternal(provider, options);
|
|
1264
1281
|
} else if (error instanceof InvalidGrantError) {
|