@vitemcp/server 1.9.15 → 1.9.16
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/dist/{OAuthProvider-AjmrLphi.d.cts → OAuthProvider-DNKBMBPU.d.cts} +16 -0
- package/dist/{OAuthProvider-AjmrLphi.d.ts → OAuthProvider-DNKBMBPU.d.ts} +16 -0
- package/dist/ViteMCP.cjs +3 -3
- package/dist/ViteMCP.d.cts +2 -2
- package/dist/ViteMCP.d.ts +2 -2
- package/dist/ViteMCP.js +2 -2
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/bin/vitemcp.cjs +0 -1
- package/dist/bin/vitemcp.cjs.map +1 -1
- package/dist/bin/vitemcp.js +0 -1
- package/dist/bin/vitemcp.js.map +1 -1
- package/dist/{chunk-AOEXFXTH.cjs → chunk-HDJEH7NK.cjs} +3 -3
- package/dist/{chunk-AOEXFXTH.cjs.map → chunk-HDJEH7NK.cjs.map} +1 -1
- package/dist/{chunk-2JOXLIMJ.js → chunk-LZTRZ62V.js} +2 -2
- package/dist/{chunk-WOQXAQIG.js → chunk-PXH56Q3F.js} +42 -7
- package/dist/chunk-PXH56Q3F.js.map +1 -0
- package/dist/{chunk-7XWK66ZT.cjs → chunk-TWYBLPRQ.cjs} +45 -10
- package/dist/chunk-TWYBLPRQ.cjs.map +1 -0
- package/dist/openapi/index.cjs +12 -12
- package/dist/openapi/index.d.cts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7XWK66ZT.cjs.map +0 -1
- package/dist/chunk-WOQXAQIG.js.map +0 -1
- /package/dist/{chunk-2JOXLIMJ.js.map → chunk-LZTRZ62V.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withoutTrailingSlash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PXH56Q3F.js";
|
|
4
4
|
import {
|
|
5
5
|
formatBytes,
|
|
6
6
|
ownKeysOnly,
|
|
@@ -1690,4 +1690,4 @@ export {
|
|
|
1690
1690
|
ServerState,
|
|
1691
1691
|
ViteMCP
|
|
1692
1692
|
};
|
|
1693
|
-
//# sourceMappingURL=chunk-
|
|
1693
|
+
//# sourceMappingURL=chunk-LZTRZ62V.js.map
|
|
@@ -2095,7 +2095,7 @@ var OAuthProxy = class {
|
|
|
2095
2095
|
let errorCode = "server_error";
|
|
2096
2096
|
let errorDescription;
|
|
2097
2097
|
try {
|
|
2098
|
-
const error = await
|
|
2098
|
+
const error = await this.readUpstreamError(tokenResponse);
|
|
2099
2099
|
errorCode = error.error || "server_error";
|
|
2100
2100
|
errorDescription = error.error_description;
|
|
2101
2101
|
} catch {
|
|
@@ -2299,7 +2299,7 @@ var OAuthProxy = class {
|
|
|
2299
2299
|
let errorCode = "invalid_grant";
|
|
2300
2300
|
let errorDescription;
|
|
2301
2301
|
try {
|
|
2302
|
-
const error = await
|
|
2302
|
+
const error = await this.readUpstreamError(tokenResponse);
|
|
2303
2303
|
errorCode = error.error || "invalid_grant";
|
|
2304
2304
|
errorDescription = error.error_description;
|
|
2305
2305
|
} catch {
|
|
@@ -2685,6 +2685,40 @@ var OAuthProxy = class {
|
|
|
2685
2685
|
const digest = createHash3("sha256").update(refreshToken).digest("base64url");
|
|
2686
2686
|
return `passthrough-refresh:${this.issuerNs}:${digest}`;
|
|
2687
2687
|
}
|
|
2688
|
+
/**
|
|
2689
|
+
* What a refusal from the token endpoint says: the `error` and
|
|
2690
|
+
* `error_description` RFC 6749 §5.2 gives it.
|
|
2691
|
+
*
|
|
2692
|
+
* §5.2 sends them as JSON, but a provider that answers a successful request
|
|
2693
|
+
* with a form — GitHub, by default — may refuse with one too, and read as
|
|
2694
|
+
* JSON that lost the provider's own code and description to a bare HTTP
|
|
2695
|
+
* status.
|
|
2696
|
+
*
|
|
2697
|
+
* What parses as JSON is read as JSON, whatever the response declares, as
|
|
2698
|
+
* every refusal was before. A form is read only when the response declares
|
|
2699
|
+
* one, by its media type alone: a 502 page can name that type in a parameter
|
|
2700
|
+
* and carry `error=` in a link, and is no provider's refusal. Rejects when
|
|
2701
|
+
* the body is neither, and the caller falls back to the HTTP status.
|
|
2702
|
+
*/
|
|
2703
|
+
async readUpstreamError(response) {
|
|
2704
|
+
const text = await response.text();
|
|
2705
|
+
try {
|
|
2706
|
+
return JSON.parse(text);
|
|
2707
|
+
} catch (cause) {
|
|
2708
|
+
const mediaType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
|
|
2709
|
+
if (mediaType === "application/x-www-form-urlencoded") {
|
|
2710
|
+
const params = new URLSearchParams(text);
|
|
2711
|
+
const error = params.get("error");
|
|
2712
|
+
if (error) {
|
|
2713
|
+
return {
|
|
2714
|
+
error,
|
|
2715
|
+
error_description: params.get("error_description") ?? void 0
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
throw cause;
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2688
2722
|
/**
|
|
2689
2723
|
* Send the user's browser back to the client's registered callback with how
|
|
2690
2724
|
* its request came out: a code, or an error (RFC 6749 §4.1.2). The `state`
|
|
@@ -2770,7 +2804,7 @@ var OAuthProxy = class {
|
|
|
2770
2804
|
let errorCode = "invalid_grant";
|
|
2771
2805
|
let errorDescription = "Upstream refresh failed";
|
|
2772
2806
|
try {
|
|
2773
|
-
const error = await
|
|
2807
|
+
const error = await this.readUpstreamError(tokenResponse);
|
|
2774
2808
|
errorCode = error.error || "invalid_grant";
|
|
2775
2809
|
errorDescription = error.error_description || "Upstream refresh failed";
|
|
2776
2810
|
} catch {
|
|
@@ -3110,11 +3144,12 @@ var AuthProvider = class {
|
|
|
3110
3144
|
if (!request2) {
|
|
3111
3145
|
return void 0;
|
|
3112
3146
|
}
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3147
|
+
const token = /^bearer +(\S.*)$/i.exec(
|
|
3148
|
+
request2.headers.get("authorization") ?? ""
|
|
3149
|
+
)?.[1];
|
|
3150
|
+
if (!token) {
|
|
3115
3151
|
return void 0;
|
|
3116
3152
|
}
|
|
3117
|
-
const token = authHeader.slice(7);
|
|
3118
3153
|
const upstreamTokens = await this.proxy.loadUpstreamTokens(token);
|
|
3119
3154
|
if (!upstreamTokens) {
|
|
3120
3155
|
return void 0;
|
|
@@ -3719,4 +3754,4 @@ export {
|
|
|
3719
3754
|
DiskStore,
|
|
3720
3755
|
JWKSVerifier
|
|
3721
3756
|
};
|
|
3722
|
-
//# sourceMappingURL=chunk-
|
|
3757
|
+
//# sourceMappingURL=chunk-PXH56Q3F.js.map
|