iframer-cli 2.1.0 → 2.1.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 (3) hide show
  1. package/cli.js +39 -0
  2. package/mcp-server.cjs +6 -5
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -516,6 +516,44 @@ async function main() {
516
516
 
517
517
  // ─── Install MCP ──────────────────────────────────────────────
518
518
 
519
+ case "proxy": {
520
+ const action = args[0];
521
+ if (!action || !["start", "stop", "status"].includes(action)) {
522
+ console.log(" Usage: iframer proxy <start|stop|status> [proxy-url]");
523
+ console.log(" Note: 'start' requires a proxy URL (e.g. socks5://host:port).");
524
+ console.log(" To use your home IP automatically, use the iframer MCP tool instead.");
525
+ break;
526
+ }
527
+ if (action === "status") {
528
+ const res = await fetch(`${getServer()}/proxy`);
529
+ const data = await res.json();
530
+ console.log(JSON.stringify(data, null, 2));
531
+ } else if (action === "stop") {
532
+ const res = await fetch(`${getServer()}/proxy`, {
533
+ method: "POST",
534
+ headers: { "Content-Type": "application/json" },
535
+ body: JSON.stringify({ server: null }),
536
+ });
537
+ const data = await res.json();
538
+ console.log(JSON.stringify(data, null, 2));
539
+ } else if (action === "start") {
540
+ const proxyUrl = args[1];
541
+ if (!proxyUrl) {
542
+ console.error(" Error: 'proxy start' requires a proxy URL, e.g.: iframer proxy start socks5://host:port");
543
+ console.error(" To route through your home IP automatically, use the iframer MCP tool.");
544
+ process.exit(1);
545
+ }
546
+ const res = await fetch(`${getServer()}/proxy`, {
547
+ method: "POST",
548
+ headers: { "Content-Type": "application/json" },
549
+ body: JSON.stringify({ server: proxyUrl }),
550
+ });
551
+ const data = await res.json();
552
+ console.log(JSON.stringify(data, null, 2));
553
+ }
554
+ break;
555
+ }
556
+
519
557
  case "install-mcp": {
520
558
  const mcpServerPath = path.join(__dirname, "mcp-server.cjs");
521
559
  if (!fs.existsSync(mcpServerPath)) {
@@ -553,6 +591,7 @@ async function main() {
553
591
  logout Remove saved credentials
554
592
  status Show current auth status
555
593
  install-mcp Install the iframer MCP into Claude Code
594
+ proxy <start|stop|status> Control the home proxy (routes browser through your IP)
556
595
 
557
596
  Credentials:
558
597
  credentials add <domain> Store login credentials (encrypted, server-side)
package/mcp-server.cjs CHANGED
@@ -28541,9 +28541,10 @@ async function startTunnel(apiBaseUrl, authToken) {
28541
28541
  } catch {}
28542
28542
  };
28543
28543
  ws.onerror = (err) => fail(`WebSocket error: ${err?.message ?? "unknown"}`);
28544
- ws.onclose = () => {
28544
+ ws.onclose = (event) => {
28545
28545
  sockets.forEach((s) => s.destroy());
28546
28546
  sockets.clear();
28547
+ fail(`Tunnel closed by server (code=${event?.code ?? "?"}, reason=${event?.reason ?? "unknown"})`);
28547
28548
  };
28548
28549
  setTimeout(() => fail("Tunnel setup timed out (10s)"), 1e4);
28549
28550
  });
@@ -28605,9 +28606,9 @@ WORKFLOW:
28605
28606
 
28606
28607
  TIMEOUTS: Each step has a 20-second stale-state timeout. If nothing changes for 20s, iframer aborts with a detailed error.
28607
28608
 
28608
- CREDENTIALS: Use "credentials" action=store to save login details encrypted server-side.
28609
+ CREDENTIALS: NEVER ask the user for passwords or credentials in the chat. Always use "credentials" action=store it opens a secure prompt so the user types credentials directly into the terminal. You never see them. Then use a login step in "execute".
28609
28610
 
28610
- HOME PROXY: If the site is showing captchas or bot detection, use "proxy action=start" to route the browser through the user's own home network IP. This runs a SOCKS5 proxy on the user's Mac so all browser traffic exits from their real IP address. Use "proxy action=stop" to go back to the default proxy. Always try this before attempting to solve captchas manually.` : `iframer — browser access for AI agents when normal methods fail.
28611
+ BOT DETECTION / CAPTCHA RULE: If a captcha appears, try solve-captcha first. If it fails or keeps reappearing, immediately call "proxy action=start" do NOT ask the user to solve it manually. The proxy restarts the session automatically; then retry the full flow from scratch. Only report failure if the captcha persists after the proxy is active.` : `iframer — browser access for AI agents when normal methods fail.
28611
28612
 
28612
28613
  PHILOSOPHY: You are a capable agent. Do your work locally first. Only call iframer when you hit a wall: captcha, login-gated content, heavy bot detection, or content that requires a real browser to render. iframer is a swiss knife you pull out for hard problems, not your default browsing tool.
28613
28614
 
@@ -28627,9 +28628,9 @@ WORKFLOW:
28627
28628
 
28628
28629
  TIMEOUTS: Each step has a 20-second stale-state timeout. If nothing changes on the page for 20s, iframer aborts and returns a detailed error. Retry, adjust your approach, or tell the user why it failed.
28629
28630
 
28630
- CREDENTIALS: Use "credentials" action=store to prompt the user for login details. They're encrypted server-side you never see them. Then use a login step in "execute".
28631
+ CREDENTIALS: NEVER ask the user for passwords or credentials in the chat. Always use "credentials" action=store it opens a secure prompt so the user types credentials directly into the terminal. You never see them. Then use a login step in "execute".
28631
28632
 
28632
- HOME PROXY: If the site is showing captchas or bot detection, use "proxy action=start" to route the browser through the user's own home network IP. This runs a SOCKS5 proxy on the user's Mac so all browser traffic exits from their real IP address. Use "proxy action=stop" to go back to the default proxy. Always try this before attempting to solve captchas manually.`;
28633
+ BOT DETECTION / CAPTCHA RULE: If a captcha appears, try solve-captcha first. If it fails or keeps reappearing, immediately call "proxy action=start" do NOT ask the user to solve it manually. The proxy restarts the session automatically; then retry the full flow from scratch. Only report failure if the captcha persists after the proxy is active.`;
28633
28634
  var server = new McpServer({ name: "iframer", version: "2.0.0" }, { instructions: INSTRUCTIONS });
28634
28635
  server.tool("status", `Get the full state of iframer in one call. Call this first. Returns: API health, auth status, active session, stored credentials.`, {}, async () => {
28635
28636
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iframer-cli",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "CLI for iframer — browser access for AI agents",
5
5
  "bin": {
6
6
  "iframer": "./cli.js"