mcp-use 1.33.0 → 1.34.0

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.
Files changed (37) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{chunk-GO576WUP.js → chunk-2J3FVMZ5.js} +1 -1
  3. package/dist/{chunk-UIN2NARV.js → chunk-3N6PYMAD.js} +2 -2
  4. package/dist/{chunk-W4VPNJFD.js → chunk-3UOADQDZ.js} +2 -2
  5. package/dist/{chunk-XRUCU3OM.js → chunk-4KP3757O.js} +1 -1
  6. package/dist/{chunk-EJA76EVX.js → chunk-7MKAP6XK.js} +1 -1
  7. package/dist/{chunk-WIGHPYJZ.js → chunk-AOZBHAT7.js} +1 -1
  8. package/dist/{chunk-NJKHYDW2.js → chunk-BOFDVMBT.js} +2 -2
  9. package/dist/{chunk-GVZB7MNE.js → chunk-EIYWOJYK.js} +1 -1
  10. package/dist/{chunk-3N3CCJUC.js → chunk-U6UCVQKQ.js} +4 -4
  11. package/dist/{chunk-HNUILRUJ.js → chunk-WEMFZYUR.js} +1 -1
  12. package/dist/{chunk-D2NNKAES.js → chunk-XS2ZMBOG.js} +1 -1
  13. package/dist/{client-4IX6UVDX.js → client-O5HMGXF3.js} +4 -4
  14. package/dist/index.cjs +24 -17
  15. package/dist/index.js +29 -22
  16. package/dist/src/agents/index.cjs +1 -1
  17. package/dist/src/agents/index.js +4 -4
  18. package/dist/src/browser-agent.cjs +1 -1
  19. package/dist/src/browser-agent.js +2 -2
  20. package/dist/src/browser.cjs +1 -1
  21. package/dist/src/browser.js +4 -4
  22. package/dist/src/client.cjs +1 -1
  23. package/dist/src/client.js +4 -4
  24. package/dist/src/react/index.cjs +24 -17
  25. package/dist/src/react/index.js +27 -20
  26. package/dist/src/react/types.d.ts +13 -0
  27. package/dist/src/react/types.d.ts.map +1 -1
  28. package/dist/src/react/useMcp-helpers.d.ts +6 -0
  29. package/dist/src/react/useMcp-helpers.d.ts.map +1 -1
  30. package/dist/src/react/useMcp.d.ts.map +1 -1
  31. package/dist/src/server/index.cjs +1 -1
  32. package/dist/src/server/index.js +7 -7
  33. package/dist/src/version.d.ts +1 -1
  34. package/dist/{stdio-J3BMWKCO.js → stdio-NRH7PMXI.js} +2 -2
  35. package/dist/{stdio-LXSNBI6W.js → stdio-QIYDKXTT.js} +3 -3
  36. package/dist/{tool-execution-helpers-5RSUQXU4.js → tool-execution-helpers-GEQBGCKR.js} +2 -2
  37. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseConnector
3
- } from "./chunk-XRUCU3OM.js";
3
+ } from "./chunk-4KP3757O.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-3GQAWCBQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CODE_MODE_AGENT_PROMPT
3
- } from "./chunk-GO576WUP.js";
3
+ } from "./chunk-2J3FVMZ5.js";
4
4
  import {
5
5
  LangChainAdapter
6
6
  } from "./chunk-27JERD25.js";
@@ -8,7 +8,7 @@ import {
8
8
  Telemetry,
9
9
  extractModelInfo,
10
10
  getPackageVersion
11
- } from "./chunk-HNUILRUJ.js";
11
+ } from "./chunk-WEMFZYUR.js";
12
12
  import {
13
13
  logger
14
14
  } from "./chunk-QWQYAQCK.js";
@@ -3,11 +3,11 @@ import {
3
3
  HttpConnector,
4
4
  normalizeClientInfo,
5
5
  resolveCallbacks
6
- } from "./chunk-NJKHYDW2.js";
6
+ } from "./chunk-BOFDVMBT.js";
7
7
  import {
8
8
  Tel,
9
9
  getPackageVersion
10
- } from "./chunk-D2NNKAES.js";
10
+ } from "./chunk-XS2ZMBOG.js";
11
11
  import {
12
12
  logger
13
13
  } from "./chunk-QWQYAQCK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Telemetry
