mcp-use 1.34.0 → 1.34.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.
Files changed (37) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{chunk-3UOADQDZ.js → chunk-2EBW4344.js} +40 -4
  3. package/dist/{chunk-U6UCVQKQ.js → chunk-D7SEH5RU.js} +4 -4
  4. package/dist/{chunk-3N6PYMAD.js → chunk-LPVVF6US.js} +2 -2
  5. package/dist/{chunk-AOZBHAT7.js → chunk-LZOTKOYW.js} +1 -1
  6. package/dist/{chunk-VWJXSLCF.js → chunk-N3DGPXFX.js} +38 -2
  7. package/dist/{chunk-EIYWOJYK.js → chunk-NXLY2JS7.js} +1 -1
  8. package/dist/{chunk-WEMFZYUR.js → chunk-PSOT2YDT.js} +1 -1
  9. package/dist/{chunk-2J3FVMZ5.js → chunk-TAPTQKI4.js} +1 -1
  10. package/dist/{chunk-7MKAP6XK.js → chunk-VYDFQS24.js} +1 -1
  11. package/dist/{chunk-XS2ZMBOG.js → chunk-XIAP7CEH.js} +1 -1
  12. package/dist/{chunk-BOFDVMBT.js → chunk-YQIRNTLE.js} +2 -2
  13. package/dist/{chunk-4KP3757O.js → chunk-YZ22J43K.js} +1 -1
  14. package/dist/{client-O5HMGXF3.js → client-AGYZM4PU.js} +4 -4
  15. package/dist/index.cjs +39 -3
  16. package/dist/index.js +7 -7
  17. package/dist/src/agents/index.cjs +1 -1
  18. package/dist/src/agents/index.js +4 -4
  19. package/dist/src/auth/browser-provider.d.ts +16 -0
  20. package/dist/src/auth/browser-provider.d.ts.map +1 -1
  21. package/dist/src/auth/index.cjs +38 -2
  22. package/dist/src/auth/index.js +1 -1
  23. package/dist/src/browser-agent.cjs +1 -1
  24. package/dist/src/browser-agent.js +2 -2
  25. package/dist/src/browser.cjs +39 -3
  26. package/dist/src/browser.js +4 -4
  27. package/dist/src/client.cjs +1 -1
  28. package/dist/src/client.js +4 -4
  29. package/dist/src/react/index.cjs +39 -3
  30. package/dist/src/react/index.js +4 -4
  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-QIYDKXTT.js → stdio-ECCMBHYL.js} +3 -3
  35. package/dist/{stdio-NRH7PMXI.js → stdio-VYJBFXTQ.js} +2 -2
  36. package/dist/{tool-execution-helpers-GEQBGCKR.js → tool-execution-helpers-J4XLCZBU.js} +2 -2
  37. package/package.json +3 -3
@@ -2,22 +2,22 @@ import {
2
2
  BrowserMCPClient,
3
3
  BrowserOAuthClientProvider,
4
4
  onMcpAuthorization
5
- } from "../chunk-3UOADQDZ.js";
5
+ } from "../chunk-2EBW4344.js";
6
6
  import {
7
7
  HttpConnector,
8
8
  MCPSession
9
- } from "../chunk-BOFDVMBT.js";
9
+ } from "../chunk-YQIRNTLE.js";
10
10
  import "../chunk-URE3PRDB.js";
11
11
  import {
12
12
  BaseConnector
13
- } from "../chunk-7MKAP6XK.js";
13
+ } from "../chunk-VYDFQS24.js";
14
14
  import {
15
15
  Tel,
16
16
  Telemetry,
17
17
  VERSION,
18
18
  getPackageVersion,
19
19
  setTelemetrySource
20
- } from "../chunk-XS2ZMBOG.js";
20
+ } from "../chunk-XIAP7CEH.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.34.0";
218
+ VERSION = "1.34.1";
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-U6UCVQKQ.js";
16
+ } from "../chunk-D7SEH5RU.js";
17
17
  import "../chunk-GKPKUKD6.js";
