@ai-sdk/mcp 1.0.91 → 1.0.92
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 +6 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/tool/oauth.ts +14 -1
package/dist/index.mjs
CHANGED
|
@@ -835,8 +835,10 @@ function buildDiscoveryUrls(authorizationServerUrl) {
|
|
|
835
835
|
type: "oidc",
|
|
836
836
|
expectedIssuer: pathIssuer
|
|
837
837
|
});
|
|
838
|
+
const oidcDiscoveryUrl = new URL(url.origin);
|
|
839
|
+
oidcDiscoveryUrl.pathname = `${pathname}/.well-known/openid-configuration`;
|
|
838
840
|
urlsToTry.push({
|
|
839
|
-
url:
|
|
841
|
+
url: oidcDiscoveryUrl,
|
|
840
842
|
type: "oidc",
|
|
841
843
|
expectedIssuer: pathIssuer
|
|
842
844
|
});
|
|
@@ -857,7 +859,13 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, {
|
|
|
857
859
|
} = {}) {
|
|
858
860
|
var _a3;
|
|
859
861
|
const headers = { "MCP-Protocol-Version": protocolVersion };
|
|
862
|
+
const authorizationServerOrigin = new URL(authorizationServerUrl).origin;
|
|
860
863
|
const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);
|
|
864
|
+
if (urlsToTry.some(({ url }) => url.origin !== authorizationServerOrigin)) {
|
|
865
|
+
throw new MCPClientOAuthError({
|
|
866
|
+
message: "OAuth discovery URL changed authorization-server origin"
|
|
867
|
+
});
|
|
868
|
+
}
|
|
861
869
|
for (const { url: endpointUrl, type, expectedIssuer } of urlsToTry) {
|
|
862
870
|
const response = await fetchWithCorsRetry(
|
|
863
871
|
endpointUrl,
|