chrome-devtools-mcp-for-extension 0.17.0 → 0.18.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.
- package/README.md +232 -496
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/testing/MetricTestUtils.js +46 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/testing/testing.js +4 -0
- package/build/src/browser.js +22 -0
- package/build/src/cli.js +5 -0
- package/build/src/config.js +13 -0
- package/build/src/graceful.js +125 -0
- package/build/src/login-helper.js +127 -19
- package/build/src/main.js +92 -1
- package/build/src/profile-resolver.js +76 -2
- package/build/src/project-root-state.js +13 -0
- package/build/src/roots-manager.js +178 -0
- package/build/src/selectors/gemini.json +24 -0
- package/build/src/selectors/loader.js +32 -0
- package/build/src/tools/diagnose-ui.js +9 -0
- package/build/src/tools/gemini-web.js +357 -0
- package/package.json +7 -5
- package/scripts/cli.mjs +44 -0
package/README.md
CHANGED
|
@@ -4,64 +4,54 @@
|
|
|
4
4
|
|
|
5
5
|
**AI-powered Chrome extension development with automated testing, debugging, and Web Store submission**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Built for:** Claude Code, Cursor, VS Code Copilot, Cline, and other MCP-compatible AI tools
|
|
7
|
+
Built for: Claude Code, Cursor, VS Code Copilot, Cline, and other MCP-compatible AI tools
|
|
10
8
|
|
|
11
9
|
---
|
|
12
10
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
### The Problem
|
|
16
|
-
- **Puppeteer/Playwright**: Disable extensions by default, require complex configuration
|
|
17
|
-
- **Traditional Testing**: Hours of setup, maintaining separate test profiles
|
|
18
|
-
- **Extension Development**: Can't test in real user environments
|
|
11
|
+
## 📦 For Users: Quick Start
|
|
19
12
|
|
|
20
|
-
###
|
|
21
|
-
- ✅ **System extensions auto-load**: Your installed Chrome extensions work automatically
|
|
22
|
-
- ✅ **Easy dev extension setup**: Simple `--loadExtensionsDir` configuration for development
|
|
23
|
-
- ✅ **Real environment**: Tests with your actual extensions and settings
|
|
24
|
-
- ✅ **Independent instance**: Runs alongside your regular Chrome without conflicts
|
|
13
|
+
### Installation
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
**Option 1: Direct execution (recommended)**
|
|
16
|
+
```bash
|
|
17
|
+
npx chrome-devtools-mcp-for-extension@latest
|
|
18
|
+
```
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
**Option 2: Global installation**
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g chrome-devtools-mcp-for-extension
|
|
23
|
+
chrome-devtools-mcp-for-extension
|
|
24
|
+
```
|
|
29
25
|
|
|
30
|
-
###
|
|
26
|
+
### MCP Configuration
|
|
31
27
|
|
|
32
|
-
Add
|
|
28
|
+
Add to your MCP client configuration file:
|
|
33
29
|
|
|
30
|
+
**For Claude Code** (`~/.claude.json`):
|
|
34
31
|
```json
|
|
35
32
|
{
|
|
36
33
|
"mcpServers": {
|
|
37
34
|
"chrome-devtools-extension": {
|
|
38
|
-
"type": "stdio",
|
|
39
35
|
"command": "npx",
|
|
40
|
-
"args": ["chrome-devtools-mcp-for-extension@latest"]
|
|
41
|
-
"env": {}
|
|
36
|
+
"args": ["chrome-devtools-mcp-for-extension@latest"]
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
40
|
```
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
**For other MCP clients** (Cursor, VS Code Copilot, Cline):
|
|
43
|
+
- Refer to your client's MCP configuration documentation
|
|
44
|
+
- Use the same `command` and `args` as above
|
|
48
45
|
|
|
49
|
-
###
|
|
46
|
+
### Test It
|
|
50
47
|
|
|
51
|
-
|
|
48
|
+
1. Restart your AI client
|
|
49
|
+
2. Ask: `"List all my Chrome extensions"`
|
|
50
|
+
3. ✅ You should see your installed Chrome extensions
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
"List all my Chrome extensions"
|
|
56
|
-
```
|
|
52
|
+
### Load Development Extensions (Optional)
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## 🔧 Load Development Extensions (Optional)
|
|
63
|
-
|
|
64
|
-
To test your own extensions under development, add `--loadExtensionsDir`:
|
|
54
|
+
To test your own extensions under development:
|
|
65
55
|
|
|
66
56
|
```json
|
|
67
57
|
{
|
|
@@ -77,581 +67,327 @@ To test your own extensions under development, add `--loadExtensionsDir`:
|
|
|
77
67
|
}
|
|
78
68
|
```
|
|
79
69
|
|
|
80
|
-
**Directory structure
|
|
70
|
+
**Directory structure:**
|
|
81
71
|
```
|
|
82
72
|
/path/to/your/extensions/
|
|
83
|
-
├──
|
|
73
|
+
├── extension-1/
|
|
84
74
|
│ └── manifest.json
|
|
85
|
-
├──
|
|
75
|
+
├── extension-2/
|
|
86
76
|
│ └── manifest.json
|
|
87
77
|
```
|
|
88
78
|
|
|
89
|
-
**More options**: See [MCP Configuration Guide](docs/mcp-configuration-guide.md)
|
|
90
|
-
|
|
91
79
|
---
|
|
92
80
|
|
|
93
|
-
##
|
|
81
|
+
## 👨💻 For Developers: Contributing
|
|
94
82
|
|
|
95
|
-
|
|
96
|
-
- 🏪 **Automated Web Store Submission**: Complete publishing workflow with form filling and screenshots
|
|
97
|
-
- 🔧 **Browser Testing**: Test extensions across real websites with full Chrome functionality
|
|
98
|
-
- 🐛 **Advanced Debugging**: Service worker inspection, console monitoring, error detection
|
|
99
|
-
- 📸 **Screenshot Generation**: Auto-create store listing images in all required formats
|
|
83
|
+
### Local Development Setup
|
|
100
84
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
## 📚 Common Workflows
|
|
104
|
-
|
|
105
|
-
### Create & Test Extension
|
|
106
|
-
```
|
|
107
|
-
1. "Create a Chrome extension that blocks ads on YouTube"
|
|
108
|
-
2. "List extensions to verify it loaded"
|
|
109
|
-
3. "Test the extension on youtube.com"
|
|
110
|
-
4. "Show any errors from the extension"
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Debug Extension Issues
|
|
114
|
-
```
|
|
115
|
-
1. "List extensions and show any errors"
|
|
116
|
-
2. "Inspect service worker for my-ad-blocker"
|
|
117
|
-
3. "Show console messages from the extension"
|
|
118
|
-
4. "Reload the extension with latest changes"
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Publish to Web Store
|
|
122
|
-
```
|
|
123
|
-
1. "Generate screenshots for my extension"
|
|
124
|
-
2. "Validate my manifest for Web Store compliance"
|
|
125
|
-
3. "Submit my extension to Chrome Web Store"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Performance Testing
|
|
129
|
-
```
|
|
130
|
-
1. "Start performance trace on current page"
|
|
131
|
-
2. "Test the extension's impact on page load"
|
|
132
|
-
3. "Show performance insights"
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## 🔍 Check Installed Version
|
|
138
|
-
|
|
139
|
-
To verify which version is being used by your AI client:
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
"What version of chrome-devtools-mcp-for-extension are you using?"
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
The AI will call the tool with `--version` flag to check.
|
|
146
|
-
|
|
147
|
-
**Troubleshooting cache issues:**
|
|
148
|
-
- If you're not getting the latest version with `@latest`:
|
|
149
|
-
- Clear npx cache: `npx clear-npx-cache` or `rm -rf ~/.npm/_npx`
|
|
150
|
-
- Or use specific version: `chrome-devtools-mcp-for-extension@0.8.1`
|
|
151
|
-
- Restart your AI client completely
|
|
152
|
-
|
|
153
|
-
**Direct check (manual):**
|
|
85
|
+
**1. Clone and install:**
|
|
154
86
|
```bash
|
|
155
|
-
|
|
87
|
+
git clone https://github.com/usedhonda/chrome-devtools-mcp.git
|
|
88
|
+
cd chrome-devtools-mcp
|
|
89
|
+
npm install
|
|
90
|
+
npm run build
|
|
156
91
|
```
|
|
157
92
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
## 🛠️ Extension Development Tools
|
|
161
|
-
|
|
162
|
-
Quick reference for the 3 core extension tools:
|
|
163
|
-
|
|
164
|
-
| Tool | Purpose | Example Command |
|
|
165
|
-
|------|---------|-----------------|
|
|
166
|
-
| `list_extensions` | View all extensions with status | "List all my Chrome extensions" |
|
|
167
|
-
| `reload_extension` | Hot-reload during development | "Reload my-extension" |
|
|
168
|
-
| `inspect_service_worker` | Debug background scripts | "Debug service worker for my-extension" |
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## 📊 How It Compares
|
|
174
|
-
|
|
175
|
-
| Feature | This Tool | Puppeteer/Playwright | Original chrome-devtools-mcp |
|
|
176
|
-
|---------|-----------|----------------------|------------------------------|
|
|
177
|
-
| Extension Support | ✅ Always enabled | ❌ Disabled by default | ⚠️ Manual config required |
|
|
178
|
-
| Setup Required | ❌ None | ✅ Complex config files | ✅ Multiple flags needed |
|
|
179
|
-
| Real User Profile | ✅ Direct access | ❌ Temporary profiles | ⚠️ Optional |
|
|
180
|
-
| Profile Copying | ❌ No copying needed | ⚠️ Manual setup | ⚠️ Manual setup |
|
|
181
|
-
| Web Store Automation | ✅ Built-in | ❌ None | ❌ None |
|
|
182
|
-
| Extension Debugging | ✅ Service worker + console | ⚠️ Limited | ❌ None |
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
<details>
|
|
186
|
-
<summary>📖 Detailed Tool Documentation</summary>
|
|
187
|
-
|
|
188
|
-
### `list_extensions` - Extension Inventory
|
|
189
|
-
**Purpose**: Comprehensive extension status monitoring
|
|
190
|
-
**Technical**: Accesses `chrome://extensions/` via shadow DOM manipulation
|
|
191
|
-
**Output**: Extension metadata, enabled/disabled status, version, error detection
|
|
192
|
-
**Use Case**: "List all my Chrome extensions" → Shows development and installed extensions
|
|
193
|
-
|
|
194
|
-
### `reload_extension` - Development Hot-Reload
|
|
195
|
-
**Purpose**: Streamlined extension development workflow
|
|
196
|
-
**Technical**: Finds extensions by name/partial match, triggers reload via Chrome extension API
|
|
197
|
-
**Output**: Confirmation of reload success/failure with error details
|
|
198
|
-
**Use Case**: "Reload my ad-blocker extension" → Instantly applies code changes
|
|
199
|
-
|
|
200
|
-
### `inspect_service_worker` - Debug Integration
|
|
201
|
-
**Purpose**: Deep debugging of extension background processes
|
|
202
|
-
**Technical**: Opens DevTools for service workers, supports Manifest V2/V3 architectures
|
|
203
|
-
**Output**: Direct DevTools access to extension console, network, sources
|
|
204
|
-
**Use Case**: "Debug why my content script isn't working" → Opens debugging interface
|
|
205
|
-
|
|
206
|
-
</details>
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
<details>
|
|
211
|
-
<summary>⚙️ Advanced Configuration</summary>
|
|
212
|
-
|
|
213
|
-
## Auto-load Development Extension
|
|
214
|
-
|
|
215
|
-
Add to `~/.claude.json`:
|
|
93
|
+
**2. Configure MCP client to use local version:**
|
|
216
94
|
|
|
95
|
+
Update `~/.claude.json`:
|
|
217
96
|
```json
|
|
218
97
|
{
|
|
219
98
|
"mcpServers": {
|
|
220
99
|
"chrome-devtools-extension": {
|
|
221
|
-
"
|
|
222
|
-
"command": "npx",
|
|
100
|
+
"command": "node",
|
|
223
101
|
"args": [
|
|
224
|
-
"chrome-devtools-mcp
|
|
225
|
-
"--
|
|
226
|
-
]
|
|
227
|
-
"env": {}
|
|
102
|
+
"/absolute/path/to/chrome-devtools-mcp/scripts/cli.mjs",
|
|
103
|
+
"--loadExtensionsDir=/path/to/your/test/extensions"
|
|
104
|
+
]
|
|
228
105
|
}
|
|
229
106
|
}
|
|
230
107
|
}
|
|
231
108
|
```
|
|
232
109
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
## Debug Mode
|
|
110
|
+
**3. Restart your AI client**
|
|
236
111
|
|
|
237
|
-
|
|
112
|
+
### Development Workflow
|
|
238
113
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
"type": "stdio",
|
|
244
|
-
"command": "npx",
|
|
245
|
-
"args": ["chrome-devtools-mcp-for-extension@latest"],
|
|
246
|
-
"env": {
|
|
247
|
-
"DEBUG": "mcp:*"
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
```
|
|
114
|
+
**Standard workflow (manual rebuild):**
|
|
115
|
+
```bash
|
|
116
|
+
# 1. Edit TypeScript files
|
|
117
|
+
vim src/tools/extensions.ts
|
|
253
118
|
|
|
254
|
-
|
|
119
|
+
# 2. Build
|
|
120
|
+
npm run build
|
|
255
121
|
|
|
256
|
-
|
|
122
|
+
# 3. Restart AI client
|
|
123
|
+
# Cmd+R in VS Code (or restart your MCP client)
|
|
257
124
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"mcpServers": {
|
|
261
|
-
"chrome-devtools-extension": {
|
|
262
|
-
"type": "stdio",
|
|
263
|
-
"command": "npx",
|
|
264
|
-
"args": [
|
|
265
|
-
"chrome-devtools-mcp-for-extension@latest",
|
|
266
|
-
"--channel=canary"
|
|
267
|
-
],
|
|
268
|
-
"env": {}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
125
|
+
# 4. Test changes
|
|
126
|
+
# Ask AI to use the modified tool
|
|
272
127
|
```
|
|
273
128
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
Add to `~/.claude.json`:
|
|
279
|
-
|
|
280
|
-
```json
|
|
129
|
+
**Hot-reload workflow (automatic rebuild):**
|
|
130
|
+
```bash
|
|
131
|
+
# 1. Update MCP configuration to use wrapper
|
|
132
|
+
# Edit ~/.claude.json:
|
|
281
133
|
{
|
|
282
134
|
"mcpServers": {
|
|
283
135
|
"chrome-devtools-extension": {
|
|
284
|
-
"
|
|
285
|
-
"command": "npx",
|
|
136
|
+
"command": "node",
|
|
286
137
|
"args": [
|
|
287
|
-
"chrome-devtools-mcp-
|
|
288
|
-
"--isolated"
|
|
138
|
+
"/absolute/path/to/chrome-devtools-mcp/scripts/mcp-wrapper.mjs"
|
|
289
139
|
],
|
|
290
|
-
"
|
|
140
|
+
"cwd": "/absolute/path/to/chrome-devtools-mcp",
|
|
141
|
+
"env": {
|
|
142
|
+
"MCP_ENV": "development"
|
|
143
|
+
}
|
|
291
144
|
}
|
|
292
145
|
}
|
|
293
146
|
}
|
|
294
|
-
```
|
|
295
147
|
|
|
296
|
-
|
|
148
|
+
# 2. Restart AI client ONCE (Cmd+R)
|
|
297
149
|
|
|
298
|
-
|
|
150
|
+
# 3. Edit TypeScript files
|
|
151
|
+
vim src/tools/extensions.ts
|
|
299
152
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
<summary>🏗️ Technical Architecture & Implementation</summary>
|
|
304
|
-
|
|
305
|
-
## What Makes This Different
|
|
306
|
-
|
|
307
|
-
This fork significantly restructures the original Chrome DevTools MCP for extension-focused development:
|
|
308
|
-
|
|
309
|
-
### System Profile Architecture (v0.6.0+)
|
|
310
|
-
|
|
311
|
-
**Zero-Config Design:**
|
|
312
|
-
```typescript
|
|
313
|
-
// Automatically detects and uses system Chrome profile
|
|
314
|
-
if (!isolated && !userDataDir) {
|
|
315
|
-
const systemProfile = detectSystemChromeProfile(channel) || detectAnySystemChromeProfile();
|
|
316
|
-
|
|
317
|
-
if (systemProfile) {
|
|
318
|
-
userDataDir = systemProfile.path; // Direct access, no copying
|
|
319
|
-
usingSystemProfile = true;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
153
|
+
# 4. Changes automatically rebuild and reload
|
|
154
|
+
# No need to restart AI client!
|
|
155
|
+
# Just test your changes immediately
|
|
322
156
|
```
|
|
323
157
|
|
|
324
|
-
**
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
-
|
|
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)
|
|
328
163
|
|
|
329
|
-
**
|
|
330
|
-
1. Specified channel (via `--channel` flag)
|
|
331
|
-
2. Fallback: stable → beta → dev → canary
|
|
332
|
-
3. Last resort: Creates temporary isolated profile
|
|
164
|
+
**See also:** [Hot-Reload Setup Guide](docs/hot-reload-setup-guide.md)
|
|
333
165
|
|
|
334
|
-
###
|
|
166
|
+
### Project Structure
|
|
335
167
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
168
|
+
```
|
|
169
|
+
chrome-devtools-mcp/
|
|
170
|
+
├── src/
|
|
171
|
+
│ ├── tools/ # MCP tool definitions
|
|
172
|
+
│ │ ├── extensions.ts # Extension management (list, reload, debug)
|
|
173
|
+
│ │ ├── chatgpt-web.ts # ChatGPT automation
|
|
174
|
+
│ │ └── ...
|
|
175
|
+
│ ├── browser.ts # Browser/profile management
|
|
176
|
+
│ ├── main.ts # MCP server entry point
|
|
177
|
+
│ └── graceful.ts # Graceful shutdown
|
|
178
|
+
├── scripts/
|
|
179
|
+
│ ├── cli.mjs # Production entry (users)
|
|
180
|
+
│ ├── mcp-wrapper.mjs # Development wrapper (hot-reload)
|
|
181
|
+
│ └── browser-globals-mock.mjs # Node.js browser globals
|
|
182
|
+
├── build/ # Compiled JavaScript (gitignored)
|
|
183
|
+
└── docs/ # Documentation
|
|
340
184
|
```
|
|
341
185
|
|
|
342
|
-
|
|
343
|
-
- Puppeteer's default `--disable-extensions` conflicts with extension development
|
|
344
|
-
- Previous versions used conditional logic (buggy, removed in v0.6.1)
|
|
345
|
-
- Current approach: **Always enable all extensions** for predictable behavior
|
|
346
|
-
|
|
347
|
-
### Chrome Security Challenges Solved
|
|
348
|
-
|
|
349
|
-
#### Chrome 137+ Breaking Changes
|
|
350
|
-
- **Problem**: Chrome 137+ disabled `--load-extension` in automation contexts
|
|
351
|
-
- **Solution**: Added `--disable-features=DisableLoadExtensionCommandLineSwitch` bypass
|
|
352
|
-
- **Impact**: Development extensions can still be loaded via CLI flags
|
|
353
|
-
|
|
354
|
-
#### Automation Detection Bypass
|
|
355
|
-
- **Problem**: Chrome blocks many operations when detecting automated control
|
|
356
|
-
- **Solution**: `--disable-blink-features=AutomationControlled` for real-world testing
|
|
357
|
-
- **Use Case**: Google login, OAuth flows, Web Store submission
|
|
358
|
-
|
|
359
|
-
#### Profile Management Strategy
|
|
360
|
-
- **Default**: Direct system profile access (no copying, instant sync)
|
|
361
|
-
- **Fallback**: Temporary profile with bookmarks copy (when Chrome is already running)
|
|
362
|
-
- **Override**: `--isolated` flag for completely separate profile
|
|
363
|
-
|
|
364
|
-
### Architecture Diagram
|
|
186
|
+
### Internal Architecture
|
|
365
187
|
|
|
188
|
+
**For users (production):**
|
|
366
189
|
```
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
┌──────────────────┐ ┌─────────────────┐
|
|
375
|
-
│ Web Store │ │ System Profile │
|
|
376
|
-
│ Automation │ │ (Direct Access) │
|
|
377
|
-
└──────────────────┘ └─────────────────┘
|
|
190
|
+
npx chrome-devtools-mcp-for-extension@latest
|
|
191
|
+
↓
|
|
192
|
+
scripts/cli.mjs
|
|
193
|
+
↓
|
|
194
|
+
node --import browser-globals-mock.mjs build/src/main.js
|
|
195
|
+
↓
|
|
196
|
+
MCP Server (single process, simple)
|
|
378
197
|
```
|
|
379
198
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
- **Smart Capture**: Extension popup, options page, in-context usage
|
|
392
|
-
|
|
393
|
-
### Manifest Validation System
|
|
394
|
-
|
|
395
|
-
```typescript
|
|
396
|
-
interface ManifestValidation {
|
|
397
|
-
required: string[]; // name, version, manifest_version
|
|
398
|
-
warnings: string[]; // description length, icon sizes
|
|
399
|
-
security: string[]; // dangerous permissions analysis
|
|
400
|
-
suggestions: string[]; // optimization recommendations
|
|
401
|
-
}
|
|
199
|
+
**For developers (hot-reload):**
|
|
200
|
+
```
|
|
201
|
+
node scripts/mcp-wrapper.mjs (MCP_ENV=development)
|
|
202
|
+
↓
|
|
203
|
+
tsc -w (automatic compilation)
|
|
204
|
+
↓
|
|
205
|
+
chokidar (file watcher)
|
|
206
|
+
↓
|
|
207
|
+
Auto-restart build/src/main.js on changes
|
|
208
|
+
↓
|
|
209
|
+
MCP Server (development mode, 2-5s reload)
|
|
402
210
|
```
|
|
403
211
|
|
|
404
|
-
**
|
|
405
|
-
-
|
|
406
|
-
-
|
|
407
|
-
-
|
|
408
|
-
-
|
|
409
|
-
- Host permission optimization suggestions
|
|
410
|
-
|
|
411
|
-
### Added Dependencies
|
|
412
|
-
- **archiver** (7.0.1): ZIP package creation for extension submission
|
|
413
|
-
- **puppeteer-core** (24.22.3): Chrome automation with extension support
|
|
414
|
-
- **@modelcontextprotocol/sdk** (1.18.1): MCP server implementation
|
|
212
|
+
**Key files:**
|
|
213
|
+
- `scripts/cli.mjs`: Simple wrapper for production (loads browser-globals-mock)
|
|
214
|
+
- `scripts/mcp-wrapper.mjs`: Development wrapper (hot-reload with tsc -w)
|
|
215
|
+
- `scripts/browser-globals-mock.mjs`: Polyfills for chrome-devtools-frontend in Node.js
|
|
216
|
+
- `src/main.ts`: Main MCP server (includes fallback browser globals)
|
|
415
217
|
|
|
416
|
-
|
|
417
|
-
-
|
|
418
|
-
-
|
|
419
|
-
-
|
|
218
|
+
**Why browser-globals-mock?**
|
|
219
|
+
- chrome-devtools-frontend expects browser globals (`location`, `self`, `localStorage`)
|
|
220
|
+
- Node.js doesn't have these globals
|
|
221
|
+
- `--import` flag loads the mock BEFORE any chrome-devtools-frontend modules
|
|
420
222
|
|
|
421
|
-
|
|
223
|
+
### Testing
|
|
422
224
|
|
|
423
|
-
|
|
225
|
+
```bash
|
|
226
|
+
# Build
|
|
227
|
+
npm run build
|
|
424
228
|
|
|
425
|
-
|
|
426
|
-
|
|
229
|
+
# Type check
|
|
230
|
+
npm run typecheck
|
|
427
231
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
- **Service Workers**: Background script debugging
|
|
431
|
-
- **Content Scripts**: Page interaction testing
|
|
432
|
-
- **Popup Extensions**: UI testing and screenshots
|
|
433
|
-
- **Options Pages**: Settings interface validation
|
|
232
|
+
# Run tests
|
|
233
|
+
npm test
|
|
434
234
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
- **Chromium**: Community builds
|
|
439
|
-
- **Edge**: Chromium-based versions
|
|
235
|
+
# Format code
|
|
236
|
+
npm run format
|
|
237
|
+
```
|
|
440
238
|
|
|
441
|
-
|
|
442
|
-
- **Node.js**: 22.12.0+ (for latest Chrome DevTools Protocol)
|
|
443
|
-
- **Chrome**: Any version with extension support
|
|
444
|
-
- **Storage**: ~50MB for dependencies
|
|
445
|
-
- **Network**: Required for Web Store automation
|
|
239
|
+
### Publishing (Maintainers Only)
|
|
446
240
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
- **Manual Reloading**: Update extensions via `reload_extension` MCP tool
|
|
451
|
-
- **Multi-Extension**: Support for multiple extensions simultaneously
|
|
241
|
+
```bash
|
|
242
|
+
# 1. Update version in package.json
|
|
243
|
+
npm version patch # or minor, major
|
|
452
244
|
|
|
453
|
-
|
|
245
|
+
# 2. Build
|
|
246
|
+
npm run build
|
|
454
247
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
- **Profile Isolation**: Use `--isolated` flag for temporary profile without personal data
|
|
458
|
-
- **Extension Sandboxing**: Extension permissions are sandboxed per Chrome security model
|
|
459
|
-
- **Web Store Auth**: Uses standard Google OAuth flow (no credentials stored)
|
|
248
|
+
# 3. Test locally
|
|
249
|
+
npx .
|
|
460
250
|
|
|
461
|
-
|
|
251
|
+
# 4. Publish to npm
|
|
252
|
+
npm publish
|
|
462
253
|
|
|
463
|
-
|
|
254
|
+
# 5. Push to GitHub
|
|
255
|
+
git push && git push --tags
|
|
256
|
+
```
|
|
464
257
|
|
|
465
258
|
---
|
|
466
259
|
|
|
467
|
-
|
|
468
|
-
<summary>❓ Troubleshooting</summary>
|
|
260
|
+
## ✨ Features
|
|
469
261
|
|
|
470
|
-
|
|
262
|
+
- 🧩 **Extension Development**: Load, debug, and reload Chrome extensions
|
|
263
|
+
- 🏪 **Web Store Automation**: Automated submission with screenshots
|
|
264
|
+
- 🔧 **Browser Testing**: Test extensions in real user environments
|
|
265
|
+
- 🐛 **Advanced Debugging**: Service worker inspection, console monitoring
|
|
266
|
+
- 📸 **Screenshot Generation**: Auto-create store listing images
|
|
267
|
+
- 🤖 **ChatGPT Integration**: Automated ChatGPT interactions for research
|
|
471
268
|
|
|
472
|
-
|
|
473
|
-
```
|
|
474
|
-
"List extensions and show any errors"
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
**Verify extension is in correct directory:**
|
|
478
|
-
- Manifest must be at root: `/your-extension/manifest.json`
|
|
479
|
-
- Not: `/your-extension/dist/manifest.json`
|
|
269
|
+
---
|
|
480
270
|
|
|
481
|
-
|
|
271
|
+
## 📚 Common Workflows
|
|
482
272
|
|
|
483
|
-
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
"command": "npx",
|
|
490
|
-
"args": [
|
|
491
|
-
"chrome-devtools-mcp-for-extension@latest",
|
|
492
|
-
"--loadExtension=/correct/path"
|
|
493
|
-
],
|
|
494
|
-
"env": {}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
273
|
+
### Create & Test Extension
|
|
274
|
+
```
|
|
275
|
+
1. "Create a Chrome extension that blocks ads"
|
|
276
|
+
2. "List extensions to verify it loaded"
|
|
277
|
+
3. "Test the extension on youtube.com"
|
|
278
|
+
4. "Show any errors from the extension"
|
|
498
279
|
```
|
|
499
280
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
**Extension may not be active:**
|
|
281
|
+
### Debug Extension Issues
|
|
503
282
|
```
|
|
504
|
-
"List extensions
|
|
505
|
-
"
|
|
283
|
+
1. "List extensions and show any errors"
|
|
284
|
+
2. "Inspect service worker for my-ad-blocker"
|
|
285
|
+
3. "Show console messages"
|
|
286
|
+
4. "Reload the extension with latest changes"
|
|
506
287
|
```
|
|
507
288
|
|
|
508
|
-
|
|
509
|
-
- Service worker only runs when needed
|
|
510
|
-
- Trigger extension action first (click popup, run content script)
|
|
511
|
-
|
|
512
|
-
## Web Store Submission Fails
|
|
513
|
-
|
|
514
|
-
**Manifest V3 compliance:**
|
|
289
|
+
### Publish to Web Store
|
|
515
290
|
```
|
|
516
|
-
"
|
|
291
|
+
1. "Generate screenshots for my extension"
|
|
292
|
+
2. "Validate manifest for Web Store compliance"
|
|
293
|
+
3. "Submit to Chrome Web Store"
|
|
517
294
|
```
|
|
518
295
|
|
|
519
|
-
|
|
520
|
-
- Missing required icons (16x16, 48x48, 128x128)
|
|
521
|
-
- Invalid permissions (host_permissions format)
|
|
522
|
-
- Service worker not specified
|
|
523
|
-
|
|
524
|
-
## Extensions Disabled After Chrome Update
|
|
525
|
-
|
|
526
|
-
**Chrome 137+ breaking change:**
|
|
527
|
-
- `--load-extension` may be restricted in newer Chrome versions
|
|
528
|
-
- **Solution**: Use system profile (default) instead of `--loadExtension` flag
|
|
296
|
+
---
|
|
529
297
|
|
|
530
|
-
##
|
|
298
|
+
## 🛠️ Core Tools
|
|
531
299
|
|
|
532
|
-
|
|
300
|
+
| Tool | Purpose | Example |
|
|
301
|
+
|------|---------|---------|
|
|
302
|
+
| `list_extensions` | View all extensions | "List my extensions" |
|
|
303
|
+
| `reload_extension` | Hot-reload | "Reload my-extension" |
|
|
304
|
+
| `inspect_service_worker` | Debug background | "Debug service worker" |
|
|
305
|
+
| `ask_chatgpt_web` | ChatGPT research | "Ask ChatGPT about..." |
|
|
306
|
+
| `take_snapshot` | Page analysis | "Snapshot current page" |
|
|
307
|
+
| `list_pages` | Browser tabs | "List open pages" |
|
|
533
308
|
|
|
534
|
-
|
|
309
|
+
**See also:** [Full Tool Documentation](docs/tools-reference.md)
|
|
535
310
|
|
|
536
|
-
|
|
537
|
-
- ✅ **Independent Chrome Instance**: Runs separately from your main Chrome browser
|
|
538
|
-
- ✅ **System Extensions Loaded**: Your installed Chrome extensions are automatically loaded via `--load-extension`
|
|
539
|
-
- ✅ **Concurrent Usage**: Works alongside your regular Chrome browser without conflicts
|
|
540
|
-
- 🔒 **Isolated Login State**: First launch requires Google login (for security)
|
|
541
|
-
- 🔒 **Isolated Profile**: Uses `~/.cache/chrome-devtools-mcp/chrome-profile/`
|
|
311
|
+
---
|
|
542
312
|
|
|
543
|
-
|
|
544
|
-
- ✅ **Extensions**: All system Chrome extensions are dynamically loaded
|
|
545
|
-
- ✅ **Bookmarks**: Accessible via MCP tools (`list_bookmarks`, `navigate_bookmark`)
|
|
546
|
-
- ✅ **Login State**: Preserved in isolated profile after first login
|
|
313
|
+
## 🔍 Troubleshooting
|
|
547
314
|
|
|
548
|
-
###
|
|
549
|
-
- ❌ **Bookmarks in Browser UI**: Not displayed in browser bookmarks bar (use MCP tools instead)
|
|
550
|
-
- ❌ **Shared Login State**: System Chrome login state is not shared (first login required)
|
|
315
|
+
### Extension Not Loading
|
|
551
316
|
|
|
552
|
-
### Profile Location
|
|
553
317
|
```
|
|
554
|
-
|
|
555
|
-
└── Default/
|
|
556
|
-
├── Cookies (isolated)
|
|
557
|
-
├── Login Data (isolated)
|
|
558
|
-
└── ... (all files isolated)
|
|
318
|
+
"List extensions and show any errors"
|
|
559
319
|
```
|
|
560
320
|
|
|
561
|
-
|
|
562
|
-
-
|
|
563
|
-
-
|
|
564
|
-
-
|
|
321
|
+
**Common fixes:**
|
|
322
|
+
- Verify manifest.json is at root of extension directory
|
|
323
|
+
- Check extension path in `--loadExtensionsDir`
|
|
324
|
+
- Ensure manifest is valid Manifest V3
|
|
565
325
|
|
|
566
|
-
###
|
|
567
|
-
|
|
326
|
+
### MCP Server Not Starting
|
|
327
|
+
|
|
328
|
+
**Check version:**
|
|
568
329
|
```bash
|
|
569
|
-
npx chrome-devtools-mcp-for-extension@latest --
|
|
330
|
+
npx chrome-devtools-mcp-for-extension@latest --version
|
|
570
331
|
```
|
|
571
332
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
**Chrome拡張機能開発用のAI支援MCPサーバー**
|
|
579
|
-
|
|
580
|
-
システム拡張機能を自動ロード、開発用拡張機能も簡単設定
|
|
581
|
-
|
|
582
|
-
## クイックスタート
|
|
583
|
-
|
|
584
|
-
### 1. 設定を追加
|
|
585
|
-
|
|
586
|
-
`~/.claude.json` に以下を追加:
|
|
587
|
-
|
|
588
|
-
```json
|
|
589
|
-
{
|
|
590
|
-
"mcpServers": {
|
|
591
|
-
"chrome-devtools-extension": {
|
|
592
|
-
"type": "stdio",
|
|
593
|
-
"command": "npx",
|
|
594
|
-
"args": ["chrome-devtools-mcp-for-extension@latest"],
|
|
595
|
-
"env": {}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
333
|
+
**Clear npx cache:**
|
|
334
|
+
```bash
|
|
335
|
+
npx clear-npx-cache
|
|
336
|
+
# or
|
|
337
|
+
rm -rf ~/.npm/_npx
|
|
599
338
|
```
|
|
600
339
|
|
|
601
|
-
|
|
340
|
+
**Check MCP configuration:**
|
|
341
|
+
```bash
|
|
342
|
+
cat ~/.claude.json | jq '.mcpServers'
|
|
343
|
+
```
|
|
602
344
|
|
|
603
|
-
###
|
|
345
|
+
### Hot-Reload Not Working (Developers)
|
|
604
346
|
|
|
605
|
-
|
|
347
|
+
**Verify development mode:**
|
|
348
|
+
```bash
|
|
349
|
+
ps aux | grep mcp-wrapper | grep MCP_ENV=development
|
|
606
350
|
```
|
|
607
|
-
|
|
351
|
+
|
|
352
|
+
**Check tsc -w is running:**
|
|
353
|
+
```bash
|
|
354
|
+
ps aux | grep 'tsc -w'
|
|
608
355
|
```
|
|
609
356
|
|
|
610
|
-
|
|
357
|
+
**Manually restart wrapper:**
|
|
358
|
+
```bash
|
|
359
|
+
pkill -f mcp-wrapper
|
|
360
|
+
# Then restart AI client (Cmd+R)
|
|
361
|
+
```
|
|
611
362
|
|
|
612
363
|
---
|
|
613
364
|
|
|
614
|
-
##
|
|
365
|
+
## 📖 Documentation
|
|
615
366
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
"chrome-devtools-extension": {
|
|
622
|
-
"command": "npx",
|
|
623
|
-
"args": [
|
|
624
|
-
"chrome-devtools-mcp-for-extension@latest",
|
|
625
|
-
"--loadExtensionsDir=/path/to/your/extensions"
|
|
626
|
-
]
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
```
|
|
367
|
+
- [MCP Configuration Guide](docs/mcp-configuration-guide.md)
|
|
368
|
+
- [Hot-Reload Setup Guide](docs/hot-reload-setup-guide.md) (Developers)
|
|
369
|
+
- [Tools Reference](docs/tools-reference.md)
|
|
370
|
+
- [ChatGPT Integration](docs/chatgpt-integration.md)
|
|
371
|
+
- [Web Store Automation](docs/webstore-automation.md)
|
|
631
372
|
|
|
632
373
|
---
|
|
633
374
|
|
|
634
|
-
##
|
|
375
|
+
## 🙏 Credits
|
|
635
376
|
|
|
636
|
-
-
|
|
637
|
-
- 🏪 **Chrome Web Store への自動申請**: スクリーンショット生成付き
|
|
638
|
-
- 🔧 **実環境でのブラウザテスト**: 既存の拡張機能と共存
|
|
639
|
-
- 🐛 **高度なデバッグ**: サービスワーカー検査、コンソール監視
|
|
377
|
+
This project is a fork of [Chrome DevTools MCP](https://github.com/ChromeDevTools/chrome-devtools-mcp) by Google LLC.
|
|
640
378
|
|
|
641
|
-
|
|
379
|
+
**Major additions:**
|
|
380
|
+
- Chrome extension development tools
|
|
381
|
+
- Web Store automation
|
|
382
|
+
- ChatGPT integration
|
|
383
|
+
- Hot-reload development workflow
|
|
384
|
+
- System profile management
|
|
642
385
|
|
|
643
|
-
|
|
644
|
-
「広告ブロック拡張機能を作成して」
|
|
645
|
-
「拡張機能のエラーを確認して」
|
|
646
|
-
「サービスワーカーをデバッグして」
|
|
647
|
-
「Web Storeに申請して」
|
|
648
|
-
```
|
|
386
|
+
---
|
|
649
387
|
|
|
650
|
-
|
|
388
|
+
## 📄 License
|
|
651
389
|
|
|
652
|
-
|
|
390
|
+
Apache-2.0
|
|
653
391
|
|
|
654
|
-
**Version**: 0.
|
|
392
|
+
**Version**: 0.18.0
|
|
655
393
|
**Repository**: https://github.com/usedhonda/chrome-devtools-mcp
|
|
656
|
-
**License**: Apache-2.0
|
|
657
|
-
**Original**: Chrome DevTools MCP by Google LLC
|