3
- } from "./chunk-HNUILRUJ.js";
3
+ } from "./chunk-WEMFZYUR.js";
4
4
  import {
5
5
  logger
6
6
  } from "./chunk-QWQYAQCK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Telemetry
3
- } from "./chunk-D2NNKAES.js";
3
+ } from "./chunk-XS2ZMBOG.js";
4
4
  import {
5
5
  logger
6
6
  } from "./chunk-QWQYAQCK.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GKPKUKD6.js";
4
4
  import {
5
5
  BaseConnector
6
- } from "./chunk-XRUCU3OM.js";
6
+ } from "./chunk-4KP3757O.js";
7
7
  import {
8
8
  logger
9
9
  } from "./chunk-QWQYAQCK.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  BaseConnector,
3
3
  ConnectionManager
4
- } from "./chunk-EJA76EVX.js";
4
+ } from "./chunk-7MKAP6XK.js";
5
5
  import {
6
6
  Tel,
7
7
  getPackageVersion
8
- } from "./chunk-D2NNKAES.js";
8
+ } from "./chunk-XS2ZMBOG.js";
9
9
  import {
10
10
  logger
11
11
  } from "./chunk-QWQYAQCK.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-KUEVOU4M.js";
7
7
  import {
8
8
  Telemetry
9
- } from "./chunk-HNUILRUJ.js";
9
+ } from "./chunk-WEMFZYUR.js";
10
10
  import {
11
11
  generateUUID
12
12
  } from "./chunk-MTHLLDCX.js";
@@ -3,17 +3,17 @@ import {
3
3
  } from "./chunk-GKPKUKD6.js";
4
4
  import {
5
5
  CodeModeConnector
6
- } from "./chunk-GO576WUP.js";
6
+ } from "./chunk-2J3FVMZ5.js";
7
7
  import {
8
8
  BaseConnector
9
- } from "./chunk-XRUCU3OM.js";
9
+ } from "./chunk-4KP3757O.js";
10
10
  import {
11
11
  JSONSchemaToZod
12
12
  } from "./chunk-LG5NSHEL.js";
13
13
  import {
14
14
  Tel,
15
15
  getPackageVersion
16
- } from "./chunk-HNUILRUJ.js";
16
+ } from "./chunk-WEMFZYUR.js";
17
17
  import {
18
18
  logger
19
19
  } from "./chunk-QWQYAQCK.js";
@@ -2356,7 +2356,7 @@ var MCPClient = class _MCPClient extends BaseMCPClient {
2356
2356
  clientInfo: serverConfig.clientInfo ?? this.config.clientInfo
2357
2357
  };
2358
2358
  if ("command" in merged && "args" in merged) {
2359
- const { StdioConnector } = await import("./stdio-LXSNBI6W.js");
2359
+ const { StdioConnector } = await import("./stdio-QIYDKXTT.js");
2360
2360
  const stdioConfig = merged;
2361
2361
  return new StdioConnector({
2362
2362
  command: stdioConfig.command,
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-3GQAWCBQ.js";
14
14
 
15
15
  // src/version.ts
16
- var VERSION = "1.33.0";
16
+ var VERSION = "1.34.0";
17
17
  function getPackageVersion() {
18
18
  return VERSION;
19
19
  }
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-3GQAWCBQ.js";
7
7
 
8
8
  // src/version.ts
9
- var VERSION = "1.33.0";
9
+ var VERSION = "1.34.0";
10
10
  function getPackageVersion() {
11
11
  return VERSION;
12
12
  }
@@ -7,15 +7,15 @@ import {
7
7
  createConnectorFromConfig,
8
8
  normalizeClientInfo,
9
9
  resolveCallbacks
10
- } from "./chunk-NJKHYDW2.js";
10
+ } from "./chunk-BOFDVMBT.js";
11
11
  import "./chunk-URE3PRDB.js";
12
12
  import {
13
13
  BaseConnector
14
- } from "./chunk-EJA76EVX.js";
14
+ } from "./chunk-7MKAP6XK.js";
15
15
  import {
16
16
  Tel,
17
17
  getPackageVersion
18
- } from "./chunk-D2NNKAES.js";
18
+ } from "./chunk-XS2ZMBOG.js";
19
19
  import {
20
20
  logger
21
21
  } from "./chunk-QWQYAQCK.js";
