@ai-sdk/mcp 2.0.64 → 2.0.66
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 +33 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/error/oauth-error.ts +18 -0
- package/src/index.ts +4 -0
- package/src/tool/oauth.ts +24 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/mcp
|
|
2
2
|
|
|
3
|
+
## 2.0.66
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3ff0f54: feat(mcp): add AuthorizationServerMismatchError for OAuth authorization server pin mismatches
|
|
8
|
+
|
|
9
|
+
## 2.0.65
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4d0500e: fix(mcp): identify failed OAuth tokens for conditional invalidation
|
|
14
|
+
|
|
3
15
|
## 2.0.64
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -157,6 +157,31 @@ type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
|
|
|
157
157
|
type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
|
|
158
158
|
type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
|
|
159
159
|
//#endregion
|
|
160
|
+
//#region src/error/oauth-error.d.ts
|
|
161
|
+
declare const symbol: unique symbol;
|
|
162
|
+
/**
|
|
163
|
+
* An error occurred with the MCP client within the OAuth flow.
|
|
164
|
+
*/
|
|
165
|
+
export declare class MCPClientOAuthError extends AISDKError {
|
|
166
|
+
private readonly [symbol];
|
|
167
|
+
constructor({ name, message, cause }: {
|
|
168
|
+
name?: string;
|
|
169
|
+
message: string;
|
|
170
|
+
cause?: unknown;
|
|
171
|
+
});
|
|
172
|
+
static isInstance(error: unknown): error is MCPClientOAuthError;
|
|
173
|
+
}
|
|
174
|
+
declare const mismatchSymbol: unique symbol;
|
|
175
|
+
export declare class AuthorizationServerMismatchError extends MCPClientOAuthError {
|
|
176
|
+
private readonly [mismatchSymbol];
|
|
177
|
+
static errorCode: string;
|
|
178
|
+
constructor({ message, cause }: {
|
|
179
|
+
message: string;
|
|
180
|
+
cause?: unknown;
|
|
181
|
+
});
|
|
182
|
+
static isInstance(error: unknown): error is AuthorizationServerMismatchError;
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
160
185
|
//#region src/tool/oauth.d.ts
|
|
161
186
|
type AuthResult = 'AUTHORIZED' | 'REDIRECT';
|
|
162
187
|
interface OAuthAuthorizationServerInformation {
|
|
@@ -196,8 +221,15 @@ interface OAuthClientProvider {
|
|
|
196
221
|
* If implemented, provides a way for the client to invalidate (e.g. delete) the specified
|
|
197
222
|
* credentials, in the case where the server has indicated that they are no longer valid.
|
|
198
223
|
* This avoids requiring the user to intervene manually.
|
|
224
|
+
*
|
|
225
|
+
* For token invalidation, context identifies the token generation being invalidated
|
|
226
|
+
* when available. Providers sharing storage must atomically compare and delete
|
|
227
|
+
* that generation so a concurrent refresh's tokens are preserved. Omitting or
|
|
228
|
+
* ignoring context retains unconditional invalidation.
|
|
199
229
|
*/
|
|
200
|
-
invalidateCredentials?(scope: 'all' | 'client' | 'tokens' | 'verifier'
|
|
230
|
+
invalidateCredentials?(scope: 'all' | 'client' | 'tokens' | 'verifier', context?: {
|
|
231
|
+
tokens: OAuthTokens;
|
|
232
|
+
}): void | Promise<void>;
|
|
201
233
|
get redirectUrl(): string | URL;
|
|
202
234
|
get clientMetadata(): OAuthClientMetadata;
|
|
203
235
|
clientInformation(): OAuthClientInformation | undefined | Promise<OAuthClientInformation | undefined>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tool/json-rpc-message.ts","../src/tool/oauth-types.ts","../src/tool/oauth.ts","../src/tool/mcp-transport.ts","../src/tool/types.ts","../src/tool/mcp-client.ts","../src/tool/mcp-apps.ts","../src/tool/mcp-app-fingerprint.ts"],"mappings":";;;;cAMM,sBAAoB,EAAA;;;;;;;GAMf,EAAA,KAAA;KAEC,iBAAiB,EAAE,aAAa;cAEtC,uBAAqB,EAAA;;;;;;;GAMhB,EAAA,KAAA;KAEC,kBAAkB,EAAE,aAAa;cAEvC,oBAAkB,EAAA;;;;;;;;GAUb,EAAA,KAAA;KAEC,eAAe,EAAE,aAAa;cAEpC,2BAAyB,EAAA;;;;;;GAUpB,EAAA,KAAA;KAEC,sBAAsB,EAAE,aAAa;cAEpC,sBAAoB,EAAA,mBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAK/B,EAAA,KAAA;KAEU,iBAAiB,EAAE,aAAa;wBAE5B,uBAAuB,mBAAmB;;;;;;cC9B7C,mBAAiB,EAAA;;;;;;;;;;GAYpB,EAAA,KAAA;cAmBG,qBAAmB,EAAA;;;;;;;;;;;;;GAe9B,EAAA,KAAA;;;;;;cA6BW,uCAAqC,EAAA;;;;;;;;;;;;;;;;;GAK/C,EAAA,KAAA;cAEU,8BAA4B,EAAA;;;;;;;;GAU/B,EAAA,KAAA;cAEG,2BAAyB,EAAA;;;;;;;;;;;;;;;;;;GAsB5B,EAAA,KAAA;KAEE,gBAAgB,EAAE,aAAa;KAC/B,kCAAkC,EAAE,aACvC;KAEG,cAAc,EAAE,aAAa;KAI7B,yBAAyB,EAAE,aAC9B;KAEG,8BACR,gBACA;KAUQ,sBAAsB,EAAE,aAAa;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tool/json-rpc-message.ts","../src/tool/oauth-types.ts","../src/error/oauth-error.ts","../src/tool/oauth.ts","../src/tool/mcp-transport.ts","../src/tool/types.ts","../src/tool/mcp-client.ts","../src/tool/mcp-apps.ts","../src/tool/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AU;MACR,QAAQ;EAEZ,sBAAsB;IACpB,UAAU;MACR,QAAQ;EAEZ,yBAAyB;IACvB,SAAS;IACT,UAAU;MACR,QAAQ;EAEZ,uBAAuB;IACrB;IACA,YAAY;IACZ,UAAU;MACR,QAAQ;EAEZ,SACE,MAAM;IACJ,UAAU;MAEX,QAAQ;EAEX,qBACE,eAAe,0BACf,UACE,SAAS,uBACN,QAAQ,gBAAgB;EAG/B,aAAa;;;;;;;qBC9WF;;;;qBAWA;;;;;;;;;;KAsBD;EACV;EACA;EACA;GACC;;;;;KAMS;EACV;EACA,MAAM;EACN,cAAc;GACb;;;;;KAMS;EACV;EACA,iBAAiB;EACjB;EACA,OAAO;;;;;wBAwGO,iBAAiB,aAAa;EAC5C,cAAc;EACd,YAAY;;;;;wBAoFQ,qBACpB,QACA,KACA;EAEA,QAAQ,KAAK;EACb;EACA,UAAU;IACR,QAAQ;;;;;;;;;;;wBCvOU,0BACpB,UAAU,iBACT;;;;;wBAkBa,0BACd,iBACA"}
|
package/dist/index.js
CHANGED
|
@@ -297,7 +297,7 @@ var MCPClientError = class extends AISDKError {
|
|
|
297
297
|
};
|
|
298
298
|
//#endregion
|
|
299
299
|
//#region src/version.ts
|
|
300
|
-
const VERSION = "2.0.
|
|
300
|
+
const VERSION = "2.0.66";
|
|
301
301
|
//#endregion
|
|
302
302
|
//#region src/tool/oauth-types.ts
|
|
303
303
|
/**
|
|
@@ -456,6 +456,24 @@ var UnauthorizedClientError = class extends MCPClientOAuthError {
|
|
|
456
456
|
this.errorCode = "unauthorized_client";
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
+
const mismatchMarker = `vercel.ai.error.AI_AuthorizationServerMismatchError`;
|
|
460
|
+
const mismatchSymbol = Symbol.for(mismatchMarker);
|
|
461
|
+
var AuthorizationServerMismatchError = class extends MCPClientOAuthError {
|
|
462
|
+
static {
|
|
463
|
+
this.errorCode = "authorization_server_mismatch";
|
|
464
|
+
}
|
|
465
|
+
constructor({ message, cause }) {
|
|
466
|
+
super({
|
|
467
|
+
name: "AuthorizationServerMismatchError",
|
|
468
|
+
message,
|
|
469
|
+
cause
|
|
470
|
+
});
|
|
471
|
+
this[mismatchSymbol] = true;
|
|
472
|
+
}
|
|
473
|
+
static isInstance(error) {
|
|
474
|
+
return AISDKError.hasMarker(error, mismatchMarker);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
459
477
|
const OAUTH_ERRORS = {
|
|
460
478
|
[ServerError.errorCode]: ServerError,
|
|
461
479
|
[InvalidClientError.errorCode]: InvalidClientError,
|
|
@@ -607,7 +625,7 @@ function assertResourceMetadataUrlSameOrigin(serverUrl, resourceMetadataUrl) {
|
|
|
607
625
|
if (resourceMetadataUrl.origin !== expectedOrigin) throw new MCPClientOAuthError({ message: `OAuth protected resource metadata URL ${resourceMetadataUrl.href} must have the same origin as the MCP server URL ${expectedOrigin}` });
|
|
608
626
|
}
|
|
609
627
|
function assertAuthorizationServerInformationMatches({ storedAuthorizationServerInformation, currentAuthorizationServerInformation }) {
|
|
610
|
-
if (storedAuthorizationServerInformation.issuer != null && currentAuthorizationServerInformation.issuer != null && storedAuthorizationServerInformation.issuer !== currentAuthorizationServerInformation.issuer || storedAuthorizationServerInformation.authorizationServerUrl !== currentAuthorizationServerInformation.authorizationServerUrl || storedAuthorizationServerInformation.tokenEndpoint !== currentAuthorizationServerInformation.tokenEndpoint) throw new
|
|
628
|
+
if (storedAuthorizationServerInformation.issuer != null && currentAuthorizationServerInformation.issuer != null && storedAuthorizationServerInformation.issuer !== currentAuthorizationServerInformation.issuer || storedAuthorizationServerInformation.authorizationServerUrl !== currentAuthorizationServerInformation.authorizationServerUrl || storedAuthorizationServerInformation.tokenEndpoint !== currentAuthorizationServerInformation.tokenEndpoint) throw new AuthorizationServerMismatchError({ message: "OAuth authorization server metadata does not match the metadata that issued the stored credentials" });
|
|
611
629
|
}
|
|
612
630
|
function extractWWWAuthenticateParams(response) {
|
|
613
631
|
const header = response.headers.get("www-authenticate") ?? response.headers.get("WWW-Authenticate");
|
|
@@ -1028,15 +1046,17 @@ function inferOAuthApplicationType(redirectUris) {
|
|
|
1028
1046
|
return redirectUris.every(isNativeRedirectUri) ? "native" : "web";
|
|
1029
1047
|
}
|
|
1030
1048
|
async function auth(provider, options) {
|
|
1049
|
+
const refreshAttempt = {};
|
|
1031
1050
|
try {
|
|
1032
|
-
return await authInternal(provider, options);
|
|
1051
|
+
return await authInternal(provider, options, refreshAttempt);
|
|
1033
1052
|
} catch (error) {
|
|
1034
1053
|
if (error instanceof InvalidClientError || error instanceof UnauthorizedClientError) {
|
|
1035
1054
|
if (options.authorizationCode !== void 0 || !await provider.isClientInformationDynamicallyRegistered?.()) throw error;
|
|
1036
1055
|
await provider.invalidateCredentials?.("all");
|
|
1037
1056
|
return await authInternal(provider, options);
|
|
1038
1057
|
} else if (error instanceof InvalidGrantError) {
|
|
1039
|
-
await provider.invalidateCredentials?.("tokens");
|
|
1058
|
+
if (refreshAttempt.tokens) await provider.invalidateCredentials?.("tokens", { tokens: refreshAttempt.tokens });
|
|
1059
|
+
else await provider.invalidateCredentials?.("tokens");
|
|
1040
1060
|
return await authInternal(provider, options);
|
|
1041
1061
|
}
|
|
1042
1062
|
throw error;
|
|
@@ -1052,7 +1072,7 @@ async function selectResourceURL(serverUrl, provider, resourceMetadata) {
|
|
|
1052
1072
|
})) throw new Error(`Protected resource ${resourceMetadata.resource} does not match expected ${defaultResource} (or origin)`);
|
|
1053
1073
|
return new URL(resourceMetadata.resource);
|
|
1054
1074
|
}
|
|
1055
|
-
async function authInternal(provider, { serverUrl, authorizationCode, callbackState, callbackIssuer, scope, resourceMetadataUrl, fetchFn }) {
|
|
1075
|
+
async function authInternal(provider, { serverUrl, authorizationCode, callbackState, callbackIssuer, scope, resourceMetadataUrl, fetchFn }, refreshAttempt) {
|
|
1056
1076
|
let resourceMetadata;
|
|
1057
1077
|
let authorizationServerUrl;
|
|
1058
1078
|
let clientInformation;
|
|
@@ -1170,9 +1190,10 @@ async function authInternal(provider, { serverUrl, authorizationCode, callbackSt
|
|
|
1170
1190
|
storedAuthorizationServerInformation,
|
|
1171
1191
|
currentAuthorizationServerInformation
|
|
1172
1192
|
});
|
|
1173
|
-
else await provider.invalidateCredentials?.("tokens");
|
|
1193
|
+
else await provider.invalidateCredentials?.("tokens", { tokens: { ...tokens } });
|
|
1174
1194
|
try {
|
|
1175
1195
|
if (storedAuthorizationServerInformation) {
|
|
1196
|
+
if (refreshAttempt) refreshAttempt.tokens = { ...tokens };
|
|
1176
1197
|
const newTokens = await refreshAuthorization(authorizationServerUrl, {
|
|
1177
1198
|
metadata,
|
|
1178
1199
|
clientInformation,
|
|
@@ -2773,6 +2794,6 @@ function detectMCPAppResourceDrift(current, baseline) {
|
|
|
2773
2794
|
return current !== baseline;
|
|
2774
2795
|
}
|
|
2775
2796
|
//#endregion
|
|
2776
|
-
export { ElicitResultSchema, ElicitationRequestSchema, MCP_APP_MIME_TYPE, UnauthorizedError, auth, createMCPClient, createMCPClient as experimental_createMCPClient, detectMCPAppResourceDrift, fingerprintMCPAppResource, mcpAppClientCapabilities, readMCPAppResource, splitMCPAppTools, validateJSONRPCMessage };
|
|
2797
|
+
export { AuthorizationServerMismatchError, ElicitResultSchema, ElicitationRequestSchema, MCPClientOAuthError, MCP_APP_MIME_TYPE, UnauthorizedError, auth, createMCPClient, createMCPClient as experimental_createMCPClient, detectMCPAppResourceDrift, fingerprintMCPAppResource, mcpAppClientCapabilities, readMCPAppResource, splitMCPAppTools, validateJSONRPCMessage };
|
|
2777
2798
|
|
|
2778
2799
|
//# sourceMappingURL=index.js.map
|