mcp-remote 0.1.14 → 0.1.16

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.
@@ -11707,7 +11707,7 @@ var Client = class extends Protocol {
11707
11707
  };
11708
11708
 
11709
11709
  // package.json
11710
- var version = "0.1.14";
11710
+ var version = "0.1.16";
11711
11711
 
11712
11712
  // node_modules/.pnpm/pkce-challenge@5.0.0/node_modules/pkce-challenge/dist/index.node.js
11713
11713
  var crypto;
@@ -13669,6 +13669,28 @@ function setupSignalHandlers(cleanup) {
13669
13669
  function getServerUrlHash(serverUrl) {
13670
13670
  return crypto2.createHash("md5").update(serverUrl).digest("hex");
13671
13671
  }
13672
+ function sanitizeUrl(raw) {
13673
+ const abort = () => {
13674
+ throw new Error(`Invalid url to pass to open(): ${raw}`);
13675
+ };
13676
+ let url;
13677
+ try {
13678
+ url = new URL(raw);
13679
+ } catch (_) {
13680
+ abort();
13681
+ }
13682
+ if (url.protocol !== "https:" && url.protocol !== "http:") abort();
13683
+ if (url.hostname !== encodeURIComponent(url.hostname)) abort();
13684
+ if (url.username) url.username = encodeURIComponent(url.username);
13685
+ if (url.password) url.password = encodeURIComponent(url.password);
13686
+ url.pathname = url.pathname.slice(0, 1) + encodeURIComponent(url.pathname.slice(1)).replace(/%2f/ig, "/");
13687
+ url.search = url.search.slice(0, 1) + Array.from(url.searchParams.entries()).map(sanitizeParam).join("&");
13688
+ url.hash = url.hash.slice(0, 1) + encodeURIComponent(url.hash.slice(1));
13689
+ return url.href;
13690
+ }
13691
+ function sanitizeParam([k, v]) {
13692
+ return `${encodeURIComponent(k)}${v.length > 0 ? `=${encodeURIComponent(v)}` : ""}`;
13693
+ }
13672
13694
 
13673
13695
  // src/lib/node-oauth-client-provider.ts
13674
13696
  import open from "open";
@@ -13812,7 +13834,7 @@ ${authorizationUrl.toString()}
13812
13834
  `);
13813
13835
  if (DEBUG) debugLog("Redirecting to authorization URL", authorizationUrl.toString());
13814
13836
  try {
13815
- await open(authorizationUrl.toString());
13837
+ await open(sanitizeUrl(authorizationUrl.toString()));
13816
13838
  log("Browser opened automatically.");
13817
13839
  } catch (error) {
13818
13840
  log("Could not open browser automatically. Please copy and paste the URL above into your browser.");
package/dist/client.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  parseCommandLineArgs,
12
12
  setupSignalHandlers,
13
13
  version
14
- } from "./chunk-FBGYN3F2.js";
14
+ } from "./chunk-4PNJQ7WT.js";
15
15
 
16
16
  // src/client.ts
17
17
  import { EventEmitter } from "events";
package/dist/proxy.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  mcpProxy,
10
10
  parseCommandLineArgs,
11
11
  setupSignalHandlers
12
- } from "./chunk-FBGYN3F2.js";
12
+ } from "./chunk-4PNJQ7WT.js";
13
13
 
14
14
  // src/proxy.ts
15
15
  import { EventEmitter } from "events";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-remote",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth",
5
5
  "keywords": [
6
6
  "mcp",
@@ -26,7 +26,9 @@
26
26
  "build": "tsup",
27
27
  "build:watch": "tsup --watch",
28
28
  "check": "prettier --check . && tsc",
29
- "lint-fix": "prettier --check . --write"
29
+ "lint-fix": "prettier --check . --write",
30
+ "test:unit": "vitest run",
31
+ "test:unit:watch": "vitest"
30
32
  },
31
33
  "dependencies": {
32
34
  "express": "^4.21.2",
@@ -39,7 +41,8 @@
39
41
  "prettier": "^3.5.3",
40
42
  "tsup": "^8.4.0",
41
43
  "tsx": "^4.19.3",
42
- "typescript": "^5.8.2"
44
+ "typescript": "^5.8.2",
45
+ "vitest": "^3.2.3"
43
46
  },
44
47
  "tsup": {
45
48
  "entry": [
@@ -54,5 +57,12 @@
54
57
  "outDir": "dist",
55
58
  "external": []
56
59
  },
60
+ "vitest": {
61
+ "environment": "node",
62
+ "globals": true,
63
+ "include": [
64
+ "src/**/*.test.ts"
65
+ ]
66
+ },
57
67
  "packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
58
68
  }