@ai-sdk/mcp 2.0.0-beta.13 → 2.0.0-beta.15
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 +17 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/tool/oauth.ts +7 -3
- package/src/util/oauth-util.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ai-sdk/mcp
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [6fd51c0]
|
|
8
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
9
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
10
|
+
|
|
11
|
+
## 2.0.0-beta.14
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 1e89d62: fix(mcp): strip trailing slash from OAuth resource parameter
|
|
16
|
+
- Updated dependencies [c29a26f]
|
|
17
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
18
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
19
|
+
|
|
3
20
|
## 2.0.0-beta.13
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -468,6 +468,13 @@ function resourceUrlFromServerUrl(url) {
|
|
|
468
468
|
resourceURL.hash = "";
|
|
469
469
|
return resourceURL;
|
|
470
470
|
}
|
|
471
|
+
function resourceUrlStripSlash(resource) {
|
|
472
|
+
const href = resource.href;
|
|
473
|
+
if (resource.pathname === "/" && href.endsWith("/")) {
|
|
474
|
+
return href.slice(0, -1);
|
|
475
|
+
}
|
|
476
|
+
return href;
|
|
477
|
+
}
|
|
471
478
|
function checkResourceAllowed({
|
|
472
479
|
requestedResource,
|
|
473
480
|
configuredResource
|
|
@@ -706,7 +713,10 @@ async function startAuthorization(authorizationServerUrl, {
|
|
|
706
713
|
authorizationUrl.searchParams.append("prompt", "consent");
|
|
707
714
|
}
|
|
708
715
|
if (resource) {
|
|
709
|
-
authorizationUrl.searchParams.set(
|
|
716
|
+
authorizationUrl.searchParams.set(
|
|
717
|
+
"resource",
|
|
718
|
+
resourceUrlStripSlash(resource)
|
|
719
|
+
);
|
|
710
720
|
}
|
|
711
721
|
return { authorizationUrl, codeVerifier };
|
|
712
722
|
}
|
|
@@ -815,7 +825,7 @@ async function exchangeAuthorization(authorizationServerUrl, {
|
|
|
815
825
|
applyClientAuthentication(authMethod, clientInformation, headers, params);
|
|
816
826
|
}
|
|
817
827
|
if (resource) {
|
|
818
|
-
params.set("resource", resource
|
|
828
|
+
params.set("resource", resourceUrlStripSlash(resource));
|
|
819
829
|
}
|
|
820
830
|
const response = await (fetchFn != null ? fetchFn : fetch)(tokenUrl, {
|
|
821
831
|
method: "POST",
|
|
@@ -867,7 +877,7 @@ async function refreshAuthorization(authorizationServerUrl, {
|
|
|
867
877
|
applyClientAuthentication(authMethod, clientInformation, headers, params);
|
|
868
878
|
}
|
|
869
879
|
if (resource) {
|
|
870
|
-
params.set("resource", resource
|
|
880
|
+
params.set("resource", resourceUrlStripSlash(resource));
|
|
871
881
|
}
|
|
872
882
|
const response = await (fetchFn != null ? fetchFn : fetch)(tokenUrl, {
|
|
873
883
|
method: "POST",
|