crawlio-browser 1.4.0 → 1.4.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.
@@ -1,7 +1,7 @@
1
1
  // src/shared/constants.ts
2
2
  import { homedir } from "os";
3
3
  import { join } from "path";
4
- var PKG_VERSION = "1.4.0";
4
+ var PKG_VERSION = "1.4.1";
5
5
  var WS_PORT = 9333;
6
6
  var WS_HOST = "127.0.0.1";
7
7
  var CRAWLIO_PORT_FILE = join(
@@ -7,7 +7,7 @@ import {
7
7
  WS_PORT,
8
8
  WS_RECONNECT_GRACE,
9
9
  WS_STALE_THRESHOLD
10
- } from "./chunk-JRZS5IP6.js";
10
+ } from "./chunk-DUJTVASE.js";
11
11
 
12
12
  // src/mcp-server/index.ts
13
13
  import { randomBytes as randomBytes2 } from "crypto";
@@ -4025,7 +4025,7 @@ function createCodeModeTools(bridge2, crawlio2) {
4025
4025
  // src/mcp-server/index.ts
4026
4026
  var initMode = process.argv.includes("init") || process.argv.includes("--setup") || process.argv.includes("setup");
4027
4027
  if (initMode) {
4028
- const { runInit } = await import("./init-4ITWQXXA.js");
4028
+ const { runInit } = await import("./init-EJMNI6KH.js");
4029
4029
  await runInit(process.argv.slice(2));
4030
4030
  process.exit(0);
4031
4031
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PKG_VERSION
3
- } from "./chunk-JRZS5IP6.js";
3
+ } from "./chunk-DUJTVASE.js";
4
4
 
5
5
  // src/mcp-server/init.ts
6
6
  import { execFileSync, spawn } from "child_process";
@@ -60,12 +60,13 @@ function parseFlags(argv) {
60
60
  }
61
61
  function buildAddMcpArgs(options) {
62
62
  const args = ["-y", "add-mcp"];
63
+ const pkg = `crawlio-browser@${PKG_VERSION}`;
63
64
  if (options.portal) {
64
65
  args.push(MCP_URL);
65
66
  } else if (options.full) {
66
- args.push("crawlio-browser --full");
67
+ args.push(`${pkg} --full`);
67
68
  } else {
68
- args.push("crawlio-browser");
69
+ args.push(pkg);
69
70
  }
70
71
  args.push("--name", "crawlio-browser", "--global", "--yes");
71
72
  for (const agent of options.agents) {
@@ -74,7 +75,7 @@ function buildAddMcpArgs(options) {
74
75
  return args;
75
76
  }
76
77
  function buildStdioEntry(options) {
77
- const args = ["-y", "crawlio-browser"];
78
+ const args = ["-y", `crawlio-browser@${PKG_VERSION}`];
78
79
  if (options?.full) args.push("--full");
79
80
  return { command: "npx", args };
80
81
  }
@@ -82,7 +83,15 @@ function buildPortalEntry() {
82
83
  return { type: "http", url: MCP_URL };
83
84
  }
84
85
  function isAlreadyConfigured(config) {
85
- return "crawlio-browser" in config.mcpServers;
86
+ if ("crawlio-browser" in config.mcpServers || "crawlio-agent" in config.mcpServers) return true;
87
+ for (const entry of Object.values(config.mcpServers)) {
88
+ const e = entry;
89
+ const args = e?.args;
90
+ if (args?.some((a) => typeof a === "string" && a.includes("crawlio-browser"))) return true;
91
+ const cmd = e?.command;
92
+ if (cmd?.includes("crawlio-browser")) return true;
93
+ }
94
+ return false;
86
95
  }
87
96
  function buildCloudflareEntry(accountId, apiToken) {
88
97
  return {
@@ -109,7 +118,9 @@ async function confirm(question, defaultYes = true) {
109
118
  function findMcpConfig() {
110
119
  const candidates = [
111
120
  join(process.cwd(), ".mcp.json"),
112
- join(HOME, ".mcp.json")
121
+ join(HOME, ".mcp.json"),
122
+ join(HOME, ".claude", "mcp.json")
123
+ // Claude Code global config
113
124
  ];
114
125
  for (const p of candidates) {
115
126
  if (!existsSync(p)) continue;
@@ -124,6 +135,28 @@ function findMcpConfig() {
124
135
  }
125
136
  return null;
126
137
  }
138
+ function findConflictingConfigs() {
139
+ const locations = [
140
+ join(process.cwd(), ".mcp.json"),
141
+ join(HOME, ".mcp.json"),
142
+ join(HOME, ".claude", "mcp.json"),
143
+ // Claude Code project config (if different from cwd)
144
+ join(process.cwd(), ".claude", "mcp.json")
145
+ ];
146
+ const conflicts = [];
147
+ for (const p of locations) {
148
+ if (!existsSync(p)) continue;
149
+ try {
150
+ const raw = readFileSync(p, "utf-8");
151
+ const parsed = JSON.parse(raw);
152
+ if (parsed?.mcpServers && isAlreadyConfigured(parsed)) {
153
+ conflicts.push(p);
154
+ }
155
+ } catch {
156
+ }
157
+ }
158
+ return conflicts;
159
+ }
127
160
  async function healthCheck() {
128
161
  try {
129
162
  const res = await fetch(HEALTH_URL);
@@ -519,9 +552,27 @@ async function configureMetaMcp(found, options) {
519
552
  console.log("");
520
553
  console.log(` ${cyan("\u25C6")} ${bold("MCP Configuration")} ${dim("(.mcp.json)")}`);
521
554
  if (isAlreadyConfigured(found.config)) {
522
- console.log(` ${green("+")} crawlio-browser already configured \u2014 skipping`);
555
+ console.log(` ${green("+")} crawlio-browser already configured in ${dim(found.path)}`);
523
556
  return;
524
557
  }
558
+ const conflicts = findConflictingConfigs();
559
+ if (conflicts.length > 0) {
560
+ console.log(` ${yellow("!")} crawlio-browser already configured in:`);
561
+ for (const c of conflicts) {
562
+ console.log(` ${dim("\u2192")} ${c}`);
563
+ }
564
+ console.log(` ${yellow("!")} Adding a second entry would cause a port collision (port 9333)`);
565
+ if (!options.yes) {
566
+ const proceed = await confirm("Add anyway? (not recommended)", false);
567
+ if (!proceed) {
568
+ console.log(` ${dim("Skipped \u2014 using existing configuration")}`);
569
+ return;
570
+ }
571
+ } else {
572
+ console.log(` ${dim("Skipped \u2014 existing configuration takes priority")}`);
573
+ return;
574
+ }
575
+ }
525
576
  if (!options.yes) {
526
577
  const proceed = await confirm("Add crawlio-browser to this config?");
527
578
  if (!proceed) {
@@ -712,6 +763,7 @@ export {
712
763
  buildPortalEntry,
713
764
  buildStdioEntry,
714
765
  extractSkillName,
766
+ findConflictingConfigs,
715
767
  findMcpConfig,
716
768
  installBrowserSkill,
717
769
  isAlreadyConfigured,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crawlio-browser",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "MCP server with 96 CDP-backed tools for browser automation — screenshots, DOM, network capture, framework detection, cookies, storage, session recording, performance metrics via Chrome",
5
5
  "type": "module",
6
6
  "main": "dist/mcp-server/index.js",