@@ -1107,7 +1107,7 @@ var MCPClient = class _MCPClient extends BaseMCPClient {
1107
1107
  clientInfo: serverConfig.clientInfo ?? this.config.clientInfo
1108
1108
  };
1109
1109
  if ("command" in merged && "args" in merged) {
1110
- const { StdioConnector } = await import("./stdio-J3BMWKCO.js");
1110
+ const { StdioConnector } = await import("./stdio-NRH7PMXI.js");
1111
1111
  const stdioConfig = merged;
1112
1112
  return new StdioConnector({
1113
1113
  command: stdioConfig.command,
package/dist/index.cjs CHANGED
@@ -1170,7 +1170,7 @@ var VERSION;
1170
1170
  var init_version = __esm({
1171
1171
  "src/version.ts"() {
1172
1172
  "use strict";
1173
- VERSION = "1.33.0";
1173
+ VERSION = "1.34.0";
1174
1174
  __name(getPackageVersion, "getPackageVersion");
1175
1175
  }
1176
1176
  });
@@ -11726,7 +11726,7 @@ function deriveOAuthProxyUrl(gatewayUrl) {
11726
11726
  }
11727
11727
  __name(deriveOAuthProxyUrl, "deriveOAuthProxyUrl");
11728
11728
  function createBrowserOAuthProvider(params) {
11729
- const oauthProxyUrl = deriveOAuthProxyUrl(params.gatewayUrl);
11729
+ const oauthProxyUrl = params.oauthProxyUrl ?? deriveOAuthProxyUrl(params.gatewayUrl);
11730
11730
  const provider = new BrowserOAuthClientProvider(params.effectiveOAuthUrl, {
11731
11731
  storageKeyPrefix: params.storageKeyPrefix,
11732
11732
  clientName: params.oauthClientConfig.name,
@@ -11829,6 +11829,7 @@ function useMcp(options) {
11829
11829
  headers: headersOption,
11830
11830
  customHeaders: customHeadersOption,
11831
11831
  proxyConfig,
11832
+ oauthProxyUrl: oauthProxyUrlOption,
11832
11833
  autoProxyFallback = true,
11833
11834
  debug: _debug = false,
11834
11835
  logLevel: logLevelOption,
@@ -12219,6 +12220,7 @@ function useMcp(options) {
12219
12220
  preventAutoAuth,
12220
12221
  useRedirectFlow,
12221
12222
  gatewayUrl,
12223
+ oauthProxyUrl: oauthProxyUrlOption,
12222
12224
  onPopupWindow,
12223
12225
  proxyOAuthRequests: true,
12224
12226
  staticClientInfo,
@@ -12226,10 +12228,7 @@ function useMcp(options) {
12226
12228
  });
12227
12229
  authProviderRef.current = provider;
12228
12230
  if (oauthProxyUrl) {
12229
- addLog(
12230
- "debug",
12231
- `OAuth proxy URL derived from gateway: ${oauthProxyUrl}`
12232
- );
12231
+ addLog("debug", `OAuth proxy URL in effect: ${oauthProxyUrl}`);
12233
12232
  }
12234
12233
  addLog(
12235
12234
  "debug",
@@ -12566,6 +12565,19 @@ function useMcp(options) {
12566
12565
  } catch (err) {
12567
12566
  const error2 = err;
12568
12567
  const errorMessage = error2?.message || String(err);
12568
+ const preparedAuthUrl = authProviderRef.current?.getLastAttemptedAuthUrl?.();
12569
+ if (preparedAuthUrl && authProviderRef.current && preventAutoAuth) {
12570
+ addLog(
12571
+ "info",
12572
+ "OAuth already discovered (stored auth URL present); awaiting manual authentication."
12573
+ );
12574
+ if (isMountedRef.current) {
12575
+ setState("pending_auth");
12576
+ setAuthUrl(preparedAuthUrl);
12577
+ }
12578
+ connectingRef.current = false;
12579
+ return "auth_redirect";
12580
+ }
12569
12581
  const oauthDiscoveryFailed = isOAuthDiscoveryFailure(err);
12570
12582
  const is401Error = error2.code === 401 || errorMessage.includes("401") || errorMessage.includes("Unauthorized");
12571
12583
  if (oauthDiscoveryFailed && headers && Object.keys(headers).length > 0) {
@@ -12714,6 +12726,7 @@ function useMcp(options) {
12714
12726
  mergedClientInfo,
12715
12727
  // IMPORTANT: Include proxy-related dependencies so connect() uses updated values after fallback
12716
12728
  gatewayUrl,
12729
+ oauthProxyUrlOption,
12717
12730
  allHeaders,
12718
12731
  effectiveOAuthUrl
12719
12732
  ]);
@@ -12826,18 +12839,14 @@ function useMcp(options) {
12826
12839
  preventAutoAuth: false,
12827
12840
  useRedirectFlow,
12828
12841
  gatewayUrl,
12842
+ oauthProxyUrl: oauthProxyUrlOption,
12829
12843
  onPopupWindow: captureOnPopupWindow,
12830
- proxyOAuthRequests: !gatewayUrl,
12844
+ proxyOAuthRequests: true,
12831
12845
  staticClientInfo,
12832
12846
  scope: oauthScope
12833
12847
  });
12834
- if (oauthProxyUrl && !gatewayUrl) {
12848
+ if (oauthProxyUrl) {
12835
12849
  addLog("info", "Scoped OAuth proxy fetch enabled for manual auth");
12836
- } else if (oauthProxyUrl && gatewayUrl) {
12837
- addLog(
12838
- "info",
12839
- "Using MCP gateway proxy for OAuth (no scoped OAuth fetch needed)"
12840
- );
12841
12850
  }
12842
12851
  authProviderRef.current = freshAuthProvider;
12843
12852
  addLog("info", "Triggering fresh OAuth authorization...");
@@ -13326,6 +13335,7 @@ function useMcp(options) {
13326
13335
  preventAutoAuth,
13327
13336
  useRedirectFlow,
13328
13337
  gatewayUrl,
13338
+ oauthProxyUrl: oauthProxyUrlOption,
13329
13339
  onPopupWindow,
13330
13340
  proxyOAuthRequests: true,
13331
13341
  staticClientInfo,
@@ -13333,10 +13343,7 @@ function useMcp(options) {
13333
13343
  });
13334
13344
  authProviderRef.current = provider;
13335
13345
  if (oauthProxyUrl) {
13336
- addLog(
13337
- "debug",
13338
- `OAuth proxy URL derived from gateway: ${oauthProxyUrl}`
13339
- );
13346
+ addLog("debug", `OAuth proxy URL in effect: ${oauthProxyUrl}`);
13340
13347
  }
13341
13348
  addLog(
13342
13349
  "debug",
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OWF2HVMR.js";
6
6
  import {
7
7
  StdioConnector
8
- } from "./chunk-WIGHPYJZ.js";
8
+ } from "./chunk-AOZBHAT7.js";
9
9
  import {
10
10
  clearRpcLogs,
11
11
  getAllRpcLogs,
@@ -32,7 +32,7 @@ import {
32
32
  reject,
33
33
  resolveCallbacks,
34
34
  validate
35
- } from "./chunk-3N3CCJUC.js";
35
+ } from "./chunk-U6UCVQKQ.js";
36
36
  import "./chunk-GKPKUKD6.js";
37
37
  import "./chunk-GXNAXUDI.js";
38
38
  import {
@@ -50,12 +50,12 @@ import {
50
50
  getSupportedProviders,
51
51
  isValidLLMString,
52
52
  parseLLMString
53
- } from "./chunk-UIN2NARV.js";
53
+ } from "./chunk-3N6PYMAD.js";
54
54
  import "./chunk-N27VLLMA.js";
55
- import "./chunk-GO576WUP.js";
55
+ import "./chunk-2J3FVMZ5.js";
56
56
  import {
57
57
  BaseConnector
58
- } from "./chunk-XRUCU3OM.js";
58
+ } from "./chunk-4KP3757O.js";
59
59
  import {
60
60
  BaseAdapter
61
61
  } from "./chunk-27JERD25.js";
@@ -98,7 +98,7 @@ import {
98
98
  createServerRunEventData,
99
99
  getPackageVersion,
100
100
  setTelemetrySource
101
- } from "./chunk-HNUILRUJ.js";
101
+ } from "./chunk-WEMFZYUR.js";
102
102
  import {
103
103
  telFetch
104
104
  } from "./chunk-BXZHMYMM.js";
@@ -739,7 +739,7 @@ function deriveOAuthProxyUrl(gatewayUrl) {
739
739
  }
740
740
  __name(deriveOAuthProxyUrl, "deriveOAuthProxyUrl");
741
741
  function createBrowserOAuthProvider(params) {
742
- const oauthProxyUrl = deriveOAuthProxyUrl(params.gatewayUrl);
742
+ const oauthProxyUrl = params.oauthProxyUrl ?? deriveOAuthProxyUrl(params.gatewayUrl);
743
743
  const provider = new BrowserOAuthClientProvider(params.effectiveOAuthUrl, {
744
744
  storageKeyPrefix: params.storageKeyPrefix,
745
745
  clientName: params.oauthClientConfig.name,
@@ -842,6 +842,7 @@ function useMcp(options) {
842
842
  headers: headersOption,
843
843
  customHeaders: customHeadersOption,
844
844
  proxyConfig,
845
+ oauthProxyUrl: oauthProxyUrlOption,
845
846
  autoProxyFallback = true,
846
847
  debug: _debug = false,
847
848
  logLevel: logLevelOption,
@@ -1232,6 +1233,7 @@ function useMcp(options) {
1232
1233
  preventAutoAuth,
1233
1234
  useRedirectFlow,
1234
1235
  gatewayUrl,
1236
+ oauthProxyUrl: oauthProxyUrlOption,
1235
1237
  onPopupWindow,
1236
1238
  proxyOAuthRequests: true,
1237
1239
  staticClientInfo,
@@ -1239,10 +1241,7 @@ function useMcp(options) {
1239
1241
  });
1240
1242
  authProviderRef.current = provider;
1241
1243
  if (oauthProxyUrl) {
1242
- addLog(
1243
- "debug",
1244
- `OAuth proxy URL derived from gateway: ${oauthProxyUrl}`
1245
- );
1244
+ addLog("debug", `OAuth proxy URL in effect: ${oauthProxyUrl}`);
1246
1245
  }
1247
1246
  addLog(
1248
1247
  "debug",
@@ -1579,6 +1578,19 @@ function useMcp(options) {
1579
1578
  } catch (err) {
1580
1579
  const error2 = err;
1581
1580
  const errorMessage = error2?.message || String(err);
1581
+ const preparedAuthUrl = authProviderRef.current?.getLastAttemptedAuthUrl?.();
1582
+ if (preparedAuthUrl && authProviderRef.current && preventAutoAuth) {
1583
+ addLog(
1584
+ "info",
1585
+ "OAuth already discovered (stored auth URL present); awaiting manual authentication."
1586
+ );
1587
+ if (isMountedRef.current) {
1588
+ setState("pending_auth");
1589
+ setAuthUrl(preparedAuthUrl);
1590
+ }
1591
+ connectingRef.current = false;
1592
+ return "auth_redirect";
1593
+ }
1582
1594
  const oauthDiscoveryFailed = isOAuthDiscoveryFailure(err);
1583
1595
  const is401Error = error2.code === 401 || errorMessage.includes("401") || errorMessage.includes("Unauthorized");
1584
1596
  if (oauthDiscoveryFailed && headers && Object.keys(headers).length > 0) {
@@ -1727,6 +1739,7 @@ function useMcp(options) {
1727
1739
  mergedClientInfo,
1728
1740
  // IMPORTANT: Include proxy-related dependencies so connect() uses updated values after fallback
1729
1741
  gatewayUrl,
1742
+ oauthProxyUrlOption,
1730
1743
  allHeaders,
1731
1744
  effectiveOAuthUrl
1732
1745
  ]);
@@ -1839,18 +1852,14 @@ function useMcp(options) {
1839
1852
  preventAutoAuth: false,
1840
1853
  useRedirectFlow,
1841
1854
  gatewayUrl,
1855
+ oauthProxyUrl: oauthProxyUrlOption,
1842
1856
  onPopupWindow: captureOnPopupWindow,
1843
- proxyOAuthRequests: !gatewayUrl,
1857
+ proxyOAuthRequests: true,
1844
1858
  staticClientInfo,
1845
1859
  scope: oauthScope
1846
1860
  });
1847
- if (oauthProxyUrl && !gatewayUrl) {
1861
+ if (oauthProxyUrl) {
1848
1862
  addLog("info", "Scoped OAuth proxy fetch enabled for manual auth");
1849
- } else if (oauthProxyUrl && gatewayUrl) {
1850
- addLog(
1851
- "info",
1852
- "Using MCP gateway proxy for OAuth (no scoped OAuth fetch needed)"
1853
- );
1854
1863
  }
1855
1864
  authProviderRef.current = freshAuthProvider;
1856
1865
  addLog("info", "Triggering fresh OAuth authorization...");
@@ -2339,6 +2348,7 @@ function useMcp(options) {
2339
2348
  preventAutoAuth,
2340
2349
  useRedirectFlow,
2341
2350
  gatewayUrl,
2351
+ oauthProxyUrl: oauthProxyUrlOption,
2342
2352
  onPopupWindow,
2343
2353
  proxyOAuthRequests: true,
2344
2354
  staticClientInfo,
@@ -2346,10 +2356,7 @@ function useMcp(options) {
2346
2356
  });
2347
2357
  authProviderRef.current = provider;
2348
2358
  if (oauthProxyUrl) {
2349
- addLog(
2350
- "debug",
2351
- `OAuth proxy URL derived from gateway: ${oauthProxyUrl}`
2352
- );
2359
+ addLog("debug", `OAuth proxy URL in effect: ${oauthProxyUrl}`);
2353
2360
  }
2354
2361
  addLog(
2355
2362
  "debug",
@@ -583,7 +583,7 @@ var VERSION;
583
583
  var init_version = __esm({
584
584
  "src/version.ts"() {
585
585
  "use strict";
586
- VERSION = "1.33.0";
586
+ VERSION = "1.34.0";
587
587
  __name(getPackageVersion, "getPackageVersion");
588
588
  }
589
589
  });
@@ -3,13 +3,13 @@ import {
3
3
  MCPAgent,
4
4
  PROMPTS,
5
5
  RemoteAgent
6
- } from "../../chunk-UIN2NARV.js";
6
+ } from "../../chunk-3N6PYMAD.js";
7
7
  import "../../chunk-N27VLLMA.js";
8
- import "../../chunk-GO576WUP.js";
9
- import "../../chunk-XRUCU3OM.js";
8
+ import "../../chunk-2J3FVMZ5.js";
9
+ import "../../chunk-4KP3757O.js";
10
10
  import "../../chunk-27JERD25.js";
11
11
  import "../../chunk-LG5NSHEL.js";
12
- import "../../chunk-HNUILRUJ.js";
12
+ import "../../chunk-WEMFZYUR.js";
13
13
  import "../../chunk-BXZHMYMM.js";
14
14
  import "../../chunk-MTHLLDCX.js";
15
15
  import "../../chunk-QWQYAQCK.js";
@@ -1170,7 +1170,7 @@ var VERSION;
1170
1170
  var init_version = __esm({
1171
1171
  "src/version.ts"() {
1172
1172
  "use strict";
1173
- VERSION = "1.33.0";
1173
+ VERSION = "1.34.0";
1174
1174
  __name(getPackageVersion, "getPackageVersion");
1175
1175
  }
1176
1176
  });
@@ -7,7 +7,7 @@ import {
7
7
  Telemetry,
8
8
  extractModelInfo,
9
9
  getPackageVersion
10
- } from "../chunk-D2NNKAES.js";
10
+ } from "../chunk-XS2ZMBOG.js";
11
11
  import {
12
12
  logger
13
13
  } from "../chunk-QWQYAQCK.js";
@@ -1671,7 +1671,7 @@ var MCPAgent = class {
1671
1671
  logger.debug(
1672
1672
  `Creating MCPClient with ${Object.keys(this.mcpServersConfig).length} server(s)...`
1673
1673
  );
1674
- const { MCPClient } = await import("../client-4IX6UVDX.js");
1674
+ const { MCPClient } = await import("../client-O5HMGXF3.js");
1675
1675
  this.client = new MCPClient({ mcpServers: this.mcpServersConfig });
1676
1676
  logger.debug("\u2705 MCPClient created successfully");
1677
1677
  }
@@ -783,7 +783,7 @@ var ClientRemoveServerEvent = class extends BaseTelemetryEvent {
783
783
  };
784
784
 
785
785
  // src/version.ts
786
- var VERSION = "1.33.0";
786
+ var VERSION = "1.34.0";
787
787
  function getPackageVersion() {
788
788
  return VERSION;
789
789
  }
@@ -2,22 +2,22 @@ import {
2
2
  BrowserMCPClient,
3
3
  BrowserOAuthClientProvider,
4
4
  onMcpAuthorization
5
- } from "../chunk-W4VPNJFD.js";
5
+ } from "../chunk-3UOADQDZ.js";
6
6
  import {
7
7
  HttpConnector,
8
8
  MCPSession
9
- } from "../chunk-NJKHYDW2.js";
9
+ } from "../chunk-BOFDVMBT.js";
10
10
  import "../chunk-URE3PRDB.js";
11
11
  import {
12
12
  BaseConnector
13
- } from "../chunk-EJA76EVX.js";
13
+ } from "../chunk-7MKAP6XK.js";
14
14
  import {
15
15
  Tel,
16
16
  Telemetry,
17
17
  VERSION,
18
18
  getPackageVersion,
19
19
  setTelemetrySource
20
- } from "../chunk-D2NNKAES.js";
20
+ } from "../chunk-XS2ZMBOG.js";
21
21
  import {
22
22
  Logger,
23
23
  logger
@@ -215,7 +215,7 @@ var VERSION;
215
215
  var init_version = __esm({
216
216
  "src/version.ts"() {
217
217
  "use strict";
218
- VERSION = "1.33.0";
218
+ VERSION = "1.34.0";
219
219
  __name(getPackageVersion, "getPackageVersion");
220
220
  }
221
221
  });
@@ -13,12 +13,12 @@ import {
13
13
  isVMAvailable,
14
14
  reject,
15
15
  validate
16
- } from "../chunk-3N3CCJUC.js";
16
+ } from "../chunk-U6UCVQKQ.js";
17
17
  import "../chunk-GKPKUKD6.js";
18
- import "../chunk-GO576WUP.js";
19
- import "../chunk-XRUCU3OM.js";
18
+ import "../chunk-2J3FVMZ5.js";
19
+ import "../chunk-4KP3757O.js";
20
20
  import "../chunk-LG5NSHEL.js";
21
- import "../chunk-HNUILRUJ.js";
21
+ import "../chunk-WEMFZYUR.js";
22
22
  import "../chunk-BXZHMYMM.js";
23
23
  import "../chunk-MTHLLDCX.js";
24
24
  import "../chunk-QWQYAQCK.js";
@@ -1110,7 +1110,7 @@ var ClientRemoveServerEvent = class extends BaseTelemetryEvent {
1110
1110
  };
1111
1111
 
1112
1112
  // src/version.ts
1113
- var VERSION = "1.33.0";
1113
+ var VERSION = "1.34.0";
1114
1114
  function getPackageVersion() {
1115
1115
  return VERSION;
1116
1116
  }
@@ -4334,7 +4334,7 @@ function deriveOAuthProxyUrl(gatewayUrl) {
4334
4334
  }
4335
4335
  __name(deriveOAuthProxyUrl, "deriveOAuthProxyUrl");
4336
4336
  function createBrowserOAuthProvider(params) {
4337
- const oauthProxyUrl = deriveOAuthProxyUrl(params.gatewayUrl);
4337
+ const oauthProxyUrl = params.oauthProxyUrl ?? deriveOAuthProxyUrl(params.gatewayUrl);
4338
4338
  const provider = new BrowserOAuthClientProvider(params.effectiveOAuthUrl, {
4339
4339
  storageKeyPrefix: params.storageKeyPrefix,
4340
4340
  clientName: params.oauthClientConfig.name,
@@ -4437,6 +4437,7 @@ function useMcp(options) {
4437
4437
  headers: headersOption,
4438
4438
  customHeaders: customHeadersOption,
4439
4439
  proxyConfig,
4440
+ oauthProxyUrl: oauthProxyUrlOption,
4440
4441
  autoProxyFallback = true,
4441
4442
  debug: _debug = false,
4442
4443
  logLevel: logLevelOption,
@@ -4827,6 +4828,7 @@ function useMcp(options) {
4827
4828
  preventAutoAuth,
4828
4829
  useRedirectFlow,
4829
4830
  gatewayUrl,
4831
+ oauthProxyUrl: oauthProxyUrlOption,
4830
4832
  onPopupWindow,
4831
4833
  proxyOAuthRequests: true,
4832
4834
  staticClientInfo,
@@ -4834,10 +4836,7 @@ function useMcp(options) {
4834
4836
  });
4835
4837
  authProviderRef.current = provider;
4836
4838
  if (oauthProxyUrl) {
4837
- addLog(
4838
- "debug",
4839
- `OAuth proxy URL derived from gateway: ${oauthProxyUrl}`
4840
- );
4839
+ addLog("debug", `OAuth proxy URL in effect: ${oauthProxyUrl}`);
4841
4840
  }
4842
4841
  addLog(
4843
4842
  "debug",
@@ -5174,6 +5173,19 @@ function useMcp(options) {
5174
5173
  } catch (err) {
5175
5174
  const error2 = err;
5176
5175
  const errorMessage = error2?.message || String(err);
5176
+ const preparedAuthUrl = authProviderRef.current?.getLastAttemptedAuthUrl?.();
5177
+ if (preparedAuthUrl && authProviderRef.current && preventAutoAuth) {
5178
+ addLog(
5179
+ "info",
5180
+ "OAuth already discovered (stored auth URL present); awaiting manual authentication."
5181
+ );
5182
+ if (isMountedRef.current) {
5183
+ setState("pending_auth");
5184
+ setAuthUrl(preparedAuthUrl);
5185
+ }
5186
+ connectingRef.current = false;
5187
+ return "auth_redirect";
5188
+ }
5177
5189
  const oauthDiscoveryFailed = isOAuthDiscoveryFailure(err);
5178
5190
  const is401Error = error2.code === 401 || errorMessage.includes("401") || errorMessage.includes("Unauthorized");
5179
5191
  if (oauthDiscoveryFailed && headers && Object.keys(headers).length > 0) {
@@ -5322,6 +5334,7 @@ function useMcp(options) {
5322
5334
  mergedClientInfo,
5323
5335
  // IMPORTANT: Include proxy-related dependencies so connect() uses updated values after fallback
5324
5336
  gatewayUrl,
5337
+ oauthProxyUrlOption,
5325
5338
  allHeaders,
5326
5339
  effectiveOAuthUrl
5327
5340
  ]);
@@ -5434,18 +5447,14 @@ function useMcp(options) {
5434
5447
  preventAutoAuth: false,
5435
5448
  useRedirectFlow,
5436
5449
  gatewayUrl,
5450
+ oauthProxyUrl: oauthProxyUrlOption,
5437
5451
  onPopupWindow: captureOnPopupWindow,
5438
- proxyOAuthRequests: !gatewayUrl,
5452
+ proxyOAuthRequests: true,
5439
5453
  staticClientInfo,
5440
5454
  scope: oauthScope
5441
5455
  });
5442
- if (oauthProxyUrl && !gatewayUrl) {
5456
+ if (oauthProxyUrl) {
5443
5457
  addLog("info", "Scoped OAuth proxy fetch enabled for manual auth");
5444
- } else if (oauthProxyUrl && gatewayUrl) {
5445
- addLog(
5446
- "info",
5447
- "Using MCP gateway proxy for OAuth (no scoped OAuth fetch needed)"
5448
- );
5449
5458
  }
5450
5459
  authProviderRef.current = freshAuthProvider;
5451
5460
  addLog("info", "Triggering fresh OAuth authorization...");
@@ -5934,6 +5943,7 @@ function useMcp(options) {
5934
5943
  preventAutoAuth,
5935
5944
  useRedirectFlow,
5936
5945
  gatewayUrl,
5946
+ oauthProxyUrl: oauthProxyUrlOption,
5937
5947
  onPopupWindow,
5938
5948
  proxyOAuthRequests: true,
5939
5949
  staticClientInfo,
@@ -5941,10 +5951,7 @@ function useMcp(options) {
5941
5951
  });
5942
5952
  authProviderRef.current = provider;
5943
5953
  if (oauthProxyUrl) {
5944
- addLog(
5945
- "debug",
5946
- `OAuth proxy URL derived from gateway: ${oauthProxyUrl}`
5947
- );
5954
+ addLog("debug", `OAuth proxy URL in effect: ${oauthProxyUrl}`);
5948
5955
  }
5949
5956
  addLog(
5950
5957
  "debug",