browser-ipc-cdp 1.3.0 → 1.4.0

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/bin/cli.js +15 -3
  2. package/lib/mcp.js +5 -3
  3. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -152,16 +152,28 @@ async function main() {
152
152
 
153
153
  // Resumen
154
154
  console.log('');
155
+ // URL correcta segun entorno
156
+ const cdpLocalUrl = `http://127.0.0.1:${port}`;
157
+ const cdpWslUrl = `http://${wslIp}:${port}`;
158
+ const cdpUrl = (IS_WSL || wslIp !== '127.0.0.1') ? cdpWslUrl : cdpLocalUrl;
159
+
155
160
  console.log('='.repeat(55));
156
161
  console.log(` MODO: ${mode}${mode === 'ATTACHED' ? ' (sin reiniciar)' : ' (nuevo proceso)'}`);
162
+ console.log(` Plataforma: ${platform}`);
157
163
  console.log(` Navegador: ${browserVersion}`);
158
164
  console.log(` Puerto CDP: ${port} (dinamico via IPC)`);
159
165
  console.log(` Paginas: ${pages}`);
160
- console.log(` WSL IP: ${wslIp}`);
161
- console.log(` Portproxy: 0.0.0.0:${port} -> 127.0.0.1:${port}`);
162
- console.log(` .mcp.json: Actualizado`);
163
166
  console.log('='.repeat(55));
164
167
  console.log('');
168
+ console.log(' URLs de conexion:');
169
+ console.log(` Desde Windows: ${cdpLocalUrl}`);
170
+ if (wslIp !== '127.0.0.1') {
171
+ console.log(` Desde WSL: ${cdpWslUrl}`);
172
+ }
173
+ console.log('');
174
+ console.log(' MCP configurado en .mcp.json:');
175
+ console.log(` browserUrl: ${cdpUrl}`);
176
+ console.log('');
165
177
  console.log(' Siguiente paso en Claude Code:');
166
178
  console.log(' /mcp (para conectar el MCP brave)');
167
179
  console.log('');
package/lib/mcp.js CHANGED
@@ -6,10 +6,12 @@ const { log, success, warn } = require('./logger');
6
6
  function getWslHostIp() {
7
7
  const IS_WIN = process.platform === 'win32';
8
8
 
9
- // Mac/Linux: localhost funciona directo, no necesita IP especial
10
- if (!IS_WIN) return '127.0.0.1';
9
+ // Mac/Linux nativo (sin WSL): localhost directo
10
+ if (!IS_WIN && !fs.existsSync('/proc/version')) return '127.0.0.1';
11
11
 
12
- // Windows: detectar IP para WSL
12
+ // Windows o WSL: Claude Code SIEMPRE corre en WSL,
13
+ // asi que SIEMPRE necesitamos la IP del host Windows.
14
+ // No importa si el usuario ejecuta npx desde Windows o WSL.
13
15
 
14
16
  // 1. Desde WSL: leer resolv.conf directamente
15
17
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ipc-cdp",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Control remoto de navegadores Chromium (Brave, Chrome, Edge) via IPC + CDP dinamico. Un comando para conectar Claude Code a tu navegador real.",
5
5
  "bin": {
6
6
  "browser-ipc-cdp": "bin/cli.js"