18
- import "../chunk-2J3FVMZ5.js";
19
- import "../chunk-4KP3757O.js";
18
+ import "../chunk-TAPTQKI4.js";
19
+ import "../chunk-YZ22J43K.js";
20
20
  import "../chunk-LG5NSHEL.js";
21
- import "../chunk-WEMFZYUR.js";
21
+ import "../chunk-PSOT2YDT.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.34.0";
1113
+ var VERSION = "1.34.1";
1114
1114
  function getPackageVersion() {
1115
1115
  return VERSION;
1116
1116
  }
@@ -4023,6 +4023,41 @@ var BrowserOAuthClientProvider = class {
4023
4023
  getKey(keySuffix) {
4024
4024
  return this.session.getKey(keySuffix);
4025
4025
  }
4026
+ /**
4027
+ * Re-anchor an SDK-derived OAuth discovery URL from the MCP connection
4028
+ * (proxy) origin onto the actual MCP server.
4029
+ *
4030
+ * When MCP traffic is tunneled through a gateway/inspector proxy, the SDK
4031
+ * transport derives `/.well-known/*` URLs from the URL it connected to (the
4032
+ * proxy) whenever no `resource_metadata` hint is available — the SSE
4033
+ * transport's EventSource cannot read `WWW-Authenticate`, and token refresh
4034
+ * runs without a 401 response at hand. The proxy origin serves no OAuth
4035
+ * metadata, so discovery would fail and the server would be misclassified
4036
+ * as "does not support OAuth". Rewriting reproduces what a direct
4037
+ * connection would have requested: the same well-known document, anchored
4038
+ * on the server origin, with the RFC 8414 §3.1 / RFC 9728 §3.1 path
4039
+ * insertion using the server's path instead of the proxy's.
4040
+ */
4041
+ reanchorWellKnownUrl(url) {
4042
+ if (!this.connectionUrl) return url;
4043
+ try {
4044
+ const requested = new URL(url);
4045
+ const connection = new URL(this.connectionUrl);
4046
+ if (requested.origin !== connection.origin) return url;
4047
+ if (!requested.pathname.startsWith("/.well-known/")) return url;
4048
+ const target = new URL(this.serverUrl);
4049
+ const rest = requested.pathname.slice("/.well-known/".length);
4050
+ const [doc, ...suffixParts] = rest.split("/");
4051
+ if (!doc) return url;
4052
+ const suffix = suffixParts.length ? `/${suffixParts.join("/")}` : "";
4053
+ const connectionPath = connection.pathname.replace(/\/+$/, "");
4054
+ const targetPath = target.pathname.replace(/\/+$/, "");
4055
+ const newSuffix = suffix && suffix === connectionPath ? targetPath : suffix;
4056
+ return `${target.origin}/.well-known/${doc}${newSuffix}${requested.search}`;
4057
+ } catch {
4058
+ return url;
4059
+ }
4060
+ }
4026
4061
  /**
4027
4062
  * Returns a `fetch` function, scoped to this provider, that routes OAuth
4028
4063
  * requests (`.well-known` metadata, token, register, authorize) through the
@@ -4052,7 +4087,8 @@ var BrowserOAuthClientProvider = class {
4052
4087
  const connectionUrl = this.connectionUrl;
4053
4088
  const serverUrl = this.serverUrl;
4054
4089
  return async (input, init) => {
4055
- const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
4090
+ const requestedUrl = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
4091
+ const url = this.reanchorWellKnownUrl(requestedUrl);
4056
4092
  const isOAuthRequest = url.includes("/.well-known/") || url.match(/\/(register|token|authorize)$/);
4057
4093
  if (!isOAuthRequest) {
4058
4094
  return await base(input, init);
@@ -4122,7 +4158,7 @@ var BrowserOAuthClientProvider = class {
4122
4158
  "[OAuth Proxy] Request failed, falling back to direct fetch:",
4123
4159
  error
4124
4160
  );
4125
- return await base(input, init);
4161
+ return url !== requestedUrl ? await base(url, init) : await base(input, init);
4126
4162
  }
4127
4163
  };
4128
4164
  }
@@ -6,16 +6,16 @@ import {
6
6
  onMcpAuthorization,
7
7
  runAuthPopup,
8
8
  sanitizeUrl
9
- } from "../../chunk-3UOADQDZ.js";
10
- import "../../chunk-BOFDVMBT.js";
9
+ } from "../../chunk-2EBW4344.js";
10
+ import "../../chunk-YQIRNTLE.js";
11
11
  import "../../chunk-URE3PRDB.js";
12
- import "../../chunk-7MKAP6XK.js";
12
+ import "../../chunk-VYDFQS24.js";
13
13
  import {
14
14
  Tel,
15
15
  Telemetry,
16
16
  getPackageVersion,
17
17
  setTelemetrySource
18
- } from "../../chunk-XS2ZMBOG.js";
18
+ } from "../../chunk-XIAP7CEH.js";
19
19
  import {
20
20
  clearRpcLogs,
21
21
  getAllRpcLogs,
@@ -661,7 +661,7 @@ var VERSION;
661
661
  var init_version = __esm({
662
662
  "src/version.ts"() {
663
663
  "use strict";
664
- VERSION = "1.34.0";
664
+ VERSION = "1.34.1";
665
665
  __name(getPackageVersion, "getPackageVersion");
666
666
  }
667
667
  });
@@ -17,7 +17,7 @@ import {
17
17
  findSessionContext,
18
18
  isValidLogLevel,
19
19
  supportsApps
20
- } from "../../chunk-EIYWOJYK.js";
20
+ } from "../../chunk-NXLY2JS7.js";
21
21
  import {
22
22
  getRequestContext,
23
23
  hasRequestContext,
@@ -59,7 +59,7 @@ import {
59
59
  Telemetry,
60
60
  VERSION,
61
61
  getPackageVersion
62
- } from "../../chunk-WEMFZYUR.js";
62
+ } from "../../chunk-PSOT2YDT.js";
63
63
  import "../../chunk-BXZHMYMM.js";
64
64
  import {
65
65
  fsHelpers,
@@ -3332,7 +3332,7 @@ function registerPrompt(promptDefinition, callback) {
3332
3332
  }
3333
3333
  const wrappedCallback = /* @__PURE__ */ __name(async (params, extra) => {
3334
3334
  const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-KMOAHEL7.js");
3335
- const { findSessionContext: findSessionContext2, createClientCapabilityChecker } = await import("../../tool-execution-helpers-GEQBGCKR.js");
3335
+ const { findSessionContext: findSessionContext2, createClientCapabilityChecker } = await import("../../tool-execution-helpers-J4XLCZBU.js");
3336
3336
  const initialRequestContext = getRequestContext2();
3337
3337
  const sessions = this.sessions || /* @__PURE__ */ new Map();
3338
3338
  const { requestContext, session } = findSessionContext2(
@@ -3537,7 +3537,7 @@ function registerResource(resourceDefinition, callback) {
3537
3537
  const explicitMimeType = resourceDefinition.mimeType;
3538
3538
  const wrappedCallback = /* @__PURE__ */ __name(async () => {
3539
3539
  const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-KMOAHEL7.js");
3540
- const { findSessionContext: findSessionContext2, createClientCapabilityChecker } = await import("../../tool-execution-helpers-GEQBGCKR.js");
3540
+ const { findSessionContext: findSessionContext2, createClientCapabilityChecker } = await import("../../tool-execution-helpers-J4XLCZBU.js");
3541
3541
  const initialRequestContext = getRequestContext2();
3542
3542
  const sessions = this.sessions || /* @__PURE__ */ new Map();
3543
3543
  const { requestContext, session } = findSessionContext2(
@@ -3626,7 +3626,7 @@ function registerResourceTemplate(resourceTemplateDefinition, callback) {
3626
3626
  async (uri) => {
3627
3627
  const params = this.parseTemplateUri(uriTemplate, uri.toString());
3628
3628
  const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-KMOAHEL7.js");
3629
- const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-GEQBGCKR.js");
3629
+ const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-J4XLCZBU.js");
3630
3630
  const initialRequestContext = getRequestContext2();
3631
3631
  const sessions = this.sessions || /* @__PURE__ */ new Map();
3632
3632
  const { requestContext } = findSessionContext2(
@@ -6988,7 +6988,7 @@ var MCPServerClass = class _MCPServerClass {
6988
6988
  onSampling: /* @__PURE__ */ __name(async (params) => {
6989
6989
  try {
6990
6990
  const { getRequestContext: getRequestContext2 } = await import("../../context-storage-KMOAHEL7.js");
6991
- const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-GEQBGCKR.js");
6991
+ const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-J4XLCZBU.js");
6992
6992
  const ctx = getRequestContext2();
6993
6993
  if (!ctx) throw new Error("No request context");
6994
6994
  const { session } = findSessionContext2(
@@ -7016,7 +7016,7 @@ var MCPServerClass = class _MCPServerClass {
7016
7016
  onElicitation: /* @__PURE__ */ __name(async (params) => {
7017
7017
  try {
7018
7018
  const { getRequestContext: getRequestContext2 } = await import("../../context-storage-KMOAHEL7.js");
7019
- const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-GEQBGCKR.js");
7019
+ const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-J4XLCZBU.js");
7020
7020
  const ctx = getRequestContext2();
7021
7021
  if (!ctx) throw new Error("No request context");
7022
7022
  const { session } = findSessionContext2(
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "1.34.0";
1
+ export declare const VERSION = "1.34.1";
2
2
  /**
3
3
  * Get the package version.
4
4
  * The version is embedded at build time via scripts/generate-version.mjs
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  StdioConnector
3
- } from "./chunk-AOZBHAT7.js";
3
+ } from "./chunk-LZOTKOYW.js";
4
4
  import "./chunk-GKPKUKD6.js";
5
- import "./chunk-4KP3757O.js";
6
- import "./chunk-WEMFZYUR.js";
5
+ import "./chunk-YZ22J43K.js";
6
+ import "./chunk-PSOT2YDT.js";
7
7
  import "./chunk-BXZHMYMM.js";
8
8
  import "./chunk-MTHLLDCX.js";
9
9
  import "./chunk-QWQYAQCK.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  BaseConnector,
3
3
  ConnectionManager
4
- } from "./chunk-7MKAP6XK.js";
5
- import "./chunk-XS2ZMBOG.js";
4
+ } from "./chunk-VYDFQS24.js";
5
+ import "./chunk-XIAP7CEH.js";
6
6
  import {
7
7
  logger
8
8
  } from "./chunk-QWQYAQCK.js";
@@ -7,10 +7,10 @@ import {
7
7
  findSessionContext,
8
8
  isValidLogLevel,
9
9
  supportsApps
10
- } from "./chunk-EIYWOJYK.js";
10
+ } from "./chunk-NXLY2JS7.js";
11
11
  import "./chunk-G7JEMXJW.js";
12
12
  import "./chunk-KUEVOU4M.js";
13
- import "./chunk-WEMFZYUR.js";
13
+ import "./chunk-PSOT2YDT.js";
14
14
  import "./chunk-BXZHMYMM.js";
15
15
  import "./chunk-MTHLLDCX.js";
16
16
  import "./chunk-QWQYAQCK.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcp-use",
3
3
  "type": "module",
4
- "version": "1.34.0",
4
+ "version": "1.34.1",
5
5
  "description": "Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.",
6
6
  "author": "mcp-use, Inc.",
7
7
  "license": "MIT",
@@ -158,8 +158,8 @@
158
158
  "node-mocks-http": "1.17.2",
159
159
  "posthog-js": "1.351.3",
160
160
  "posthog-node": "5.24.17",
161
- "@mcp-use/cli": "3.6.1",
162
- "@mcp-use/inspector": "12.0.0"
161
+ "@mcp-use/cli": "3.6.2",
162
+ "@mcp-use/inspector": "12.0.1"
163
163
  },
164
164
  "optionalDependencies": {
165
165
  "cli-highlight": "2.1.11",