@vitemcp/server 1.9.13 → 1.9.14

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.
@@ -1461,6 +1461,7 @@ var MemoryTokenStorage = class {
1461
1461
  var withoutTrailingSlash = (url) => url.replace(/\/+$/, "");
1462
1462
 
1463
1463
  // src/auth/OAuthProxy.ts
1464
+ var DEFAULT_REDIRECT_PATH = "/oauth/callback";
1464
1465
  var GITHUB_TOKEN_ENDPOINT = "https://github.com/login/oauth/access_token";
1465
1466
  var RESERVED_AUTHORIZATION_PARAMS = /* @__PURE__ */ new Set([
1466
1467
  "client_id",
@@ -1506,7 +1507,7 @@ var OAuthProxy = class {
1506
1507
  consentRequired: true,
1507
1508
  enableTokenSwap: true,
1508
1509
  // Enabled by default for security
1509
- redirectPath: "/oauth/callback",
1510
+ redirectPath: DEFAULT_REDIRECT_PATH,
1510
1511
  transactionTtl: DEFAULT_TRANSACTION_TTL,
1511
1512
  upstreamRequestTimeoutMs: DEFAULT_UPSTREAM_REQUEST_TIMEOUT_MS,
1512
1513
  upstreamTokenEndpointAuthMethod: "client_secret_basic",
@@ -1761,6 +1762,15 @@ var OAuthProxy = class {
1761
1762
  tokenEndpointAuthMethodsSupported: [...TOKEN_ENDPOINT_AUTH_METHODS]
1762
1763
  };
1763
1764
  }
1765
+ /**
1766
+ * The path the upstream provider redirects back to: `redirectPath`, or
1767
+ * `/oauth/callback` when none is set. The router serves the callback here
1768
+ * and the proxy sends `{baseUrl}{path}` upstream as the `redirect_uri`, so
1769
+ * both read it from this one place and cannot disagree.
1770
+ */
1771
+ getRedirectPath() {
1772
+ return this.config.redirectPath ?? DEFAULT_REDIRECT_PATH;
1773
+ }
1764
1774
  /**
1765
1775
  * Handle OAuth callback from upstream provider
1766
1776
  */
@@ -2073,7 +2083,7 @@ var OAuthProxy = class {
2073
2083
  code,
2074
2084
  code_verifier: transaction.proxyCodeVerifier,
2075
2085
  grant_type: "authorization_code",
2076
- redirect_uri: `${this.config.baseUrl}${this.config.redirectPath}`
2086
+ redirect_uri: `${this.config.baseUrl}${this.getRedirectPath()}`
2077
2087
  };
2078
2088
  if (!useBasicAuth) {
2079
2089
  bodyParams.client_id = this.config.upstreamClientId;
@@ -2697,7 +2707,7 @@ var OAuthProxy = class {
2697
2707
  authUrl.searchParams.set("client_id", this.config.upstreamClientId);
2698
2708
  authUrl.searchParams.set(
2699
2709
  "redirect_uri",
2700
- `${this.config.baseUrl}${this.config.redirectPath}`
2710
+ `${this.config.baseUrl}${this.getRedirectPath()}`
2701
2711
  );
2702
2712
  authUrl.searchParams.set("response_type", "code");
2703
2713
  authUrl.searchParams.set("state", transaction.id);
@@ -3685,4 +3695,4 @@ export {
3685
3695
  DiskStore,
3686
3696
  JWKSVerifier
3687
3697
  };
3688
- //# sourceMappingURL=chunk-5XM67UD5.js.map
3698
+ //# sourceMappingURL=chunk-F37DGG7F.js.map