chrome-devtools-mcp-for-extension 0.26.1 → 0.26.3
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/README.md +141 -369
- package/build/src/McpContext.js +5 -3
- package/build/src/browser-connection-manager.js +4 -6
- package/build/src/browser.js +13 -7
- package/build/src/cli.js +9 -6
- package/build/src/login-helper.js +38 -11
- package/build/src/main.js +5 -4
- package/build/src/plugin-api.js +3 -3
- package/build/src/profile-resolver.js +6 -3
- package/build/src/roots-manager.js +2 -1
- package/build/src/selectors/chatgpt.json +2 -8
- package/build/src/selectors/gemini.json +21 -21
- package/build/src/selectors/loader.js +2 -2
- package/build/src/startup-check.js +4 -4
- package/build/src/tools/bookmarks.js +27 -15
- package/build/src/tools/chatgpt-web.js +41 -20
- package/build/src/tools/core-tools.js +7 -13
- package/build/src/tools/diagnose-ui.js +25 -11
- package/build/src/tools/emulation.js +10 -2
- package/build/src/tools/extensions.js +11 -5
- package/build/src/tools/gemini-web.js +34 -16
- package/build/src/tools/iframe-popup-tools.js +2 -2
- package/build/src/tools/network.js +4 -1
- package/build/src/tools/optional-tools.js +5 -4
- package/package.json +1 -1
- package/scripts/cli.mjs +22 -17
package/README.md
CHANGED
|
@@ -2,32 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.org/package/chrome-devtools-mcp-for-extension)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> AI-powered Chrome extension development via MCP
|
|
6
6
|
|
|
7
7
|
Built for: Claude Code, Cursor, VS Code Copilot, Cline, and other MCP-compatible AI tools
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Quick Start (5 minutes)
|
|
12
12
|
|
|
13
|
-
###
|
|
14
|
-
/
|
|
15
|
-
**Option 1: Direct execution (recommended)**
|
|
16
|
-
```bash
|
|
17
|
-
npx chrome-devtools-mcp-for-extension@latest
|
|
18
|
-
```
|
|
13
|
+
### 1. Run the server
|
|
19
14
|
|
|
20
|
-
**Option 2: Global installation**
|
|
21
15
|
```bash
|
|
22
|
-
|
|
23
|
-
chrome-devtools-mcp-for-extension
|
|
16
|
+
npx chrome-devtools-mcp-for-extension@latest
|
|
24
17
|
```
|
|
25
18
|
|
|
26
|
-
### MCP
|
|
27
|
-
|
|
28
|
-
Add to your MCP client configuration file:
|
|
19
|
+
### 2. Configure your MCP client
|
|
29
20
|
|
|
30
21
|
**For Claude Code** (`~/.claude.json`):
|
|
22
|
+
|
|
31
23
|
```json
|
|
32
24
|
{
|
|
33
25
|
"mcpServers": {
|
|
@@ -39,19 +31,11 @@ Add to your MCP client configuration file:
|
|
|
39
31
|
}
|
|
40
32
|
```
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
- Refer to your client's MCP configuration documentation
|
|
44
|
-
- Use the same `command` and `args` as above
|
|
34
|
+
### 3. Verify it works
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
Restart your AI client and ask: `"List all my Chrome extensions"`
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
2. Ask: `"List all my Chrome extensions"`
|
|
50
|
-
3. ✅ You should see your installed Chrome extensions
|
|
51
|
-
|
|
52
|
-
### Load Development Extensions (Optional)
|
|
53
|
-
|
|
54
|
-
To test your own extensions under development:
|
|
38
|
+
### Load development extensions (optional)
|
|
55
39
|
|
|
56
40
|
```json
|
|
57
41
|
{
|
|
@@ -67,414 +51,202 @@ To test your own extensions under development:
|
|
|
67
51
|
}
|
|
68
52
|
```
|
|
69
53
|
|
|
70
|
-
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## What You Can Do
|
|
57
|
+
|
|
58
|
+
- **Extension Development**: Load, debug, and hot-reload Chrome extensions
|
|
59
|
+
- **Browser Automation**: Navigate, click, fill forms, take screenshots
|
|
60
|
+
- **Performance Analysis**: Trace recording and insight extraction
|
|
61
|
+
- **AI Research**: Automated ChatGPT/Gemini interactions
|
|
62
|
+
- **Web Store Submission**: Automated screenshot generation and submission
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Tools Reference
|
|
67
|
+
|
|
68
|
+
### Core Tools (18)
|
|
69
|
+
|
|
70
|
+
| Tool | Description | Key Parameters |
|
|
71
|
+
|------|-------------|----------------|
|
|
72
|
+
| `take_snapshot` | Get page structure with element UIDs | - |
|
|
73
|
+
| `take_screenshot` | Capture page or element image | `fullPage`, `uid` |
|
|
74
|
+
| `click` | Click element by UID | `uid`, `dblClick` |
|
|
75
|
+
| `fill` | Fill input/textarea/select | `uid`, `value` |
|
|
76
|
+
| `fill_form` | Fill multiple form elements | `elements[]` |
|
|
77
|
+
| `hover` | Hover over element | `uid` |
|
|
78
|
+
| `drag` | Drag element to another | `from_uid`, `to_uid` |
|
|
79
|
+
| `upload_file` | Upload file through input | `uid`, `filePath` |
|
|
80
|
+
| `navigate` | Go to URL, back, forward | `op`, `url` |
|
|
81
|
+
| `pages` | List, select, close tabs | `op`, `pageIdx` |
|
|
82
|
+
| `wait_for` | Wait for text to appear | `text`, `timeout` |
|
|
83
|
+
| `handle_dialog` | Accept/dismiss dialogs | `action` |
|
|
84
|
+
| `resize_page` | Change viewport size | `width`, `height` |
|
|
85
|
+
| `emulate` | CPU/network throttling | `target`, `throttlingRate` |
|
|
86
|
+
| `network` | List/get network requests | `op`, `url` |
|
|
87
|
+
| `performance` | Start/stop/analyze traces | `op`, `insightName` |
|
|
88
|
+
| `evaluate_script` | Run JavaScript in page | `function` |
|
|
89
|
+
| `list_console_messages` | Get console output | - |
|
|
90
|
+
|
|
91
|
+
### Optional Tools (2) - Web-LLM
|
|
92
|
+
|
|
93
|
+
| Tool | Description | Key Parameters |
|
|
94
|
+
|------|-------------|----------------|
|
|
95
|
+
| `ask_chatgpt_web` | Ask ChatGPT via browser | `question`, `createNewChat` |
|
|
96
|
+
| `ask_gemini_web` | Ask Gemini via browser | `question`, `createNewChat` |
|
|
97
|
+
|
|
98
|
+
**Full documentation:** [docs/reference/tools.md](docs/reference/tools.md)
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Plugin Architecture (v0.26.0)
|
|
103
|
+
|
|
104
|
+
### Disable Web-LLM tools
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"env": {
|
|
109
|
+
"MCP_DISABLE_WEB_LLM": "true"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Load external plugins
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"env": {
|
|
119
|
+
"MCP_PLUGINS": "./my-plugin.js,@org/another-plugin"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
71
122
|
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
123
|
+
|
|
124
|
+
**Plugin interface:**
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
export default {
|
|
128
|
+
id: 'my-plugin',
|
|
129
|
+
name: 'My Custom Plugin',
|
|
130
|
+
version: '1.0.0',
|
|
131
|
+
async register(ctx) {
|
|
132
|
+
ctx.registry.register({
|
|
133
|
+
name: 'my_tool',
|
|
134
|
+
description: 'Does something useful',
|
|
135
|
+
schema: { /* zod schema */ },
|
|
136
|
+
async handler(input, response, context) { /* implementation */ },
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
};
|
|
77
140
|
```
|
|
78
141
|
|
|
79
142
|
---
|
|
80
143
|
|
|
81
|
-
##
|
|
144
|
+
## For Developers
|
|
82
145
|
|
|
83
|
-
### Local
|
|
146
|
+
### Local development setup
|
|
84
147
|
|
|
85
|
-
**1. Clone and install:**
|
|
86
148
|
```bash
|
|
87
149
|
git clone https://github.com/usedhonda/chrome-devtools-mcp.git
|
|
88
150
|
cd chrome-devtools-mcp
|
|
89
|
-
npm install
|
|
90
|
-
npm run build
|
|
151
|
+
npm install && npm run build
|
|
91
152
|
```
|
|
92
153
|
|
|
93
|
-
|
|
154
|
+
Configure `~/.claude.json` to use local version:
|
|
94
155
|
|
|
95
|
-
Update `~/.claude.json`:
|
|
96
156
|
```json
|
|
97
157
|
{
|
|
98
158
|
"mcpServers": {
|
|
99
159
|
"chrome-devtools-extension": {
|
|
100
160
|
"command": "node",
|
|
101
|
-
"args": [
|
|
102
|
-
"/absolute/path/to/chrome-devtools-mcp/scripts/cli.mjs",
|
|
103
|
-
"--loadExtensionsDir=/path/to/your/test/extensions"
|
|
104
|
-
]
|
|
161
|
+
"args": ["/absolute/path/to/chrome-devtools-mcp/scripts/cli.mjs"]
|
|
105
162
|
}
|
|
106
163
|
}
|
|
107
164
|
}
|
|
108
165
|
```
|
|
109
166
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### Development Workflow
|
|
113
|
-
|
|
114
|
-
**Standard workflow (manual rebuild):**
|
|
115
|
-
```bash
|
|
116
|
-
# 1. Edit TypeScript files
|
|
117
|
-
vim src/tools/extensions.ts
|
|
118
|
-
|
|
119
|
-
# 2. Build
|
|
120
|
-
npm run build
|
|
167
|
+
### Hot-reload development
|
|
121
168
|
|
|
122
|
-
|
|
123
|
-
# Cmd+R in VS Code (or restart your MCP client)
|
|
124
|
-
|
|
125
|
-
# 4. Test changes
|
|
126
|
-
# Ask AI to use the modified tool
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Hot-reload workflow (automatic rebuild):**
|
|
130
|
-
```bash
|
|
131
|
-
# 1. Update MCP configuration to use wrapper
|
|
132
|
-
# Edit ~/.claude.json:
|
|
169
|
+
```json
|
|
133
170
|
{
|
|
134
171
|
"mcpServers": {
|
|
135
172
|
"chrome-devtools-extension": {
|
|
136
173
|
"command": "node",
|
|
137
|
-
"args": [
|
|
138
|
-
"/absolute/path/to/chrome-devtools-mcp/scripts/mcp-wrapper.mjs"
|
|
139
|
-
],
|
|
174
|
+
"args": ["/absolute/path/to/chrome-devtools-mcp/scripts/mcp-wrapper.mjs"],
|
|
140
175
|
"cwd": "/absolute/path/to/chrome-devtools-mcp",
|
|
141
|
-
"env": {
|
|
142
|
-
"MCP_ENV": "development"
|
|
143
|
-
}
|
|
176
|
+
"env": { "MCP_ENV": "development" }
|
|
144
177
|
}
|
|
145
178
|
}
|
|
146
179
|
}
|
|
147
|
-
|
|
148
|
-
# 2. Restart AI client ONCE (Cmd+R)
|
|
149
|
-
|
|
150
|
-
# 3. Edit TypeScript files
|
|
151
|
-
vim src/tools/extensions.ts
|
|
152
|
-
|
|
153
|
-
# 4. Changes automatically rebuild and reload
|
|
154
|
-
# No need to restart AI client!
|
|
155
|
-
# Just test your changes immediately
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**Hot-reload benefits:**
|
|
159
|
-
- ✅ Automatic TypeScript compilation (`tsc -w`)
|
|
160
|
-
- ✅ Automatic server restart on file changes
|
|
161
|
-
- ✅ No VSCode Reload Window needed
|
|
162
|
-
- ✅ 2-5 second feedback loop (vs 20-30 seconds)
|
|
163
|
-
|
|
164
|
-
**See also:** [Hot-Reload Setup Guide](docs/hot-reload-setup-guide.md)
|
|
165
|
-
|
|
166
|
-
### Project Structure
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
chrome-devtools-mcp/
|
|
170
|
-
├── src/
|
|
171
|
-
│ ├── tools/ # MCP tool definitions
|
|
172
|
-
│ │ ├── core-tools.ts # Core tool exports (v0.26.0)
|
|
173
|
-
│ │ ├── optional-tools.ts # Web-LLM tool exports (v0.26.0)
|
|
174
|
-
│ │ ├── chatgpt-web.ts # ChatGPT automation
|
|
175
|
-
│ │ ├── gemini-web.ts # Gemini automation
|
|
176
|
-
│ │ └── ...
|
|
177
|
-
│ ├── plugin-api.ts # Plugin architecture (v0.26.0)
|
|
178
|
-
│ ├── browser.ts # Browser/profile management
|
|
179
|
-
│ ├── main.ts # MCP server entry point
|
|
180
|
-
│ └── graceful.ts # Graceful shutdown
|
|
181
|
-
├── scripts/
|
|
182
|
-
│ ├── cli.mjs # Production entry (users)
|
|
183
|
-
│ ├── mcp-wrapper.mjs # Development wrapper (hot-reload)
|
|
184
|
-
│ └── browser-globals-mock.mjs # Node.js browser globals
|
|
185
|
-
├── build/ # Compiled JavaScript (gitignored)
|
|
186
|
-
└── docs/ # Documentation
|
|
187
180
|
```
|
|
188
181
|
|
|
189
|
-
|
|
182
|
+
**Benefits:** Auto-rebuild on file changes, 2-5 second feedback loop.
|
|
190
183
|
|
|
191
|
-
**
|
|
192
|
-
```
|
|
193
|
-
npx chrome-devtools-mcp-for-extension@latest
|
|
194
|
-
↓
|
|
195
|
-
scripts/cli.mjs
|
|
196
|
-
↓
|
|
197
|
-
node --import browser-globals-mock.mjs build/src/main.js
|
|
198
|
-
↓
|
|
199
|
-
MCP Server (single process, simple)
|
|
200
|
-
```
|
|
184
|
+
**See also:** [docs/dev/hot-reload.md](docs/dev/hot-reload.md)
|
|
201
185
|
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
node scripts/mcp-wrapper.mjs (MCP_ENV=development)
|
|
205
|
-
↓
|
|
206
|
-
tsc -w (automatic compilation)
|
|
207
|
-
↓
|
|
208
|
-
chokidar (file watcher)
|
|
209
|
-
↓
|
|
210
|
-
Auto-restart build/src/main.js on changes
|
|
211
|
-
↓
|
|
212
|
-
MCP Server (development mode, 2-5s reload)
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
**Key files:**
|
|
216
|
-
- `scripts/cli.mjs`: Simple wrapper for production (loads browser-globals-mock)
|
|
217
|
-
- `scripts/mcp-wrapper.mjs`: Development wrapper (hot-reload with tsc -w)
|
|
218
|
-
- `scripts/browser-globals-mock.mjs`: Polyfills for chrome-devtools-frontend in Node.js
|
|
219
|
-
- `src/main.ts`: Main MCP server (includes fallback browser globals)
|
|
220
|
-
|
|
221
|
-
**Why browser-globals-mock?**
|
|
222
|
-
- chrome-devtools-frontend expects browser globals (`location`, `self`, `localStorage`)
|
|
223
|
-
- Node.js doesn't have these globals
|
|
224
|
-
- `--import` flag loads the mock BEFORE any chrome-devtools-frontend modules
|
|
225
|
-
|
|
226
|
-
### Testing
|
|
186
|
+
### Commands
|
|
227
187
|
|
|
228
188
|
```bash
|
|
229
|
-
# Build
|
|
230
|
-
npm run
|
|
231
|
-
|
|
232
|
-
#
|
|
233
|
-
npm run typecheck
|
|
234
|
-
|
|
235
|
-
# Run tests
|
|
236
|
-
npm test
|
|
237
|
-
|
|
238
|
-
# Format code
|
|
239
|
-
npm run format
|
|
189
|
+
npm run build # Build TypeScript
|
|
190
|
+
npm run typecheck # Type check
|
|
191
|
+
npm test # Run tests
|
|
192
|
+
npm run format # Format code
|
|
240
193
|
```
|
|
241
194
|
|
|
242
|
-
###
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
# 1. Update version in package.json
|
|
246
|
-
npm version patch # or minor, major
|
|
247
|
-
|
|
248
|
-
# 2. Build
|
|
249
|
-
npm run build
|
|
250
|
-
|
|
251
|
-
# 3. Test locally
|
|
252
|
-
npx .
|
|
195
|
+
### Project structure
|
|
253
196
|
|
|
254
|
-
# 4. Publish to npm
|
|
255
|
-
npm publish
|
|
256
|
-
|
|
257
|
-
# 5. Push to GitHub
|
|
258
|
-
git push && git push --tags
|
|
259
197
|
```
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
-
|
|
269
|
-
|
|
270
|
-
- 🤖 **ChatGPT/Gemini Integration**: Automated AI interactions for research
|
|
271
|
-
- 🔌 **Plugin Architecture** (v0.26.0): Extensible tool system with external plugins
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## 📚 Common Workflows
|
|
276
|
-
|
|
277
|
-
### Create & Test Extension
|
|
278
|
-
```
|
|
279
|
-
1. "Create a Chrome extension that blocks ads"
|
|
280
|
-
2. "List extensions to verify it loaded"
|
|
281
|
-
3. "Test the extension on youtube.com"
|
|
282
|
-
4. "Show any errors from the extension"
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Debug Extension Issues
|
|
286
|
-
```
|
|
287
|
-
1. "List extensions and show any errors"
|
|
288
|
-
2. "Inspect service worker for my-ad-blocker"
|
|
289
|
-
3. "Show console messages"
|
|
290
|
-
4. "Reload the extension with latest changes"
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Publish to Web Store
|
|
294
|
-
```
|
|
295
|
-
1. "Generate screenshots for my extension"
|
|
296
|
-
2. "Validate manifest for Web Store compliance"
|
|
297
|
-
3. "Submit to Chrome Web Store"
|
|
198
|
+
chrome-devtools-mcp/
|
|
199
|
+
├── src/
|
|
200
|
+
│ ├── tools/ # MCP tool definitions
|
|
201
|
+
│ ├── plugin-api.ts # Plugin architecture
|
|
202
|
+
│ ├── browser.ts # Browser management
|
|
203
|
+
│ └── main.ts # Entry point
|
|
204
|
+
├── scripts/
|
|
205
|
+
│ ├── cli.mjs # Production entry
|
|
206
|
+
│ └── mcp-wrapper.mjs # Development wrapper
|
|
207
|
+
└── docs/ # Documentation
|
|
298
208
|
```
|
|
299
209
|
|
|
300
210
|
---
|
|
301
211
|
|
|
302
|
-
##
|
|
212
|
+
## Documentation
|
|
303
213
|
|
|
304
|
-
|
|
|
305
|
-
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
| `list_pages` | Browser tabs | "List open pages" |
|
|
312
|
-
|
|
313
|
-
**Note:** Extension tools use CDP (Chrome DevTools Protocol) for reliable operation.
|
|
314
|
-
Shadow DOM-based tools (`list_extensions`, `reload_extension`, etc.) were removed in v0.19.0
|
|
315
|
-
due to Chrome security restrictions.
|
|
316
|
-
|
|
317
|
-
**See also:** [Full Tool Documentation](docs/tools-reference.md)
|
|
214
|
+
| Guide | Description |
|
|
215
|
+
|-------|-------------|
|
|
216
|
+
| [Setup Guide](docs/user/setup.md) | Detailed MCP configuration |
|
|
217
|
+
| [Workflows](docs/user/workflows.md) | Common usage patterns |
|
|
218
|
+
| [Troubleshooting](docs/user/troubleshooting.md) | Problem solving |
|
|
219
|
+
| [Tools Reference](docs/reference/tools.md) | Full tool documentation |
|
|
220
|
+
| [Hot-Reload Setup](docs/dev/hot-reload.md) | Developer workflow |
|
|
318
221
|
|
|
319
222
|
---
|
|
320
223
|
|
|
321
|
-
##
|
|
322
|
-
|
|
323
|
-
### Extension Not Loading
|
|
324
|
-
|
|
325
|
-
```
|
|
326
|
-
"Check extension popup for errors"
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
**Common fixes:**
|
|
330
|
-
- Verify manifest.json is at root of extension directory
|
|
331
|
-
- Check extension path in `--loadExtensionsDir`
|
|
332
|
-
- Ensure manifest is valid Manifest V3
|
|
333
|
-
|
|
334
|
-
### MCP Server Not Starting
|
|
224
|
+
## Troubleshooting
|
|
335
225
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
**Clear npx cache:**
|
|
342
|
-
```bash
|
|
343
|
-
npx clear-npx-cache
|
|
344
|
-
# or
|
|
345
|
-
rm -rf ~/.npm/_npx
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
**Check MCP configuration:**
|
|
349
|
-
```bash
|
|
350
|
-
cat ~/.claude.json | jq '.mcpServers'
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### Hot-Reload Not Working (Developers)
|
|
354
|
-
|
|
355
|
-
**Verify development mode:**
|
|
356
|
-
```bash
|
|
357
|
-
ps aux | grep mcp-wrapper | grep MCP_ENV=development
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
**Check tsc -w is running:**
|
|
361
|
-
```bash
|
|
362
|
-
ps aux | grep 'tsc -w'
|
|
363
|
-
```
|
|
226
|
+
### Extension not loading
|
|
227
|
+
- Verify `manifest.json` is at extension root
|
|
228
|
+
- Use absolute paths in `--loadExtensionsDir`
|
|
364
229
|
|
|
365
|
-
|
|
230
|
+
### MCP server issues
|
|
366
231
|
```bash
|
|
367
|
-
|
|
368
|
-
# Then restart AI client (Cmd+R)
|
|
232
|
+
npx clear-npx-cache && npx chrome-devtools-mcp-for-extension@latest
|
|
369
233
|
```
|
|
370
234
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
## 📖 Documentation
|
|
374
|
-
|
|
375
|
-
- [MCP Configuration Guide](docs/mcp-configuration-guide.md)
|
|
376
|
-
- [Hot-Reload Setup Guide](docs/hot-reload-setup-guide.md) (Developers)
|
|
377
|
-
- [Tools Reference](docs/tools-reference.md)
|
|
378
|
-
- [ChatGPT Integration](docs/chatgpt-integration.md)
|
|
379
|
-
- [Web Store Automation](docs/webstore-automation.md)
|
|
380
|
-
|
|
381
|
-
---
|
|
382
|
-
|
|
383
|
-
## 🔌 Plugin Architecture (v0.26.0)
|
|
384
|
-
|
|
385
|
-
### Tool Categories
|
|
386
|
-
|
|
387
|
-
**Core Tools (18)** - Stable, site-independent:
|
|
388
|
-
- Input: click, hover, fill, drag, fill_form, upload_file
|
|
389
|
-
- Navigation: pages, navigate, resize_page, handle_dialog
|
|
390
|
-
- Debugging: list_console_messages, take_screenshot, evaluate_script, take_snapshot, wait_for
|
|
391
|
-
- Analysis: emulate, network, performance
|
|
392
|
-
|
|
393
|
-
**Optional Tools (2)** - Web-LLM, site-dependent (may break with UI changes):
|
|
394
|
-
- `ask_chatgpt_web` - ChatGPT browser automation
|
|
395
|
-
- `ask_gemini_web` - Gemini browser automation
|
|
396
|
-
|
|
397
|
-
### Disable Web-LLM Tools
|
|
398
|
-
|
|
399
|
-
If you don't need ChatGPT/Gemini integration:
|
|
400
|
-
|
|
401
|
-
```json
|
|
402
|
-
{
|
|
403
|
-
"mcpServers": {
|
|
404
|
-
"chrome-devtools-extension": {
|
|
405
|
-
"command": "npx",
|
|
406
|
-
"args": ["chrome-devtools-mcp-for-extension@latest"],
|
|
407
|
-
"env": {
|
|
408
|
-
"MCP_DISABLE_WEB_LLM": "true"
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### External Plugins
|
|
416
|
-
|
|
417
|
-
Load custom plugins at startup:
|
|
418
|
-
|
|
419
|
-
```json
|
|
420
|
-
{
|
|
421
|
-
"mcpServers": {
|
|
422
|
-
"chrome-devtools-extension": {
|
|
423
|
-
"command": "npx",
|
|
424
|
-
"args": ["chrome-devtools-mcp-for-extension@latest"],
|
|
425
|
-
"env": {
|
|
426
|
-
"MCP_PLUGINS": "./my-plugin.js,@org/another-plugin"
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
**Plugin Interface:**
|
|
434
|
-
```typescript
|
|
435
|
-
// my-plugin.js
|
|
436
|
-
export default {
|
|
437
|
-
id: 'my-plugin',
|
|
438
|
-
name: 'My Custom Plugin',
|
|
439
|
-
version: '1.0.0',
|
|
440
|
-
|
|
441
|
-
async register(ctx) {
|
|
442
|
-
ctx.registry.register({
|
|
443
|
-
name: 'my_custom_tool',
|
|
444
|
-
description: 'Does something useful',
|
|
445
|
-
schema: { /* zod schema */ },
|
|
446
|
-
annotations: { category: 'automation' },
|
|
447
|
-
async handler(input, response, context) {
|
|
448
|
-
// Tool implementation
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
ctx.log('Plugin registered!');
|
|
452
|
-
},
|
|
453
|
-
|
|
454
|
-
async unload() {
|
|
455
|
-
// Cleanup if needed
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
```
|
|
235
|
+
**More:** [docs/user/troubleshooting.md](docs/user/troubleshooting.md)
|
|
459
236
|
|
|
460
237
|
---
|
|
461
238
|
|
|
462
|
-
##
|
|
239
|
+
## Credits
|
|
463
240
|
|
|
464
|
-
|
|
241
|
+
Fork of [Chrome DevTools MCP](https://github.com/ChromeDevTools/chrome-devtools-mcp) by Google LLC.
|
|
465
242
|
|
|
466
|
-
**
|
|
467
|
-
- Chrome extension development tools
|
|
468
|
-
- Web Store automation
|
|
469
|
-
- ChatGPT integration
|
|
470
|
-
- Hot-reload development workflow
|
|
471
|
-
- System profile management
|
|
243
|
+
**Additions:** Extension development tools, Web Store automation, ChatGPT/Gemini integration, hot-reload workflow.
|
|
472
244
|
|
|
473
245
|
---
|
|
474
246
|
|
|
475
|
-
##
|
|
247
|
+
## License
|
|
476
248
|
|
|
477
249
|
Apache-2.0
|
|
478
250
|
|
|
479
|
-
**Version**: 0.26.
|
|
251
|
+
**Version**: 0.26.1
|
|
480
252
|
**Repository**: https://github.com/usedhonda/chrome-devtools-mcp
|
package/build/src/McpContext.js
CHANGED
|
@@ -93,7 +93,7 @@ export class McpContext {
|
|
|
93
93
|
async #disposeSessions() {
|
|
94
94
|
await Promise.allSettled([
|
|
95
95
|
this.#browserSession?.detach(),
|
|
96
|
-
...[...this.#pageSessions.values()].map(s => s.detach())
|
|
96
|
+
...[...this.#pageSessions.values()].map(s => s.detach()),
|
|
97
97
|
]);
|
|
98
98
|
this.#browserSession = undefined;
|
|
99
99
|
this.#pageSessions.clear();
|
|
@@ -111,7 +111,9 @@ export class McpContext {
|
|
|
111
111
|
this.logger('CDP: Browser-level session created');
|
|
112
112
|
// 3. Enable Target discovery and auto-attach
|
|
113
113
|
try {
|
|
114
|
-
await this.#browserSession.send('Target.setDiscoverTargets', {
|
|
114
|
+
await this.#browserSession.send('Target.setDiscoverTargets', {
|
|
115
|
+
discover: true,
|
|
116
|
+
});
|
|
115
117
|
this.logger('CDP: Target discovery enabled');
|
|
116
118
|
}
|
|
117
119
|
catch (err) {
|
|
@@ -121,7 +123,7 @@ export class McpContext {
|
|
|
121
123
|
await this.#browserSession.send('Target.setAutoAttach', {
|
|
122
124
|
autoAttach: true,
|
|
123
125
|
waitForDebuggerOnStart: false,
|
|
124
|
-
flatten: true
|
|
126
|
+
flatten: true,
|
|
125
127
|
});
|
|
126
128
|
this.logger('CDP: Auto-attach configured');
|
|
127
129
|
}
|
|
@@ -47,9 +47,8 @@ export class BrowserConnectionManager {
|
|
|
47
47
|
/** Disconnected event handler (arrow function to preserve 'this') */
|
|
48
48
|
onDisconnected = () => {
|
|
49
49
|
this.log('Browser disconnected');
|
|
50
|
-
this.setState(ConnectionState.
|
|
51
|
-
//
|
|
52
|
-
void this.triggerReconnect('event:disconnected');
|
|
50
|
+
this.setState(ConnectionState.CLOSED);
|
|
51
|
+
// Auto-reconnection disabled: reconnect only when MCP operation requires it
|
|
53
52
|
};
|
|
54
53
|
constructor(options = {}) {
|
|
55
54
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
@@ -111,8 +110,7 @@ export class BrowserConnectionManager {
|
|
|
111
110
|
this.log(`Reconnection overall timeout (${overallTimeout}ms) exceeded`);
|
|
112
111
|
}, overallTimeout);
|
|
113
112
|
// Start reconnection sequence
|
|
114
|
-
this.reconnectSequenceInFlight = this._runReconnectionSequence(abortController.signal)
|
|
115
|
-
.finally(() => {
|
|
113
|
+
this.reconnectSequenceInFlight = this._runReconnectionSequence(abortController.signal).finally(() => {
|
|
116
114
|
clearTimeout(timeoutId);
|
|
117
115
|
this.reconnectSequenceInFlight = null;
|
|
118
116
|
});
|
|
@@ -309,7 +307,7 @@ ${lastError?.message || 'Unknown error'}
|
|
|
309
307
|
* Sleep for specified milliseconds
|
|
310
308
|
*/
|
|
311
309
|
sleep(ms) {
|
|
312
|
-
return new Promise(
|
|
310
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
313
311
|
}
|
|
314
312
|
/**
|
|
315
313
|
* Get current browser instance
|