@eddym06/custom-chrome-mcp 1.0.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.
- package/.npmrc.example +2 -0
- package/CHANGELOG.md +87 -0
- package/INSTALL.md +148 -0
- package/LICENSE +21 -0
- package/README.md +403 -0
- package/dist/chrome-connector.d.ts +116 -0
- package/dist/chrome-connector.d.ts.map +1 -0
- package/dist/chrome-connector.js +452 -0
- package/dist/chrome-connector.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +211 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/anti-detection.d.ts +22 -0
- package/dist/tools/anti-detection.d.ts.map +1 -0
- package/dist/tools/anti-detection.js +220 -0
- package/dist/tools/anti-detection.js.map +1 -0
- package/dist/tools/capture.d.ts +130 -0
- package/dist/tools/capture.d.ts.map +1 -0
- package/dist/tools/capture.js +164 -0
- package/dist/tools/capture.js.map +1 -0
- package/dist/tools/interaction.d.ts +173 -0
- package/dist/tools/interaction.d.ts.map +1 -0
- package/dist/tools/interaction.js +274 -0
- package/dist/tools/interaction.js.map +1 -0
- package/dist/tools/navigation.d.ts +82 -0
- package/dist/tools/navigation.d.ts.map +1 -0
- package/dist/tools/navigation.js +196 -0
- package/dist/tools/navigation.js.map +1 -0
- package/dist/tools/playwright-launcher.d.ts +53 -0
- package/dist/tools/playwright-launcher.d.ts.map +1 -0
- package/dist/tools/playwright-launcher.js +117 -0
- package/dist/tools/playwright-launcher.js.map +1 -0
- package/dist/tools/service-worker.d.ts +128 -0
- package/dist/tools/service-worker.d.ts.map +1 -0
- package/dist/tools/service-worker.js +355 -0
- package/dist/tools/service-worker.js.map +1 -0
- package/dist/tools/session.d.ts +54 -0
- package/dist/tools/session.d.ts.map +1 -0
- package/dist/tools/session.js +311 -0
- package/dist/tools/session.js.map +1 -0
- package/dist/tools/system.d.ts +159 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +252 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/helpers.d.ts +53 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +122 -0
- package/dist/utils/helpers.js.map +1 -0
- package/mcp-config-example.json +12 -0
- package/package.json +61 -0
- package/test-playwright.js +57 -0
package/.npmrc.example
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2026-01-07
|
|
6
|
+
|
|
7
|
+
### ✨ Features
|
|
8
|
+
|
|
9
|
+
#### Core
|
|
10
|
+
- Initial release of Custom Chrome MCP
|
|
11
|
+
- Connect to existing Chrome instances via CDP (port 9222)
|
|
12
|
+
- Full MCP protocol implementation with 44 tools
|
|
13
|
+
|
|
14
|
+
#### Navigation & Tabs (8 tools)
|
|
15
|
+
- Navigate to URLs with wait conditions
|
|
16
|
+
- Browser history (back/forward)
|
|
17
|
+
- Page reload with cache options
|
|
18
|
+
- Multi-tab management (list, create, close, switch)
|
|
19
|
+
- Get current URL and page info
|
|
20
|
+
|
|
21
|
+
#### Interaction (8 tools)
|
|
22
|
+
- Click elements with human-like delays
|
|
23
|
+
- Type text with realistic timing
|
|
24
|
+
- Get text content and attributes
|
|
25
|
+
- Execute custom JavaScript
|
|
26
|
+
- Scroll pages and elements
|
|
27
|
+
- Wait for selectors with timeout
|
|
28
|
+
- Select options from dropdowns
|
|
29
|
+
|
|
30
|
+
#### Anti-Detection (5 tools)
|
|
31
|
+
- Stealth mode with navigator.webdriver masking
|
|
32
|
+
- Custom user agent configuration
|
|
33
|
+
- Viewport and device emulation
|
|
34
|
+
- Geolocation spoofing
|
|
35
|
+
- Timezone override
|
|
36
|
+
|
|
37
|
+
#### Service Workers (9 tools)
|
|
38
|
+
- List all registered service workers
|
|
39
|
+
- Get detailed worker information
|
|
40
|
+
- Unregister service workers
|
|
41
|
+
- Force update registrations
|
|
42
|
+
- Start/stop workers
|
|
43
|
+
- Inspect workers in DevTools
|
|
44
|
+
- Skip waiting phase
|
|
45
|
+
- Manage service worker caches
|
|
46
|
+
|
|
47
|
+
#### Capture & Export (5 tools)
|
|
48
|
+
- Screenshots (PNG/JPEG, full page, custom areas)
|
|
49
|
+
- Export to PDF
|
|
50
|
+
- Get HTML content
|
|
51
|
+
- Page layout metrics
|
|
52
|
+
- Accessibility tree export
|
|
53
|
+
|
|
54
|
+
#### Sessions & Cookies (9 tools)
|
|
55
|
+
- Cookie management (get, set, delete, clear)
|
|
56
|
+
- localStorage operations
|
|
57
|
+
- sessionStorage support
|
|
58
|
+
- Full session export/import
|
|
59
|
+
- Cross-session persistence
|
|
60
|
+
|
|
61
|
+
### 🛡️ Security
|
|
62
|
+
- Anti-detection measures
|
|
63
|
+
- Realistic browser fingerprinting
|
|
64
|
+
- Human-like interaction patterns
|
|
65
|
+
|
|
66
|
+
### 📚 Documentation
|
|
67
|
+
- Comprehensive README
|
|
68
|
+
- Usage examples
|
|
69
|
+
- Troubleshooting guide
|
|
70
|
+
- API documentation
|
|
71
|
+
|
|
72
|
+
### 🔧 Technical
|
|
73
|
+
- TypeScript implementation
|
|
74
|
+
- Zod schema validation
|
|
75
|
+
- Error handling
|
|
76
|
+
- Graceful shutdown
|
|
77
|
+
- Modular architecture
|
|
78
|
+
|
|
79
|
+
## [Unreleased]
|
|
80
|
+
|
|
81
|
+
### Planned Features
|
|
82
|
+
- Visual regression testing
|
|
83
|
+
- Network throttling
|
|
84
|
+
- Performance profiling
|
|
85
|
+
- Video recording
|
|
86
|
+
- Auto-recovery mechanisms
|
|
87
|
+
- Multi-profile support (future)
|
package/INSTALL.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# 🚀 Guía de Instalación Rápida
|
|
2
|
+
|
|
3
|
+
## Paso 1: Instalar Dependencias
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
cd custom-chrome-mcp
|
|
7
|
+
npm install
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Paso 2: Compilar el Proyecto
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm run build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Paso 3: Lanzar Chrome con Debugging
|
|
17
|
+
|
|
18
|
+
### Windows (PowerShell)
|
|
19
|
+
```powershell
|
|
20
|
+
start chrome --remote-debugging-port=9222
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Windows (CMD)
|
|
24
|
+
```cmd
|
|
25
|
+
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### macOS
|
|
29
|
+
```bash
|
|
30
|
+
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 &
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Linux
|
|
34
|
+
```bash
|
|
35
|
+
google-chrome --remote-debugging-port=9222 &
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Paso 4: Configurar en VS Code / Cline
|
|
39
|
+
|
|
40
|
+
Edita tu archivo de configuración MCP (usualmente en `.vscode/mcp.json` o en la configuración de Cline):
|
|
41
|
+
|
|
42
|
+
### Opción A: Desarrollo Local
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"custom-chrome-mcp": {
|
|
47
|
+
"command": "node",
|
|
48
|
+
"args": ["C:/Users/eddym/Downloads/devTools-Advance/custom-chrome-mcp/dist/index.js"],
|
|
49
|
+
"env": {}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Opción B: Después de publicar en npm
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"custom-chrome-mcp": {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["custom-chrome-mcp", "--port=9222"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Paso 5: Probar la Conexión
|
|
68
|
+
|
|
69
|
+
Una vez configurado, puedes probarlo desde VS Code / Cline:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
User: Lista las pestañas abiertas en Chrome
|
|
73
|
+
|
|
74
|
+
AI: [Usará la herramienta list_tabs]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Verificar que todo funciona
|
|
78
|
+
|
|
79
|
+
1. **Verificar puerto abierto:**
|
|
80
|
+
```powershell
|
|
81
|
+
netstat -an | findstr 9222
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Deberías ver algo como:
|
|
85
|
+
```
|
|
86
|
+
TCP 127.0.0.1:9222 0.0.0.0:0 LISTENING
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. **Probar en el navegador:**
|
|
90
|
+
Abre: http://localhost:9222/json
|
|
91
|
+
|
|
92
|
+
Deberías ver un JSON con las pestañas abiertas.
|
|
93
|
+
|
|
94
|
+
3. **Probar el MCP:**
|
|
95
|
+
```bash
|
|
96
|
+
npm start
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Deberías ver:
|
|
100
|
+
```
|
|
101
|
+
🚀 Custom Chrome MCP Server starting...
|
|
102
|
+
📡 Connecting to Chrome on port 9222
|
|
103
|
+
✅ Connected to Chrome/131.0.0.0 (...)
|
|
104
|
+
📑 Found X open tab(s)
|
|
105
|
+
🔧 Tools available: 44
|
|
106
|
+
✨ Server ready! Waiting for requests...
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Solución de Problemas
|
|
110
|
+
|
|
111
|
+
### Error: "Failed to connect to Chrome"
|
|
112
|
+
- Verifica que Chrome esté corriendo con `--remote-debugging-port=9222`
|
|
113
|
+
- Verifica que el puerto 9222 esté libre
|
|
114
|
+
- Cierra otras instancias de Chrome y vuelve a lanzar con el flag
|
|
115
|
+
|
|
116
|
+
### Error: "Cannot find module"
|
|
117
|
+
- Ejecuta `npm install` de nuevo
|
|
118
|
+
- Ejecuta `npm run build` para compilar
|
|
119
|
+
|
|
120
|
+
### Chrome se cierra al iniciar con el flag
|
|
121
|
+
- No uses perfiles con extensiones que bloqueen debugging
|
|
122
|
+
- Usa un perfil limpio: `--user-data-dir="C:\ChromeDebug"`
|
|
123
|
+
|
|
124
|
+
```powershell
|
|
125
|
+
start chrome --remote-debugging-port=9222 --user-data-dir="C:\ChromeDebug"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Próximos Pasos
|
|
129
|
+
|
|
130
|
+
- Lee el [README.md](README.md) completo para ver todas las herramientas disponibles
|
|
131
|
+
- Prueba el modo stealth: `enable_stealth_mode`
|
|
132
|
+
- Exporta/importa sesiones para reutilizar logins
|
|
133
|
+
- Gestiona Service Workers
|
|
134
|
+
|
|
135
|
+
## Publicar en npm (para el autor)
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Actualizar versión
|
|
139
|
+
npm version patch # o minor, o major
|
|
140
|
+
|
|
141
|
+
# Publicar
|
|
142
|
+
npm publish
|
|
143
|
+
|
|
144
|
+
# Ahora otros usuarios pueden instalar con:
|
|
145
|
+
npm install -g custom-chrome-mcp
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
¡Listo! Ya tienes tu MCP personalizado funcionando 🎉
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eddy M
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# Custom Chrome MCP 🚀
|
|
2
|
+
|
|
3
|
+
Cross-platform Model Context Protocol (MCP) server for advanced Chrome browser automation and control. Works on Windows, macOS, and Linux.
|
|
4
|
+
|
|
5
|
+
## 📦 Quick Install for VS Code
|
|
6
|
+
|
|
7
|
+
Add this to your `mcp.json` config file:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"custom-chrome-mcp": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@eddym06/custom-chrome-mcp", "--port=9222"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 🌍 Platform Support
|
|
21
|
+
|
|
22
|
+
- ✅ **Windows** - Full support with robocopy-based Shadow Profile
|
|
23
|
+
- ✅ **macOS** - Full support with rsync-based Shadow Profile
|
|
24
|
+
- ✅ **Linux** - Full support with rsync-based Shadow Profile
|
|
25
|
+
|
|
26
|
+
## ✨ Características Principales
|
|
27
|
+
|
|
28
|
+
### 🔌 Conexión a Chrome Existente
|
|
29
|
+
- **Conecta a tu Chrome ya abierto** con `--remote-debugging-port=9222`
|
|
30
|
+
- **Usa tus sesiones activas** (Google, Facebook, etc.)
|
|
31
|
+
- **Sin detección de automatización** porque usas tu navegador real
|
|
32
|
+
- **Mantén tus extensiones y configuración**
|
|
33
|
+
|
|
34
|
+
### 🛡️ Anti-Detección Avanzada
|
|
35
|
+
- Oculta `navigator.webdriver`
|
|
36
|
+
- Spoof de plugins y permisos
|
|
37
|
+
- User-Agent personalizable
|
|
38
|
+
- Timezone y geolocalización configurable
|
|
39
|
+
- Scripts anti-detección automáticos
|
|
40
|
+
|
|
41
|
+
### 🔒 Shadow Profile System
|
|
42
|
+
- **Bypasses Chrome's Default profile debugging restriction**
|
|
43
|
+
- Platform-specific cloning (robocopy on Windows, rsync on Unix)
|
|
44
|
+
- Automatic encryption key preservation
|
|
45
|
+
- Skips cache folders for fast copying
|
|
46
|
+
|
|
47
|
+
### ⚙️ Gestión Completa de Service Workers
|
|
48
|
+
- Listar todos los Service Workers registrados
|
|
49
|
+
- Inspeccionar, actualizar y desregistrar workers
|
|
50
|
+
- Iniciar/detener Service Workers
|
|
51
|
+
- Gestión de caché de Service Workers
|
|
52
|
+
- Skip waiting y control total
|
|
53
|
+
|
|
54
|
+
### 🍪 Gestión de Sesiones
|
|
55
|
+
- Exportar/importar sesiones completas
|
|
56
|
+
- Gestión de cookies (get, set, delete)
|
|
57
|
+
- localStorage y sessionStorage
|
|
58
|
+
- Persistencia de sesiones entre ejecuciones
|
|
59
|
+
|
|
60
|
+
### 📸 Captura Avanzada
|
|
61
|
+
- Screenshots (fullpage, áreas específicas)
|
|
62
|
+
- Exportar a PDF
|
|
63
|
+
- Obtener HTML completo
|
|
64
|
+
- Métricas de página
|
|
65
|
+
- Árbol de accesibilidad
|
|
66
|
+
|
|
67
|
+
### 🎯 Automatización Inteligente
|
|
68
|
+
- Delays human-like automáticos
|
|
69
|
+
- Wait for selectors
|
|
70
|
+
- Navegación completa (back, forward, reload)
|
|
71
|
+
- Multi-tab management
|
|
72
|
+
- Ejecución de JavaScript custom
|
|
73
|
+
|
|
74
|
+
## 📦 Instalación
|
|
75
|
+
|
|
76
|
+
### Desde GitHub Packages
|
|
77
|
+
|
|
78
|
+
1. Crea un archivo `.npmrc` en tu proyecto:
|
|
79
|
+
```bash
|
|
80
|
+
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
|
|
81
|
+
@eddym06:registry=https://npm.pkg.github.com
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. Instala el paquete:
|
|
85
|
+
```bash
|
|
86
|
+
npm install @eddym06/custom-chrome-mcp
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Desde el código fuente
|
|
90
|
+
```bash
|
|
91
|
+
git clone https://github.com/Eddym06/devTools-Advance-mcp.git
|
|
92
|
+
cd custom-chrome-mcp
|
|
93
|
+
npm install
|
|
94
|
+
npm run build
|
|
95
|
+
```
|
|
96
|
+
npm install -g custom-chrome-mcp
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Desarrollo local
|
|
100
|
+
```bash
|
|
101
|
+
cd custom-chrome-mcp
|
|
102
|
+
npm install
|
|
103
|
+
npm run build
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 🚀 Uso Rápido
|
|
107
|
+
|
|
108
|
+
### 1. Lanza Chrome con debugging habilitado
|
|
109
|
+
|
|
110
|
+
**Windows:**
|
|
111
|
+
```powershell
|
|
112
|
+
start chrome --remote-debugging-port=9222
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**macOS:**
|
|
116
|
+
```bash
|
|
117
|
+
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 &
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Linux:**
|
|
121
|
+
```bash
|
|
122
|
+
google-chrome --remote-debugging-port=9222 &
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 2. Configura el MCP en VS Code
|
|
126
|
+
|
|
127
|
+
Agrega en tu `mcp.json` o configuración de Cline/Claude:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"mcpServers": {
|
|
132
|
+
"custom-chrome-mcp": {
|
|
133
|
+
"command": "npx",
|
|
134
|
+
"args": ["custom-chrome-mcp", "--port=9222"]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 3. ¡Empieza a usar!
|
|
141
|
+
|
|
142
|
+
El MCP se conectará automáticamente a tu Chrome y tendrás acceso a 44 herramientas organizadas en 6 categorías.
|
|
143
|
+
|
|
144
|
+
## 🛠️ Herramientas Disponibles
|
|
145
|
+
|
|
146
|
+
### Navegación & Tabs (8 herramientas)
|
|
147
|
+
- `navigate` - Navegar a URL
|
|
148
|
+
- `go_back` / `go_forward` - Historial
|
|
149
|
+
- `reload` - Recargar página
|
|
150
|
+
- `list_tabs` - Listar pestañas
|
|
151
|
+
- `create_tab` - Crear pestaña
|
|
152
|
+
- `close_tab` - Cerrar pestaña
|
|
153
|
+
- `switch_tab` - Cambiar de pestaña
|
|
154
|
+
- `get_url` - Obtener URL actual
|
|
155
|
+
|
|
156
|
+
### Interacción con Página (8 herramientas)
|
|
157
|
+
- `click` - Hacer click en elemento
|
|
158
|
+
- `type` - Escribir texto
|
|
159
|
+
- `get_text` - Obtener texto
|
|
160
|
+
- `get_attribute` - Obtener atributo
|
|
161
|
+
- `execute_script` - Ejecutar JavaScript
|
|
162
|
+
- `scroll` - Hacer scroll
|
|
163
|
+
- `wait_for_selector` - Esperar elemento
|
|
164
|
+
- `select_option` - Seleccionar opción
|
|
165
|
+
|
|
166
|
+
### Anti-Detección (5 herramientas)
|
|
167
|
+
- `enable_stealth_mode` - Activar modo stealth
|
|
168
|
+
- `set_user_agent` - Cambiar user agent
|
|
169
|
+
- `set_viewport` - Configurar viewport
|
|
170
|
+
- `set_geolocation` - Configurar ubicación
|
|
171
|
+
- `set_timezone` - Configurar zona horaria
|
|
172
|
+
|
|
173
|
+
### Service Workers (9 herramientas)
|
|
174
|
+
- `list_service_workers` - Listar workers
|
|
175
|
+
- `get_service_worker` - Obtener detalles
|
|
176
|
+
- `unregister_service_worker` - Desregistrar
|
|
177
|
+
- `update_service_worker` - Actualizar
|
|
178
|
+
- `start_service_worker` - Iniciar
|
|
179
|
+
- `stop_service_worker` - Detener
|
|
180
|
+
- `inspect_service_worker` - Inspeccionar
|
|
181
|
+
- `skip_waiting` - Skip waiting
|
|
182
|
+
- `get_sw_caches` - Obtener cachés
|
|
183
|
+
|
|
184
|
+
### Captura (5 herramientas)
|
|
185
|
+
- `screenshot` - Captura de pantalla
|
|
186
|
+
- `get_html` - Obtener HTML
|
|
187
|
+
- `print_to_pdf` - Exportar a PDF
|
|
188
|
+
- `get_page_metrics` - Métricas de página
|
|
189
|
+
- `get_accessibility_tree` - Árbol a11y
|
|
190
|
+
|
|
191
|
+
### Sesiones & Cookies (9 herramientas)
|
|
192
|
+
- `get_cookies` - Obtener cookies
|
|
193
|
+
- `set_cookie` - Establecer cookie
|
|
194
|
+
- `delete_cookie` - Eliminar cookie
|
|
195
|
+
- `clear_cookies` - Limpiar cookies
|
|
196
|
+
- `get_local_storage` - Obtener localStorage
|
|
197
|
+
- `set_local_storage` - Establecer item
|
|
198
|
+
- `clear_local_storage` - Limpiar storage
|
|
199
|
+
- `export_session` - Exportar sesión
|
|
200
|
+
- `import_session` - Importar sesión
|
|
201
|
+
|
|
202
|
+
## 💡 Ejemplos de Uso
|
|
203
|
+
|
|
204
|
+
### Ejemplo 1: Navegar y hacer screenshot
|
|
205
|
+
```typescript
|
|
206
|
+
// Navegar a una URL
|
|
207
|
+
await mcp.call('navigate', { url: 'https://example.com' });
|
|
208
|
+
|
|
209
|
+
// Esperar que cargue un elemento
|
|
210
|
+
await mcp.call('wait_for_selector', { selector: '#content' });
|
|
211
|
+
|
|
212
|
+
// Tomar screenshot full page
|
|
213
|
+
await mcp.call('screenshot', { fullPage: true, format: 'png' });
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Ejemplo 2: Activar modo stealth y navegar
|
|
217
|
+
```typescript
|
|
218
|
+
// Activar modo stealth
|
|
219
|
+
await mcp.call('enable_stealth_mode', {});
|
|
220
|
+
|
|
221
|
+
// Navegar a Google
|
|
222
|
+
await mcp.call('navigate', { url: 'https://google.com' });
|
|
223
|
+
|
|
224
|
+
// Escribir en el buscador
|
|
225
|
+
await mcp.call('type', {
|
|
226
|
+
selector: 'input[name="q"]',
|
|
227
|
+
text: 'model context protocol'
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Hacer click en buscar
|
|
231
|
+
await mcp.call('click', { selector: 'input[type="submit"]' });
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Ejemplo 3: Exportar sesión
|
|
235
|
+
```typescript
|
|
236
|
+
// Exportar sesión actual (cookies, localStorage, etc.)
|
|
237
|
+
const result = await mcp.call('export_session', {});
|
|
238
|
+
console.log(result.session);
|
|
239
|
+
|
|
240
|
+
// Guardar en archivo
|
|
241
|
+
fs.writeFileSync('session.json', JSON.stringify(result.session));
|
|
242
|
+
|
|
243
|
+
// Importar en otra sesión
|
|
244
|
+
const sessionData = fs.readFileSync('session.json', 'utf8');
|
|
245
|
+
await mcp.call('import_session', { sessionData });
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Ejemplo 4: Gestionar Service Workers
|
|
249
|
+
```typescript
|
|
250
|
+
// Listar todos los service workers
|
|
251
|
+
const workers = await mcp.call('list_service_workers', {});
|
|
252
|
+
console.log(workers.workers);
|
|
253
|
+
|
|
254
|
+
// Actualizar un service worker específico
|
|
255
|
+
await mcp.call('update_service_worker', {
|
|
256
|
+
scopeURL: 'https://example.com/'
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Ver cachés
|
|
260
|
+
const caches = await mcp.call('get_sw_caches', {});
|
|
261
|
+
console.log(caches.caches);
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## 🔧 Configuración Avanzada
|
|
265
|
+
|
|
266
|
+
### Puerto personalizado
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"custom-chrome-mcp": {
|
|
270
|
+
"command": "npx",
|
|
271
|
+
"args": ["custom-chrome-mcp", "--port=9333"]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Variables de entorno
|
|
277
|
+
Puedes configurar:
|
|
278
|
+
- `CHROME_PORT` - Puerto de debugging (default: 9222)
|
|
279
|
+
|
|
280
|
+
## 🎯 Ventajas sobre otros MCPs
|
|
281
|
+
|
|
282
|
+
| Característica | Custom Chrome MCP | chrome-devtools-mcp | playwright-mcp |
|
|
283
|
+
|----------------|-------------------|---------------------|----------------|
|
|
284
|
+
| Conecta a Chrome existente | ✅ | ❌ | ❌ |
|
|
285
|
+
| Usa sesiones reales | ✅ | ❌ | ❌ |
|
|
286
|
+
| Anti-detección | ✅ | ❌ | ⚠️ |
|
|
287
|
+
| Service Workers | ✅ | ⚠️ | ⚠️ |
|
|
288
|
+
| Exportar/importar sesiones | ✅ | ❌ | ❌ |
|
|
289
|
+
| Delays human-like | ✅ | ❌ | ⚠️ |
|
|
290
|
+
| Multi-tab | ✅ | ✅ | ✅ |
|
|
291
|
+
| Screenshots | ✅ | ✅ | ✅ |
|
|
292
|
+
|
|
293
|
+
## 🐛 Troubleshooting
|
|
294
|
+
|
|
295
|
+
### Error: Failed to connect to Chrome
|
|
296
|
+
**Solución:** Asegúrate de que Chrome está corriendo con `--remote-debugging-port=9222`
|
|
297
|
+
|
|
298
|
+
```powershell
|
|
299
|
+
# Verifica que el puerto está abierto
|
|
300
|
+
netstat -an | findstr 9222
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Chrome detecta automatización
|
|
304
|
+
**Solución:** Usa `enable_stealth_mode` antes de navegar a sitios sensibles
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
await mcp.call('enable_stealth_mode', {});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Service Workers no aparecen
|
|
311
|
+
**Solución:** Los Service Workers solo funcionan con HTTPS o localhost. Usa un servidor local:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
python -m http.server 8000
|
|
315
|
+
# Luego navega a http://localhost:8000
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## 📝 Desarrollo
|
|
319
|
+
|
|
320
|
+
### Estructura del proyecto
|
|
321
|
+
```
|
|
322
|
+
custom-chrome-mcp/
|
|
323
|
+
├── src/
|
|
324
|
+
│ ├── index.ts # Servidor MCP principal
|
|
325
|
+
│ ├── chrome-connector.ts # Conexión a Chrome
|
|
326
|
+
│ ├── tools/
|
|
327
|
+
│ │ ├── navigation.ts # Navegación
|
|
328
|
+
│ │ ├── interaction.ts # Interacción
|
|
329
|
+
│ │ ├── anti-detection.ts # Anti-detección
|
|
330
|
+
│ │ ├── service-worker.ts # Service Workers
|
|
331
|
+
│ │ ├── capture.ts # Capturas
|
|
332
|
+
│ │ └── session.ts # Sesiones
|
|
333
|
+
│ ├── utils/
|
|
334
|
+
│ │ └── helpers.ts # Utilidades
|
|
335
|
+
│ └── types/
|
|
336
|
+
│ └── index.ts # Tipos TypeScript
|
|
337
|
+
├── package.json
|
|
338
|
+
└── tsconfig.json
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Comandos
|
|
342
|
+
```bash
|
|
343
|
+
npm run build # Compilar TypeScript
|
|
344
|
+
npm run dev # Modo desarrollo (watch)
|
|
345
|
+
npm run lint # Lint código
|
|
346
|
+
npm run format # Formatear código
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Añadir nuevas herramientas
|
|
350
|
+
|
|
351
|
+
1. Crea un nuevo archivo en `src/tools/`
|
|
352
|
+
2. Define tus herramientas usando el patrón:
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
export function createMyTools(connector: ChromeConnector) {
|
|
356
|
+
return [
|
|
357
|
+
{
|
|
358
|
+
name: 'my_tool',
|
|
359
|
+
description: 'Descripción de la herramienta',
|
|
360
|
+
inputSchema: z.object({
|
|
361
|
+
param: z.string().describe('Parámetro')
|
|
362
|
+
}),
|
|
363
|
+
handler: async ({ param }: any) => {
|
|
364
|
+
// Implementación
|
|
365
|
+
return { success: true };
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
];
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
3. Importa y añade en [index.ts](src/index.ts)
|
|
373
|
+
|
|
374
|
+
## 📄 Licencia
|
|
375
|
+
|
|
376
|
+
MIT © 2026 Eddy M
|
|
377
|
+
|
|
378
|
+
## 🤝 Contribuciones
|
|
379
|
+
|
|
380
|
+
¡Las contribuciones son bienvenidas! Por favor:
|
|
381
|
+
|
|
382
|
+
1. Fork el proyecto
|
|
383
|
+
2. Crea una rama para tu feature (`git checkout -b feature/amazing-feature`)
|
|
384
|
+
3. Commit tus cambios (`git commit -m 'Add amazing feature'`)
|
|
385
|
+
4. Push a la rama (`git push origin feature/amazing-feature`)
|
|
386
|
+
5. Abre un Pull Request
|
|
387
|
+
|
|
388
|
+
## 🙏 Agradecimientos
|
|
389
|
+
|
|
390
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/) - El protocolo que hace esto posible
|
|
391
|
+
- [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface) - Cliente CDP para Node.js
|
|
392
|
+
- La comunidad de Chrome DevTools
|
|
393
|
+
|
|
394
|
+
## 📧 Soporte
|
|
395
|
+
|
|
396
|
+
Si encuentras algún problema o tienes preguntas:
|
|
397
|
+
- Abre un issue en GitHub
|
|
398
|
+
- Consulta la documentación de MCP
|
|
399
|
+
- Revisa los ejemplos en este README
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
**Hecho con ❤️ para automatizar Chrome de forma inteligente**
|