@vitemcp/server 1.9.12 → 1.9.13
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-B78zmLtB.d.cts → OAuthProvider-BDDi19HO.d.cts} +15 -3
- package/dist/{OAuthProvider-B78zmLtB.d.ts → OAuthProvider-BDDi19HO.d.ts} +15 -3
- 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/{chunk-NZ34AKP4.js → chunk-5XM67UD5.js} +29 -5
- package/dist/chunk-5XM67UD5.js.map +1 -0
- package/dist/{chunk-7T5D57AM.cjs → chunk-NCSND5TI.cjs} +3 -3
- package/dist/{chunk-7T5D57AM.cjs.map → chunk-NCSND5TI.cjs.map} +1 -1
- package/dist/{chunk-WBP37JPX.js → chunk-QGWUABBC.js} +2 -2
- package/dist/{chunk-2X4JCSQQ.cjs → chunk-SKQK3QGJ.cjs} +29 -5
- package/dist/chunk-SKQK3QGJ.cjs.map +1 -0
- package/dist/openapi/index.cjs +99 -35
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +2 -2
- package/dist/openapi/index.d.ts +2 -2
- package/dist/openapi/index.js +82 -18
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2X4JCSQQ.cjs.map +0 -1
- package/dist/chunk-NZ34AKP4.js.map +0 -1
- /package/dist/{chunk-WBP37JPX.js.map → chunk-QGWUABBC.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withoutTrailingSlash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5XM67UD5.js";
|
|
4
4
|
import {
|
|
5
5
|
formatBytes,
|
|
6
6
|
ownKeysOnly,
|
|
@@ -1688,4 +1688,4 @@ export {
|
|
|
1688
1688
|
ServerState,
|
|
1689
1689
|
ViteMCP
|
|
1690
1690
|
};
|
|
1691
|
-
//# sourceMappingURL=chunk-
|
|
1691
|
+
//# sourceMappingURL=chunk-QGWUABBC.js.map
|
|
@@ -378,6 +378,7 @@ var clientCodeStorageSchema = _zod.z.object({
|
|
|
378
378
|
codeChallengeMethod: _zod.z.string(),
|
|
379
379
|
createdAt: storedDateSchema,
|
|
380
380
|
expiresAt: storedDateSchema,
|
|
381
|
+
redirectUri: _zod.z.string().optional(),
|
|
381
382
|
transactionId: _zod.z.string(),
|
|
382
383
|
upstreamTokens: upstreamTokenSetStorageSchema,
|
|
383
384
|
used: _zod.z.boolean().optional()
|
|
@@ -1460,6 +1461,7 @@ var MemoryTokenStorage = (_class3 = class {
|
|
|
1460
1461
|
var withoutTrailingSlash = (url) => url.replace(/\/+$/, "");
|
|
1461
1462
|
|
|
1462
1463
|
// src/auth/OAuthProxy.ts
|
|
1464
|
+
var GITHUB_TOKEN_ENDPOINT = "https://github.com/login/oauth/access_token";
|
|
1463
1465
|
var RESERVED_AUTHORIZATION_PARAMS = /* @__PURE__ */ new Set([
|
|
1464
1466
|
"client_id",
|
|
1465
1467
|
"code_challenge",
|
|
@@ -1655,6 +1657,12 @@ var OAuthProxy = (_class4 = class {
|
|
|
1655
1657
|
"Authorization code was issued to another client"
|
|
1656
1658
|
);
|
|
1657
1659
|
}
|
|
1660
|
+
if (request2.redirect_uri && clientCode.redirectUri !== void 0 && request2.redirect_uri !== clientCode.redirectUri) {
|
|
1661
|
+
throw new OAuthProxyError(
|
|
1662
|
+
"invalid_grant",
|
|
1663
|
+
"redirect_uri does not match the authorization request"
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1658
1666
|
if (!authenticated && (!clientCode.codeChallenge || clientCode.codeChallengeMethod !== "S256")) {
|
|
1659
1667
|
throw new OAuthProxyError(
|
|
1660
1668
|
"invalid_grant",
|
|
@@ -1676,6 +1684,11 @@ var OAuthProxy = (_class4 = class {
|
|
|
1676
1684
|
if (!valid) {
|
|
1677
1685
|
throw new OAuthProxyError("invalid_grant", "Invalid PKCE verifier");
|
|
1678
1686
|
}
|
|
1687
|
+
} else if (request2.code_verifier) {
|
|
1688
|
+
throw new OAuthProxyError(
|
|
1689
|
+
"invalid_request",
|
|
1690
|
+
"code_verifier provided without a code_challenge"
|
|
1691
|
+
);
|
|
1679
1692
|
}
|
|
1680
1693
|
if (this.config.enableTokenSwap && this.jwtIssuer) {
|
|
1681
1694
|
return await this.issueSwappedTokens(
|
|
@@ -1686,7 +1699,7 @@ var OAuthProxy = (_class4 = class {
|
|
|
1686
1699
|
} else {
|
|
1687
1700
|
const response = {
|
|
1688
1701
|
access_token: clientCode.upstreamTokens.accessToken,
|
|
1689
|
-
expires_in: clientCode.upstreamTokens.expiresIn,
|
|
1702
|
+
expires_in: clientCode.upstreamTokens.expiresIn || 3600,
|
|
1690
1703
|
token_type: clientCode.upstreamTokens.tokenType
|
|
1691
1704
|
};
|
|
1692
1705
|
if (clientCode.upstreamTokens.refreshToken) {
|
|
@@ -2088,7 +2101,10 @@ var OAuthProxy = (_class4 = class {
|
|
|
2088
2101
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2089
2102
|
return {
|
|
2090
2103
|
accessToken: tokens.access_token,
|
|
2091
|
-
|
|
2104
|
+
// 0 when the upstream did not say, so `accessTokenTtl` and the defaults
|
|
2105
|
+
// apply. An hour substituted here made every such token look as though
|
|
2106
|
+
// the upstream had set it, and neither was ever reached.
|
|
2107
|
+
expiresIn: _nullishCoalesce(tokens.expires_in, () => ( 0)),
|
|
2092
2108
|
idToken: tokens.id_token,
|
|
2093
2109
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2094
2110
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -2180,6 +2196,7 @@ var OAuthProxy = (_class4 = class {
|
|
|
2180
2196
|
expiresAt: new Date(
|
|
2181
2197
|
Date.now() + (this.config.authorizationCodeTtl || 300) * 1e3
|
|
2182
2198
|
),
|
|
2199
|
+
redirectUri: transaction.clientCallbackUrl,
|
|
2183
2200
|
transactionId: transaction.id,
|
|
2184
2201
|
upstreamTokens
|
|
2185
2202
|
};
|
|
@@ -2623,7 +2640,13 @@ var OAuthProxy = (_class4 = class {
|
|
|
2623
2640
|
id_token: _zod.z.string().optional(),
|
|
2624
2641
|
refresh_expires_in: _zod.z.coerce.number().int().positive().optional(),
|
|
2625
2642
|
refresh_token: _zod.z.string().optional(),
|
|
2626
|
-
|
|
2643
|
+
// GitHub lists the scopes it granted with commas, `read:user,user:email`,
|
|
2644
|
+
// which read as one scope that no check matched. RFC 6749 §3.3 separates
|
|
2645
|
+
// scopes with spaces and allows a comma inside one, so only GitHub's are
|
|
2646
|
+
// split.
|
|
2647
|
+
scope: _zod.z.string().transform(
|
|
2648
|
+
(scope) => this.config.upstreamTokenEndpoint === GITHUB_TOKEN_ENDPOINT ? scope.split(/[ ,]+/).filter(Boolean).join(" ") : scope
|
|
2649
|
+
).optional(),
|
|
2627
2650
|
token_type: _zod.z.string().optional()
|
|
2628
2651
|
});
|
|
2629
2652
|
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
@@ -2731,7 +2754,8 @@ var OAuthProxy = (_class4 = class {
|
|
|
2731
2754
|
const tokens = await this.parseTokenResponse(tokenResponse);
|
|
2732
2755
|
return {
|
|
2733
2756
|
accessToken: tokens.access_token,
|
|
2734
|
-
|
|
2757
|
+
// 0 when the upstream did not say, as on the code exchange.
|
|
2758
|
+
expiresIn: _nullishCoalesce(tokens.expires_in, () => ( 0)),
|
|
2735
2759
|
idToken: tokens.id_token,
|
|
2736
2760
|
issuedAt: /* @__PURE__ */ new Date(),
|
|
2737
2761
|
refreshExpiresIn: tokens.refresh_expires_in,
|
|
@@ -3661,4 +3685,4 @@ Original error: ${error.message}`
|
|
|
3661
3685
|
|
|
3662
3686
|
|
|
3663
3687
|
exports.withoutTrailingSlash = withoutTrailingSlash; exports.getAuthSession = getAuthSession; exports.requireAll = requireAll; exports.requireAny = requireAny; exports.requireAuth = requireAuth; exports.requireRole = requireRole; exports.requireScopes = requireScopes; exports.DEFAULT_ACCESS_TOKEN_TTL = DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_REFRESH_TOKEN_TTL = DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_AUTHORIZATION_CODE_TTL = DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_TRANSACTION_TTL = DEFAULT_TRANSACTION_TTL; exports.ConsentManager = ConsentManager; exports.JWTIssuer = JWTIssuer; exports.PKCEUtils = PKCEUtils; exports.EncryptedTokenStorage = EncryptedTokenStorage; exports.MemoryTokenStorage = MemoryTokenStorage; exports.OAuthProxy = OAuthProxy; exports.OAuthProxyError = OAuthProxyError; exports.AuthProvider = AuthProvider; exports.AzureProvider = AzureProvider; exports.GitHubProvider = GitHubProvider; exports.GoogleProvider = GoogleProvider; exports.OAuthProvider = OAuthProvider; exports.DiskStore = DiskStore; exports.JWKSVerifier = JWKSVerifier;
|
|
3664
|
-
//# sourceMappingURL=chunk-
|
|
3688
|
+
//# sourceMappingURL=chunk-SKQK3QGJ.cjs.map
|