@eddym06/custom-chrome-mcp 1.0.4 → 1.1.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.
- package/CONDITIONAL_DESCRIPTIONS.md +174 -0
- package/FUTURE_FEATURES.txt +1503 -0
- package/README.md +300 -3
- package/TEST_WORKFLOW.md +311 -0
- package/USAGE_GUIDE.md +393 -0
- package/demo_features.ts +115 -0
- package/dist/chrome-connector.d.ts +31 -4
- package/dist/chrome-connector.d.ts.map +1 -1
- package/dist/chrome-connector.js +402 -53
- package/dist/chrome-connector.js.map +1 -1
- package/dist/index.js +69 -12
- package/dist/index.js.map +1 -1
- package/dist/tests/execute-script-tests.d.ts +62 -0
- package/dist/tests/execute-script-tests.d.ts.map +1 -0
- package/dist/tests/execute-script-tests.js +280 -0
- package/dist/tests/execute-script-tests.js.map +1 -0
- package/dist/tests/run-execute-tests.d.ts +7 -0
- package/dist/tests/run-execute-tests.d.ts.map +1 -0
- package/dist/tests/run-execute-tests.js +88 -0
- package/dist/tests/run-execute-tests.js.map +1 -0
- package/dist/tools/advanced-network.backup.d.ts +245 -0
- package/dist/tools/advanced-network.backup.d.ts.map +1 -0
- package/dist/tools/advanced-network.backup.js +996 -0
- package/dist/tools/advanced-network.backup.js.map +1 -0
- package/dist/tools/advanced-network.d.ts +580 -0
- package/dist/tools/advanced-network.d.ts.map +1 -0
- package/dist/tools/advanced-network.js +1325 -0
- package/dist/tools/advanced-network.js.map +1 -0
- package/dist/tools/anti-detection.d.ts.map +1 -1
- package/dist/tools/anti-detection.js +13 -8
- package/dist/tools/anti-detection.js.map +1 -1
- package/dist/tools/capture.d.ts +15 -9
- package/dist/tools/capture.d.ts.map +1 -1
- package/dist/tools/capture.js +21 -12
- package/dist/tools/capture.js.map +1 -1
- package/dist/tools/interaction.d.ts +84 -10
- package/dist/tools/interaction.d.ts.map +1 -1
- package/dist/tools/interaction.js +88 -33
- package/dist/tools/interaction.js.map +1 -1
- package/dist/tools/navigation.d.ts.map +1 -1
- package/dist/tools/navigation.js +43 -21
- package/dist/tools/navigation.js.map +1 -1
- package/dist/tools/network-accessibility.d.ts +67 -0
- package/dist/tools/network-accessibility.d.ts.map +1 -0
- package/dist/tools/network-accessibility.js +367 -0
- package/dist/tools/network-accessibility.js.map +1 -0
- package/dist/tools/playwright-launcher.d.ts +1 -1
- package/dist/tools/playwright-launcher.js +6 -6
- package/dist/tools/playwright-launcher.js.map +1 -1
- package/dist/tools/service-worker.d.ts +2 -2
- package/dist/tools/service-worker.d.ts.map +1 -1
- package/dist/tools/service-worker.js +22 -12
- package/dist/tools/service-worker.js.map +1 -1
- package/dist/tools/session.d.ts.map +1 -1
- package/dist/tools/session.js +23 -14
- package/dist/tools/session.js.map +1 -1
- package/dist/tools/system.d.ts +2 -2
- package/dist/tools/system.d.ts.map +1 -1
- package/dist/tools/system.js +9 -5
- package/dist/tools/system.js.map +1 -1
- package/dist/utils/truncate.d.ts +29 -0
- package/dist/utils/truncate.d.ts.map +1 -0
- package/dist/utils/truncate.js +46 -0
- package/dist/utils/truncate.js.map +1 -0
- package/dist/verify-tools.d.ts +7 -0
- package/dist/verify-tools.d.ts.map +1 -0
- package/dist/verify-tools.js +137 -0
- package/dist/verify-tools.js.map +1 -0
- package/package.json +3 -3
- package/recordings/demo_recording.har +3036 -0
- package/.npmrc.example +0 -2
- package/test-playwright.js +0 -57
package/README.md
CHANGED
|
@@ -38,6 +38,14 @@ Add this to your `mcp.json` config file:
|
|
|
38
38
|
- Timezone y geolocalización configurable
|
|
39
39
|
- Scripts anti-detección automáticos
|
|
40
40
|
|
|
41
|
+
### ⏱️ Timeouts Inteligentes
|
|
42
|
+
- **Timeouts configurables por operación**: La IA decide el timeout según complejidad
|
|
43
|
+
- Defaults optimizados: 10-60 segundos según la herramienta
|
|
44
|
+
- Prevención de cuelgues en operaciones pesadas
|
|
45
|
+
- HAR exports: hasta 60s para archivos grandes
|
|
46
|
+
- Inyección CSS/JS: 10-15s para scripts complejos
|
|
47
|
+
- Parámetro `timeoutMs` en todas las herramientas críticas
|
|
48
|
+
|
|
41
49
|
### 🔒 Shadow Profile System
|
|
42
50
|
- **Bypasses Chrome's Default profile debugging restriction**
|
|
43
51
|
- Platform-specific cloning (robocopy on Windows, rsync on Unix)
|
|
@@ -139,7 +147,7 @@ Agrega en tu `mcp.json` o configuración de Cline/Claude:
|
|
|
139
147
|
|
|
140
148
|
### 3. ¡Empieza a usar!
|
|
141
149
|
|
|
142
|
-
El MCP se conectará automáticamente a tu Chrome y tendrás acceso a
|
|
150
|
+
El MCP se conectará automáticamente a tu Chrome y tendrás acceso a **84 herramientas** organizadas en **15 categorías**.
|
|
143
151
|
|
|
144
152
|
## 🛠️ Herramientas Disponibles
|
|
145
153
|
|
|
@@ -181,12 +189,55 @@ El MCP se conectará automáticamente a tu Chrome y tendrás acceso a 44 herrami
|
|
|
181
189
|
- `skip_waiting` - Skip waiting
|
|
182
190
|
- `get_sw_caches` - Obtener cachés
|
|
183
191
|
|
|
184
|
-
### Captura (
|
|
192
|
+
### Captura (7 herramientas)
|
|
185
193
|
- `screenshot` - Captura de pantalla
|
|
186
194
|
- `get_html` - Obtener HTML
|
|
187
195
|
- `print_to_pdf` - Exportar a PDF
|
|
188
196
|
- `get_page_metrics` - Métricas de página
|
|
189
|
-
- `get_accessibility_tree` - Árbol a11y
|
|
197
|
+
- `get_accessibility_tree` - Árbol a11y completo
|
|
198
|
+
- `get_accessibility_snapshot` - Snapshot Playwright-style
|
|
199
|
+
|
|
200
|
+
### Network Interception (8 herramientas)
|
|
201
|
+
- `enable_network_interception` - Activar interceptación de requests
|
|
202
|
+
- `list_intercepted_requests` - Listar requests interceptados
|
|
203
|
+
- `modify_intercepted_request` - Modificar request (headers, URL, body)
|
|
204
|
+
- `fail_intercepted_request` - Bloquear request (ads, tracking)
|
|
205
|
+
- `continue_intercepted_request` - Continuar sin modificar
|
|
206
|
+
- `disable_network_interception` - Desactivar interceptación
|
|
207
|
+
|
|
208
|
+
### Network Response Interception (4 herramientas)
|
|
209
|
+
- `enable_response_interception` - Activar interceptación de respuestas
|
|
210
|
+
- `list_intercepted_responses` - Listar respuestas interceptadas
|
|
211
|
+
- `modify_intercepted_response` - Modificar respuesta (body, headers, status)
|
|
212
|
+
- `disable_response_interception` - Desactivar interceptación
|
|
213
|
+
|
|
214
|
+
### Request/Response Mocking (4 herramientas)
|
|
215
|
+
- `create_mock_endpoint` - Crear endpoint falso (mock API responses)
|
|
216
|
+
- `list_mock_endpoints` - Listar mocks activos
|
|
217
|
+
- `delete_mock_endpoint` - Eliminar mock específico
|
|
218
|
+
- `clear_all_mocks` - Limpiar todos los mocks
|
|
219
|
+
|
|
220
|
+
### WebSocket Interception (5 herramientas)
|
|
221
|
+
- `enable_websocket_interception` - Activar interceptación de WebSockets
|
|
222
|
+
- `list_websocket_connections` - Listar conexiones WS activas
|
|
223
|
+
- `list_websocket_messages` - Ver mensajes WS (sent/received)
|
|
224
|
+
- `send_websocket_message` - Inyectar mensaje en WebSocket
|
|
225
|
+
- `disable_websocket_interception` - Desactivar interceptación WS
|
|
226
|
+
|
|
227
|
+
### HAR Recording & Replay (3 herramientas)
|
|
228
|
+
- `start_har_recording` - Iniciar grabación HAR (HTTP Archive)
|
|
229
|
+
- `stop_har_recording` - Detener y obtener HAR data
|
|
230
|
+
- `export_har_file` - Exportar HAR a archivo .har
|
|
231
|
+
|
|
232
|
+
### Advanced Request Patterns (1 herramienta)
|
|
233
|
+
- `add_advanced_interception_pattern` - Patrón avanzado (status code, size, duration, content-type, action)
|
|
234
|
+
|
|
235
|
+
### CSS/JS Injection Pipeline (5 herramientas)
|
|
236
|
+
- `inject_css_global` - Inyectar CSS en todas las páginas
|
|
237
|
+
- `inject_js_global` - Inyectar JavaScript en todas las páginas
|
|
238
|
+
- `list_injected_scripts` - Listar inyecciones activas
|
|
239
|
+
- `remove_injection` - Remover inyección específica
|
|
240
|
+
- `clear_all_injections` - Limpiar todas las inyecciones
|
|
190
241
|
|
|
191
242
|
### Sesiones & Cookies (9 herramientas)
|
|
192
243
|
- `get_cookies` - Obtener cookies
|
|
@@ -249,6 +300,246 @@ await mcp.call('import_session', { sessionData });
|
|
|
249
300
|
```typescript
|
|
250
301
|
// Listar todos los service workers
|
|
251
302
|
const workers = await mcp.call('list_service_workers', {});
|
|
303
|
+
console.log(workers);
|
|
304
|
+
|
|
305
|
+
// Actualizar un service worker
|
|
306
|
+
await mcp.call('update_service_worker', {
|
|
307
|
+
scopeURL: 'https://example.com/'
|
|
308
|
+
});
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Ejemplo 5: Interceptar y modificar requests
|
|
312
|
+
```typescript
|
|
313
|
+
// Activar interceptación para archivos JS y CSS
|
|
314
|
+
await mcp.call('enable_network_interception', {
|
|
315
|
+
patterns: ['*.js', '*.css', '*analytics*']
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// Listar requests interceptados
|
|
319
|
+
const intercepted = await mcp.call('list_intercepted_requests', {});
|
|
320
|
+
console.log('Intercepted:', intercepted.interceptedRequests);
|
|
321
|
+
|
|
322
|
+
// Bloquear un request de analytics
|
|
323
|
+
await mcp.call('fail_intercepted_request', {
|
|
324
|
+
requestId: 'some-request-id',
|
|
325
|
+
errorReason: 'BlockedByClient'
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// Modificar headers de un request
|
|
329
|
+
await mcp.call('modify_intercepted_request', {
|
|
330
|
+
requestId: 'another-request-id',
|
|
331
|
+
modifiedHeaders: {
|
|
332
|
+
'User-Agent': 'Custom Agent',
|
|
333
|
+
'X-Custom-Header': 'Value'
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// Desactivar cuando termines
|
|
338
|
+
await mcp.call('disable_network_interception', {});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Ejemplo 6: Obtener árbol de accesibilidad
|
|
342
|
+
```typescript
|
|
343
|
+
// Obtener snapshot estilo Playwright (fácil de leer)
|
|
344
|
+
const snapshot = await mcp.call('get_accessibility_snapshot', {
|
|
345
|
+
interestingOnly: true // Solo botones, links, inputs, etc.
|
|
346
|
+
});
|
|
347
|
+
console.log(snapshot.snapshot);
|
|
348
|
+
|
|
349
|
+
// Obtener árbol completo (más detallado)
|
|
350
|
+
const fullTree = await mcp.call('get_accessibility_tree', {
|
|
351
|
+
depth: 5, // Profundidad máxima
|
|
352
|
+
includeIgnored: false
|
|
353
|
+
});
|
|
354
|
+
console.log(`Total nodes: ${fullTree.totalNodes}`);
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Ejemplo 7: Interceptar y modificar respuestas
|
|
358
|
+
```typescript
|
|
359
|
+
// Activar interceptación de RESPUESTAS (no solo requests)
|
|
360
|
+
// timeoutMs: La IA puede aumentarlo si espera muchas requests
|
|
361
|
+
await mcp.call('enable_response_interception', {
|
|
362
|
+
patterns: ['*api.example.com/*'],
|
|
363
|
+
resourceTypes: ['XHR', 'Fetch'],
|
|
364
|
+
timeoutMs: 15000 // 15s para APIs lentas
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// Esperar a que se intercepte una respuesta
|
|
368
|
+
const responses = await mcp.call('list_intercepted_responses', {});
|
|
369
|
+
console.log('Intercepted responses:', responses.interceptedResponses);
|
|
370
|
+
|
|
371
|
+
// Modificar el body de una respuesta JSON
|
|
372
|
+
await mcp.call('modify_intercepted_response', {
|
|
373
|
+
requestId: 'response-id',
|
|
374
|
+
modifiedBody: JSON.stringify({ modified: true, data: [1, 2, 3] }),
|
|
375
|
+
modifiedStatusCode: 200,
|
|
376
|
+
modifiedHeaders: {
|
|
377
|
+
'Content-Type': 'application/json',
|
|
378
|
+
'X-Modified': 'true'
|
|
379
|
+
},
|
|
380
|
+
timeoutMs: 20000 // 20s para respuestas grandes
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Ejemplo 8: Mock API endpoints
|
|
385
|
+
```typescript
|
|
386
|
+
// Crear un mock endpoint para API
|
|
387
|
+
// timeoutMs: Para endpoints complejos con lógica pesada
|
|
388
|
+
await mcp.call('create_mock_endpoint', {
|
|
389
|
+
urlPattern: '*api.example.com/users*',
|
|
390
|
+
responseBody: JSON.stringify([
|
|
391
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com' },
|
|
392
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' }
|
|
393
|
+
]),
|
|
394
|
+
statusCode: 200,
|
|
395
|
+
headers: {
|
|
396
|
+
'Content-Type': 'application/json',
|
|
397
|
+
'X-Mock': 'true'
|
|
398
|
+
},
|
|
399
|
+
latency: 500, // Simular 500ms de latencia
|
|
400
|
+
method: 'GET',
|
|
401
|
+
timeoutMs: 12000 // 12s para registrar el mock
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
// Navegar y la API será interceptada automáticamente
|
|
405
|
+
await mcp.call('navigate', { url: 'https://example.com' });
|
|
406
|
+
|
|
407
|
+
// Ver estadísticas de mocks
|
|
408
|
+
const mocks = await mcp.call('list_mock_endpoints', {});
|
|
409
|
+
console.log('Active mocks:', mocks.mocks);
|
|
410
|
+
|
|
411
|
+
// Limpiar cuando termines
|
|
412
|
+
await mcp.call('clear_all_mocks', {});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Ejemplo 9: WebSocket interception
|
|
416
|
+
```typescript
|
|
417
|
+
// Activar interceptación de WebSockets
|
|
418
|
+
await mcp.call('enable_websocket_interception', {
|
|
419
|
+
urlPattern: 'wss://example.com/socket'
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// Listar conexiones WebSocket activas
|
|
423
|
+
const connections = await mcp.call('list_websocket_connections', {});
|
|
424
|
+
console.log('Active WebSockets:', connections.connections);
|
|
425
|
+
|
|
426
|
+
// Ver mensajes enviados y recibidos
|
|
427
|
+
const messages = await mcp.call('list_websocket_messages', {
|
|
428
|
+
direction: 'all',
|
|
429
|
+
limit: 50
|
|
430
|
+
});
|
|
431
|
+
console.log('WS Messages:', messages.messages);
|
|
432
|
+
|
|
433
|
+
// Inyectar un mensaje falso
|
|
434
|
+
await mcp.call('send_websocket_message', {
|
|
435
|
+
requestId: 'ws-connection-id',
|
|
436
|
+
message: JSON.stringify({ type: 'ping', timestamp: Date.now() })
|
|
437
|
+
});
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Ejemplo 10: HAR recording
|
|
441
|
+
```typescript
|
|
442
|
+
// Iniciar grabación de tráfico de red en formato HAR
|
|
443
|
+
await mcp.call('start_har_recording', {});
|
|
444
|
+
|
|
445
|
+
// Navegar y realizar acciones
|
|
446
|
+
await mcp.call('navigate', { url: 'https://example.com' });
|
|
447
|
+
await mcp.call('click', { selector: 'button.load-data' });
|
|
448
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
449
|
+
|
|
450
|
+
// Detener y obtener HAR data
|
|
451
|
+
const harData = await mcp.call('stop_har_recording', {});
|
|
452
|
+
console.log(`Captured ${harData.entriesCount} requests`);
|
|
453
|
+
|
|
454
|
+
// Exportar a archivo
|
|
455
|
+
// timeoutMs: Importante aumentarlo si el HAR es muy grande (>50MB)
|
|
456
|
+
await mcp.call('export_har_file', {
|
|
457
|
+
filename: 'recording.har',
|
|
458
|
+
outputDir: './recordings',
|
|
459
|
+
timeoutMs: 90000 // 90s para exportar HARs muy grandes
|
|
460
|
+
});
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Ejemplo 11: Advanced request patterns
|
|
464
|
+
```typescript
|
|
465
|
+
// Crear patrón avanzado: bloquear imágenes grandes
|
|
466
|
+
await mcp.call('add_advanced_interception_pattern', {
|
|
467
|
+
name: 'block-large-images',
|
|
468
|
+
resourceType: 'Image',
|
|
469
|
+
minSize: 500000, // > 500KB
|
|
470
|
+
action: 'block'
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// Crear patrón: delay requests lentos
|
|
474
|
+
await mcp.call('add_advanced_interception_pattern', {
|
|
475
|
+
name: 'delay-slow-apis',
|
|
476
|
+
urlPattern: '*slow-api.com/*',
|
|
477
|
+
statusCodeMin: 200,
|
|
478
|
+
statusCodeMax: 299,
|
|
479
|
+
action: 'delay',
|
|
480
|
+
delayMs: 2000
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// Patrón: log requests específicos
|
|
484
|
+
await mcp.call('add_advanced_interception_pattern', {
|
|
485
|
+
name: 'log-analytics',
|
|
486
|
+
urlPattern: '*analytics*',
|
|
487
|
+
method: 'POST',
|
|
488
|
+
action: 'log'
|
|
489
|
+
});
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Ejemplo 12: CSS/JS injection pipeline
|
|
493
|
+
```typescript
|
|
494
|
+
// Inyectar CSS globalmente (se aplica a TODAS las páginas)
|
|
495
|
+
// timeoutMs: Aumentar si el CSS es muy grande o complejo
|
|
496
|
+
await mcp.call('inject_css_global', {
|
|
497
|
+
css: `
|
|
498
|
+
body {
|
|
499
|
+
background-color: #f0f0f0 !important;
|
|
500
|
+
}
|
|
501
|
+
.ad-banner {
|
|
502
|
+
display: none !important;
|
|
503
|
+
}
|
|
504
|
+
`,
|
|
505
|
+
name: 'dark-mode-and-no-ads',
|
|
506
|
+
timeoutMs: 8000 // 8s para CSS pequeño
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
// Inyectar JavaScript que se ejecuta ANTES de cualquier script de la página
|
|
510
|
+
// timeoutMs: Critical para JS complejos con validación de sintaxis
|
|
511
|
+
await mcp.call('inject_js_global', {
|
|
512
|
+
javascript: `
|
|
513
|
+
// Interceptar fetch para logging
|
|
514
|
+
const originalFetch = window.fetch;
|
|
515
|
+
window.fetch = function(...args) {
|
|
516
|
+
console.log('Fetch intercepted:', args[0]);
|
|
517
|
+
return originalFetch.apply(this, args);
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// Agregar funciones helper globales
|
|
521
|
+
window.myCustomHelper = function() {
|
|
522
|
+
console.log('Helper function available globally!');
|
|
523
|
+
};
|
|
524
|
+
`,
|
|
525
|
+
name: 'fetch-interceptor',
|
|
526
|
+
runImmediately: true,
|
|
527
|
+
timeoutMs: 18000 // 18s para JS complejo con validación
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
// Listar inyecciones activas
|
|
531
|
+
const injections = await mcp.call('list_injected_scripts', {});
|
|
532
|
+
console.log('Active injections:', injections.injections);
|
|
533
|
+
|
|
534
|
+
// Remover una inyección específica
|
|
535
|
+
await mcp.call('remove_injection', {
|
|
536
|
+
identifier: 'injection-id-here'
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// O limpiar todas
|
|
540
|
+
await mcp.call('clear_all_injections', {});
|
|
541
|
+
```
|
|
542
|
+
const workers = await mcp.call('list_service_workers', {});
|
|
252
543
|
console.log(workers.workers);
|
|
253
544
|
|
|
254
545
|
// Actualizar un service worker específico
|
|
@@ -286,9 +577,15 @@ Puedes configurar:
|
|
|
286
577
|
| Anti-detección | ✅ | ❌ | ⚠️ |
|
|
287
578
|
| Service Workers | ✅ | ⚠️ | ⚠️ |
|
|
288
579
|
| Exportar/importar sesiones | ✅ | ❌ | ❌ |
|
|
580
|
+
| Response Interception | ✅ | ❌ | ⚠️ |
|
|
581
|
+
| API Mocking | ✅ | ❌ | ⚠️ |
|
|
582
|
+
| WebSocket Interception | ✅ | ❌ | ❌ |
|
|
583
|
+
| HAR Recording | ✅ | ❌ | ⚠️ |
|
|
584
|
+
| CSS/JS Injection | ✅ | ❌ | ⚠️ |
|
|
289
585
|
| Delays human-like | ✅ | ❌ | ⚠️ |
|
|
290
586
|
| Multi-tab | ✅ | ✅ | ✅ |
|
|
291
587
|
| Screenshots | ✅ | ✅ | ✅ |
|
|
588
|
+
| Total herramientas | **84** | ~20 | ~30 |
|
|
292
589
|
|
|
293
590
|
## 🐛 Troubleshooting
|
|
294
591
|
|
package/TEST_WORKFLOW.md
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# Test Workflow - Verificación de Herramientas MCP
|
|
2
|
+
|
|
3
|
+
## 🎯 Escenario de Prueba del Usuario
|
|
4
|
+
|
|
5
|
+
**Prompt Original**:
|
|
6
|
+
> "Navega a apple.com, luego presiona un botón e intercepta el tráfico de red, y que manda ese paquete, luego vuelve a la página inicial, y ejecuta el paquete que interceptaste y mandaselo a la página ver que hace"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## ✅ Secuencia CORRECTA Esperada
|
|
11
|
+
|
|
12
|
+
### Paso 1: Navegación
|
|
13
|
+
```
|
|
14
|
+
Tool: navigate
|
|
15
|
+
Input: { url: "https://apple.com" }
|
|
16
|
+
Reason: Usuario dice "navega a" - debe usar navigate, NO create_tab
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**❌ INCORRECTO**: `create_tab({ url: "https://apple.com" })`
|
|
20
|
+
**✅ CORRECTO**: `navigate({ url: "https://apple.com" })`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
### Paso 2: Esperar Carga
|
|
25
|
+
```
|
|
26
|
+
Tool: wait_for_load_state
|
|
27
|
+
Input: { state: "networkidle" }
|
|
28
|
+
Reason: Asegurar que la página cargó completamente antes de analizar
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### Paso 3: Analizar Página (CRÍTICO)
|
|
34
|
+
```
|
|
35
|
+
Tool: get_html
|
|
36
|
+
Input: { tabId: "xxx" }
|
|
37
|
+
Reason: OBLIGATORIO antes de click - necesitamos ver qué botones existen
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**⚠️ CRÍTICO**: La IA DEBE hacer este paso. Si salta directo a click, está mal.
|
|
41
|
+
|
|
42
|
+
Ejemplo de salida esperada:
|
|
43
|
+
```html
|
|
44
|
+
<button class="ac-gn-link-bag">Shopping Bag</button>
|
|
45
|
+
<a href="/shop" class="ac-gn-link">Shop</a>
|
|
46
|
+
<button id="ac-gn-menustate" class="ac-gn-menustate">Menu</button>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### Paso 4: Habilitar Interceptación
|
|
52
|
+
```
|
|
53
|
+
Tool: enable_response_interception
|
|
54
|
+
Input: { patterns: ["*"], tabId: "xxx" }
|
|
55
|
+
Reason: Usuario dice "intercepta el tráfico de red"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Paso 5: Click en Botón
|
|
61
|
+
```
|
|
62
|
+
Tool: click
|
|
63
|
+
Input: {
|
|
64
|
+
selector: ".ac-gn-link-bag", // Selector verificado del paso 3
|
|
65
|
+
tabId: "xxx"
|
|
66
|
+
}
|
|
67
|
+
Reason: Usuario dice "presiona un botón"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**❌ INCORRECTO**: click con selector adivinado sin get_html primero
|
|
71
|
+
**✅ CORRECTO**: click con selector verificado de get_html
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### Paso 6: Listar Tráfico Interceptado
|
|
76
|
+
```
|
|
77
|
+
Tool: list_intercepted_responses
|
|
78
|
+
Input: { tabId: "xxx" }
|
|
79
|
+
Reason: Usuario dice "que manda ese paquete" - necesitamos ver qué se capturó
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Salida esperada**:
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"interceptedResponses": [
|
|
86
|
+
{
|
|
87
|
+
"requestId": "ABC123.1",
|
|
88
|
+
"url": "https://www.apple.com/shop/api/cart",
|
|
89
|
+
"method": "GET",
|
|
90
|
+
"responseStatusCode": 200
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"requestId": "ABC123.2",
|
|
94
|
+
"url": "https://www.apple.com/shop/api/products",
|
|
95
|
+
"method": "GET",
|
|
96
|
+
"responseStatusCode": 200
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"count": 2
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Paso 7: Volver a Página Inicial
|
|
106
|
+
```
|
|
107
|
+
Tool: go_back
|
|
108
|
+
Input: { tabId: "xxx" }
|
|
109
|
+
Reason: Usuario dice "vuelve a la página inicial"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Alternativa válida**: `navigate({ url: "https://apple.com" })`
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Paso 8: Modificar y Reenviar Paquete
|
|
117
|
+
```
|
|
118
|
+
Tool: modify_intercepted_response
|
|
119
|
+
Input: {
|
|
120
|
+
requestId: "ABC123.1", // De list_intercepted_responses
|
|
121
|
+
modifiedBody: '{"modified": "data"}',
|
|
122
|
+
tabId: "xxx"
|
|
123
|
+
}
|
|
124
|
+
Reason: Usuario dice "ejecuta el paquete que interceptaste y mandaselo a la página"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Alternativa**: Si quiere simplemente reenviar sin modificar, usar `continue_intercepted_request`
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 🔴 Errores Detectados en la Ejecución Real
|
|
132
|
+
|
|
133
|
+
### Error #1: Uso de create_tab en vez de navigate
|
|
134
|
+
```
|
|
135
|
+
❌ INCORRECTO:
|
|
136
|
+
create_tab({ url: "https://apple.com" })
|
|
137
|
+
|
|
138
|
+
✅ CORRECTO:
|
|
139
|
+
navigate({ url: "https://apple.com" })
|
|
140
|
+
|
|
141
|
+
Razón: Usuario dice "navega a", no "abre nueva pestaña"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Error #2: Click sin get_html previo
|
|
147
|
+
```
|
|
148
|
+
❌ INCORRECTO:
|
|
149
|
+
click({ selector: "a[href*='shop']" }) // Adivinando selector
|
|
150
|
+
|
|
151
|
+
✅ CORRECTO:
|
|
152
|
+
get_html() → Analizar HTML → click({ selector: ".verified-class" })
|
|
153
|
+
|
|
154
|
+
Razón: Workflow obligatorio: analizar ANTES de interactuar
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Error #3: IA dice que no encuentra list_intercepted_responses
|
|
160
|
+
```
|
|
161
|
+
Mensaje de error de la IA:
|
|
162
|
+
"Las herramientas disponibles no incluyen una función para listar las
|
|
163
|
+
solicitudes interceptadas"
|
|
164
|
+
|
|
165
|
+
REALIDAD: La herramienta SÍ existe!
|
|
166
|
+
|
|
167
|
+
Herramienta: list_intercepted_responses
|
|
168
|
+
Ubicación: src/tools/advanced-network.ts línea 155
|
|
169
|
+
Descripción: "📋 STEP 2 of interception workflow..."
|
|
170
|
+
|
|
171
|
+
Posibles causas:
|
|
172
|
+
1. IA no está leyendo bien las descripciones
|
|
173
|
+
2. IA busca nombre diferente ("list_intercepted_requests" vs "list_intercepted_responses")
|
|
174
|
+
3. Sistema de "activación" confuso (IA dice "necesito activar las herramientas")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### Error #4: IA intenta "activar" herramientas
|
|
180
|
+
```
|
|
181
|
+
Mensaje de IA:
|
|
182
|
+
"Necesito activar las herramientas de inspección de red"
|
|
183
|
+
|
|
184
|
+
PROBLEMA: No hay sistema de activación en el código!
|
|
185
|
+
Todas las herramientas están siempre disponibles.
|
|
186
|
+
|
|
187
|
+
Solución aplicada:
|
|
188
|
+
- Eliminadas referencias a "activación" en descripciones
|
|
189
|
+
- Todas las tools están en allTools[] desde el inicio
|
|
190
|
+
- No hay lazy loading ni activación
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 🧪 Cómo Probar Manualmente
|
|
196
|
+
|
|
197
|
+
### Test 1: Verificar que navigate funciona
|
|
198
|
+
```bash
|
|
199
|
+
# En VS Code, pedir a la IA:
|
|
200
|
+
"Usa el MCP custom-chrome para navegar a google.com"
|
|
201
|
+
|
|
202
|
+
# Verificar que usa:
|
|
203
|
+
✅ navigate({ url: "https://google.com" })
|
|
204
|
+
❌ create_tab({ url: "https://google.com" })
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### Test 2: Verificar workflow de análisis
|
|
210
|
+
```bash
|
|
211
|
+
# Pedir:
|
|
212
|
+
"Navega a example.com y haz click en el primer link"
|
|
213
|
+
|
|
214
|
+
# Secuencia esperada:
|
|
215
|
+
1. navigate
|
|
216
|
+
2. wait_for_load_state
|
|
217
|
+
3. get_html ← CRÍTICO: Debe estar aquí
|
|
218
|
+
4. click con selector del HTML
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### Test 3: Verificar interception workflow
|
|
224
|
+
```bash
|
|
225
|
+
# Pedir:
|
|
226
|
+
"Navega a httpbin.org/get e intercepta el tráfico"
|
|
227
|
+
|
|
228
|
+
# Secuencia esperada:
|
|
229
|
+
1. navigate({ url: "https://httpbin.org/get" })
|
|
230
|
+
2. enable_response_interception
|
|
231
|
+
3. wait_for_load_state
|
|
232
|
+
4. list_intercepted_responses ← DEBE aparecer!
|
|
233
|
+
|
|
234
|
+
# Si la IA dice "no encuentro la herramienta", HAY UN BUG
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### Test 4: Verificar que list_intercepted_responses existe
|
|
240
|
+
```bash
|
|
241
|
+
# Comando manual para verificar:
|
|
242
|
+
npm run build
|
|
243
|
+
node dist/index.js # Iniciar MCP server
|
|
244
|
+
|
|
245
|
+
# En el cliente MCP, listar tools y buscar:
|
|
246
|
+
- enable_response_interception ✓
|
|
247
|
+
- list_intercepted_responses ✓
|
|
248
|
+
- modify_intercepted_response ✓
|
|
249
|
+
- disable_response_interception ✓
|
|
250
|
+
|
|
251
|
+
# Todos deben aparecer!
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 📊 Checklist de Verificación
|
|
257
|
+
|
|
258
|
+
- [ ] navigate se usa para "navega a", NO create_tab
|
|
259
|
+
- [ ] get_html se ejecuta ANTES de click/type
|
|
260
|
+
- [ ] wait_for_load_state se ejecuta después de navigate
|
|
261
|
+
- [ ] enable_response_interception está disponible
|
|
262
|
+
- [ ] list_intercepted_responses está disponible (NO dice "necesito activar")
|
|
263
|
+
- [ ] modify_intercepted_response funciona con requestId válido
|
|
264
|
+
- [ ] Workflow completo funciona: navigate → analyze → interact → intercept
|
|
265
|
+
- [ ] IA no adivina selectores, los obtiene de get_html
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 🔧 Herramientas Actualizadas
|
|
270
|
+
|
|
271
|
+
### Descripciones Mejoradas:
|
|
272
|
+
|
|
273
|
+
1. **navigate**: Ahora indica claramente que es la PRIMARY NAVIGATION TOOL
|
|
274
|
+
2. **create_tab**: Ahora dice explícitamente "DO NOT USE for simple navigation"
|
|
275
|
+
3. **click**: Workflow obligatorio con get_html previo
|
|
276
|
+
4. **type**: Prerequisito de get_html
|
|
277
|
+
5. **enable_response_interception**: Workflow completo 1-2-3-4
|
|
278
|
+
6. **list_intercepted_responses**: Marcado como STEP 2 del workflow
|
|
279
|
+
7. **modify_intercepted_response**: Marcado como STEP 3 con ejemplo
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 💡 Próximos Pasos
|
|
284
|
+
|
|
285
|
+
Si los errores persisten:
|
|
286
|
+
|
|
287
|
+
1. **Verificar MCP Client**: El cliente que usa VS Code puede tener cache
|
|
288
|
+
2. **Reiniciar MCP Server**: Forzar reload del servidor
|
|
289
|
+
3. **Verificar package.json**: Asegurar que apunta a dist/index.js
|
|
290
|
+
4. **Logs del servidor**: Ver si las tools se registran correctamente
|
|
291
|
+
5. **Test con cliente MCP puro**: Eliminar VS Code de la ecuación
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 📝 Cambios Aplicados en Este Fix
|
|
296
|
+
|
|
297
|
+
| Archivo | Línea | Cambio |
|
|
298
|
+
|---------|-------|--------|
|
|
299
|
+
| navigation.ts | 13 | navigate: "PRIMARY NAVIGATION TOOL" con emojis |
|
|
300
|
+
| navigation.ts | 175 | create_tab: "DO NOT USE for simple navigation" |
|
|
301
|
+
| interaction.ts | 13 | click: "CRITICAL WORKFLOW: get_html FIRST" |
|
|
302
|
+
| interaction.ts | 71 | type: "PREREQUISITE: get_html FIRST" |
|
|
303
|
+
| capture.ts | 12 | screenshot: "WHEN TO USE" con casos |
|
|
304
|
+
| capture.ts | 70 | get_html: "CRITICAL ANALYSIS TOOL" obligatorio |
|
|
305
|
+
| advanced-network.ts | 56 | enable_response_interception: "START HERE" con workflow |
|
|
306
|
+
| advanced-network.ts | 156 | list_intercepted_responses: "STEP 2" con énfasis |
|
|
307
|
+
| advanced-network.ts | 213 | modify_intercepted_response: "STEP 3" con ejemplo |
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
**Resultado esperado**: La IA debe seguir el workflow correcto en todos los casos y NUNCA decir que no encuentra una herramienta que existe.
|