@mcp-use/client 2.1.1-canary.0 → 2.1.1-canary.1

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/index.js CHANGED
@@ -742,6 +742,13 @@ var init_base = __esm({
742
742
  get authorization() {
743
743
  return this.authorizationCache;
744
744
  }
745
+ /**
746
+ * Discover optional authorization metadata without delaying connection
747
+ * readiness. HTTP connectors override this with RFC 9728 discovery.
748
+ */
749
+ async discoverAuthorization() {
750
+ return this.authorization;
751
+ }
745
752
  /** Start optional OAuth for a connected mixed-auth server. */
746
753
  async authenticate() {
747
754
  throw new Error("This connector does not support interactive OAuth");
@@ -1518,7 +1525,7 @@ init_connector_telemetry();
1518
1525
  init_logging();
1519
1526
 
1520
1527
  // src/utils/version.ts
1521
- var VERSION = "2.1.1-canary.0";
1528
+ var VERSION = "2.1.1-canary.1";
1522
1529
  function getPackageVersion() {
1523
1530
  return VERSION;
1524
1531
  }
@@ -3012,6 +3019,7 @@ var HttpConnector = class extends BaseConnector {
3012
3019
  streamableTransport = null;
3013
3020
  hadAccessTokenAtConnect = false;
3014
3021
  pendingOAuthCompletion = null;
3022
+ authorizationDiscovery = null;
3015
3023
  /**
3016
3024
  * Creates an HTTP connector.
3017
3025
  *
@@ -3094,11 +3102,15 @@ var HttpConnector = class extends BaseConnector {
3094
3102
  }
3095
3103
  await this.completeInteractiveAuthorization();
3096
3104
  }
3097
- async initialize(defaultRequestOptions = this.opts.defaultRequestOptions ?? {}) {
3098
- const capabilities = await super.initialize(defaultRequestOptions);
3105
+ async discoverAuthorization() {
3099
3106
  if (!this.detectMixedAuth || !this.oauthProvider || this.hadAccessTokenAtConnect) {
3100
- return capabilities;
3107
+ return this.authorizationCache;
3101
3108
  }
3109
+ if (this.authorizationDiscovery) return this.authorizationDiscovery;
3110
+ this.authorizationDiscovery = this.discoverMixedAuthorization();
3111
+ return this.authorizationDiscovery;
3112
+ }
3113
+ async discoverMixedAuthorization() {
3102
3114
  const controller = new AbortController();
3103
3115
  let timeout;
3104
3116
  const discoveryTimeout = new Promise((_, reject) => {
@@ -3134,7 +3146,7 @@ var HttpConnector = class extends BaseConnector {
3134
3146
  } finally {
3135
3147
  if (timeout) clearTimeout(timeout);
3136
3148
  }
3137
- return capabilities;
3149
+ return this.authorizationCache;
3138
3150
  }
3139
3151
  buildClientOptions() {
3140
3152
  return {
@@ -3521,6 +3533,7 @@ var HttpConnector = class extends BaseConnector {
3521
3533
  }
3522
3534
  }
3523
3535
  await super.cleanupResources();
3536
+ this.authorizationDiscovery = null;
3524
3537
  }
3525
3538
  };
3526
3539
 
@@ -3857,6 +3870,10 @@ var MCPConnection = class {
3857
3870
  get authorization() {
3858
3871
  return this.connector.authorization;
3859
3872
  }
3873
+ /** Discover optional OAuth metadata without delaying MCP readiness. */
3874
+ async discoverAuthorization() {
3875
+ return this.connector.discoverAuthorization();
3876
+ }
3860
3877
  /** Authenticate an already-connected mixed-auth server. */
3861
3878
  async authenticate() {
3862
3879
  await this.connector.authenticate();