@egain/egain-mcp-server 1.0.24 → 1.0.25

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/bin/mcp-server.js CHANGED
@@ -42030,34 +42030,42 @@ class AuthenticationHook {
42030
42030
  }
42031
42031
  }
42032
42032
  if (currentUrl && currentUrl.includes("error=")) {
42033
- if (currentUrl !== lastErrorUrl) {
42033
+ const errorMatch = currentUrl.match(/[?&]error=([^&]+)/);
42034
+ const errorDescMatch = currentUrl.match(/error_description=([^&]+)/);
42035
+ const error = errorMatch && errorMatch[1] ? decodeURIComponent(errorMatch[1]) : "unknown_error";
42036
+ const errorDesc = errorDescMatch && errorDescMatch[1] ? decodeURIComponent(errorDescMatch[1]) : "No description";
42037
+ const errorLower = error.toLowerCase();
42038
+ const errorDescLower = errorDesc.toLowerCase();
42039
+ const isScopeError = error === "invalid_scope" || errorDescLower.includes("scope") || errorLower.includes("scope");
42040
+ const isRetryableError = error === "access_denied" || error === "invalid_grant" || errorDescLower.includes("password") || errorLower.includes("password") || errorDescLower.includes("username") || errorLower.includes("username") || errorDescLower.includes("credential") || errorLower.includes("credential") || errorLower.includes("user not found") || errorDescLower.includes("user not found");
42041
+ const isNewError = currentUrl !== lastErrorUrl;
42042
+ if (isNewError) {
42034
42043
  lastErrorUrl = currentUrl;
42035
- const errorMatch = currentUrl.match(/[?&]error=([^&]+)/);
42036
- const errorDescMatch = currentUrl.match(/error_description=([^&]+)/);
42037
- const error = errorMatch && errorMatch[1] ? decodeURIComponent(errorMatch[1]) : "unknown_error";
42038
- const errorDesc = errorDescMatch && errorDescMatch[1] ? decodeURIComponent(errorDescMatch[1]) : "No description";
42039
- const isScopeError = error === "invalid_scope" || errorDesc.toLowerCase().includes("scope");
42040
- const isRetryableError = error === "access_denied" || error === "invalid_grant" || errorDesc.toLowerCase().includes("password") || errorDesc.toLowerCase().includes("username") || errorDesc.toLowerCase().includes("credential");
42041
- if (!oAuthErrorLogged) {
42044
+ }
42045
+ if (isScopeError) {
42046
+ if (!oAuthErrorLogged || isNewError) {
42042
42047
  console.error("❌ OAuth authentication error:", `${error} - ${errorDesc}`);
42043
- if (isScopeError) {
42044
- console.error("\uD83D\uDCA1 This is a configuration error. Please check your scope settings and close this window.");
42045
- console.error("\uD83D\uDED1 Stopping monitoring - please fix the configuration and try again.");
42046
- oAuthErrorLogged = true;
42047
- this.stopConfigServer();
42048
- return;
42049
- } else if (isRetryableError) {
42050
- console.error("\uD83D\uDCA1 The configuration server will remain running. Please try again with correct credentials.");
42051
- console.error("\uD83D\uDD0D Continuing to monitor browser for authorization code...");
42052
- oAuthErrorLogged = true;
42053
- } else {
42054
- console.error("\uD83D\uDCA1 Please check the error message displayed in your browser and close the window.");
42055
- console.error("\uD83D\uDED1 Stopping monitoring.");
42056
- oAuthErrorLogged = true;
42057
- this.stopConfigServer();
42058
- return;
42059
- }
42048
+ console.error("\uD83D\uDCA1 This is a configuration error. Please check your scope settings and close this window.");
42049
+ console.error("\uD83D\uDED1 Stopping monitoring - please fix the configuration and try again.");
42050
+ oAuthErrorLogged = true;
42060
42051
  }
42052
+ this.stopConfigServer();
42053
+ return;
42054
+ } else if (!isRetryableError) {
42055
+ if (!oAuthErrorLogged || isNewError) {
42056
+ console.error("❌ OAuth authentication error:", `${error} - ${errorDesc}`);
42057
+ console.error("\uD83D\uDCA1 Please check the error message displayed in your browser and close the window.");
42058
+ console.error("\uD83D\uDED1 Stopping monitoring.");
42059
+ oAuthErrorLogged = true;
42060
+ }
42061
+ this.stopConfigServer();
42062
+ return;
42063
+ }
42064
+ if (isNewError) {
42065
+ console.error("❌ OAuth authentication error:", `${error} - ${errorDesc}`);
42066
+ console.error("\uD83D\uDCA1 The configuration server will remain running. Please try again with correct credentials.");
42067
+ console.error("\uD83D\uDD0D Continuing to monitor browser for authorization code...");
42068
+ oAuthErrorLogged = true;
42061
42069
  }
42062
42070
  } else {
42063
42071
  if (lastErrorUrl !== null) {
@@ -48688,5 +48696,5 @@ export {
48688
48696
  app
48689
48697
  };
48690
48698
 
48691
- //# debugId=3C2C86165F82B22964756E2164756E21
48699
+ //# debugId=FF186799450FA50E64756E2164756E21
48692
48700
  //# sourceMappingURL=mcp-server.js.map