@mylasecurity/gate 0.3.0 → 0.3.2

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 (2) hide show
  1. package/bin/gate.mjs +23 -7
  2. package/package.json +2 -2
package/bin/gate.mjs CHANGED
@@ -2381,17 +2381,20 @@ function mcpStatus(home, platform) {
2381
2381
  try {
2382
2382
  doc = JSON.parse(fs10.readFileSync(file, "utf8"));
2383
2383
  } catch {
2384
- return { label, file, present: false, gated: [], bare: [] };
2384
+ return { label, file, present: false, gated: [], bare: [], remote: [] };
2385
2385
  }
2386
2386
  const servers = doc.mcpServers;
2387
- if (!servers || typeof servers !== "object") return { label, file, present: true, gated: [], bare: [] };
2387
+ if (!servers || typeof servers !== "object") return { label, file, present: true, gated: [], bare: [], remote: [] };
2388
2388
  const gated = [];
2389
2389
  const bare = [];
2390
+ const remote = [];
2390
2391
  for (const [name, entry] of Object.entries(servers)) {
2391
2392
  if (!entry || typeof entry !== "object") continue;
2392
- (isWrapped(entry) ? gated : bare).push(name);
2393
+ if (isWrapped(entry)) gated.push(name);
2394
+ else if (typeof entry.command === "string" && entry.command) bare.push(name);
2395
+ else remote.push(name);
2393
2396
  }
2394
- return { label, file, present: true, gated, bare };
2397
+ return { label, file, present: true, gated, bare, remote };
2395
2398
  });
2396
2399
  }
2397
2400
  function renderMcpStatus(files, hasCredential) {
@@ -2407,15 +2410,22 @@ function renderMcpStatus(files, hasCredential) {
2407
2410
  const bits = [];
2408
2411
  if (f.gated.length) bits.push(`${f.gated.length} behind the Gate (${f.gated.join(", ")})`);
2409
2412
  if (f.bare.length) bits.push(`${f.bare.length} not gated (${f.bare.join(", ")})`);
2413
+ if (f.remote.length) bits.push(`${f.remote.length} that cannot be gated this way (${f.remote.join(", ")})`);
2410
2414
  out3.push(`${f.label}: ${bits.length ? bits.join("; ") : "no MCP servers configured"}`);
2411
2415
  out3.push(` ${f.file}`);
2412
2416
  }
2413
2417
  const total = seen.reduce((n, f) => n + f.gated.length, 0);
2414
2418
  const bare = seen.reduce((n, f) => n + f.bare.length, 0);
2419
+ const remote = seen.reduce((n, f) => n + f.remote.length, 0);
2415
2420
  if (total > 0 && !hasCredential) {
2416
2421
  out3.push("A server is wrapped but there is no credential on this machine, so the proxy cannot ask Myla. Run: npx @mylasecurity/gate mcp install <claim-code>");
2417
2422
  }
2418
2423
  if (bare > 0) out3.push(`Put the rest behind the Gate with: npx @mylasecurity/gate mcp install${total > 0 ? "" : " <claim-code>"}`);
2424
+ if (remote > 0) {
2425
+ out3.push("A server that cannot be gated this way is one the app reaches over the network, so there is no");
2426
+ out3.push("local command to stand in front of. Running install again will not change it, and Myla does not");
2427
+ out3.push("see those calls.");
2428
+ }
2419
2429
  if (total > 0) out3.push("A call to a gated server is judged before it runs. Quit and reopen the app after any change \u2014 MCP servers start with it.");
2420
2430
  return out3;
2421
2431
  }
@@ -2525,7 +2535,11 @@ async function runMcpInstall(io, opts) {
2525
2535
  }
2526
2536
  const touched = results.filter((r) => r.changed.length > 0);
2527
2537
  if (touched.length === 0) {
2528
- io.out(opts.on ? "Found no MCP servers to put behind the Gate. Either none are configured, or they are already behind it." : "Found no Myla-wrapped MCP servers to put back.");
2538
+ if (!opts.on) {
2539
+ io.out("Found no Myla-wrapped MCP servers to put back.");
2540
+ return 0;
2541
+ }
2542
+ for (const line of renderMcpStatus(mcpStatus(opts.home, opts.platform), true)) io.out(line);
2529
2543
  return 0;
2530
2544
  }
2531
2545
  for (const r of touched) {
@@ -2585,7 +2599,8 @@ function runServe(io, opts) {
2585
2599
  }
2586
2600
 
2587
2601
  // src/cli.ts
2588
- import { pathToFileURL } from "node:url";
2602
+ import { fileURLToPath } from "node:url";
2603
+ import { realpathSync } from "node:fs";
2589
2604
  var realIo = {
2590
2605
  out: (s) => process.stdout.write(s + "\n"),
2591
2606
  err: (s) => process.stderr.write(s + "\n")
@@ -2795,10 +2810,11 @@ async function main(argv, io = realIo) {
2795
2810
  }
2796
2811
  }
2797
2812
  var isDirectRun = (() => {
2813
+ if (true) return true;
2798
2814
  const invoked = process.argv[1];
2799
2815
  if (!invoked) return false;
2800
2816
  try {
2801
- return import.meta.url === pathToFileURL(invoked).href;
2817
+ return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(invoked);
2802
2818
  } catch {
2803
2819
  return false;
2804
2820
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mylasecurity/gate",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "license": "MIT",
5
5
  "description": "Put the Myla Gate in front of your AI agents: coding agents (Claude Code, Cursor, Codex) through their hooks, and any MCP client through its servers. Backs up first, prints exactly what it changed.",
6
6
  "homepage": "https://mylasecurity.app",
@@ -23,7 +23,7 @@
23
23
  "node": ">=18"
24
24
  },
25
25
  "scripts": {
26
- "build": "npx --yes esbuild src/cli.ts --bundle --platform=node --format=esm --target=node18 --tsconfig=../../tsconfig.json --banner:js=\"#!/usr/bin/env node\" --outfile=bin/gate.mjs",
26
+ "build": "npx --yes esbuild src/cli.ts --bundle --platform=node --format=esm --target=node18 --define:__GATE_BUNDLE__=true --tsconfig=../../tsconfig.json --banner:js=\"#!/usr/bin/env node\" --outfile=bin/gate.mjs",
27
27
  "prepublishOnly": "npm run build"
28
28
  },
29
29
  "files": [