chrome-devtools-mcp-for-extension 0.5.4 → 0.6.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/README.md +250 -19
- package/build/src/cli.js +2 -30
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.org/package/chrome-devtools-mcp-for-extension)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
AI-powered Chrome extension development with automated testing, debugging, and Web Store submission.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Built for:** Claude Code, Cursor, VS Code Copilot, Cline, and other MCP-compatible AI tools
|
|
8
8
|
|
|
9
9
|
## Quick Start
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### 1. Add to your MCP client
|
|
12
12
|
|
|
13
|
+
**Claude Code users (recommended):**
|
|
14
|
+
```bash
|
|
15
|
+
# Install globally for all projects
|
|
16
|
+
claude mcp add --scope user chrome-devtools-extension npx chrome-devtools-mcp-for-extension@latest
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Manual configuration:**
|
|
13
20
|
```json
|
|
14
21
|
{
|
|
15
22
|
"mcpServers": {
|
|
@@ -21,22 +28,34 @@ Add this configuration to your MCP client:
|
|
|
21
28
|
}
|
|
22
29
|
```
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
### 2. Restart your AI client
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
claude mcp add chrome-devtools-extension npx chrome-devtools-mcp-for-extension@latest
|
|
33
|
+
### 3. Try it out
|
|
28
34
|
```
|
|
35
|
+
"Create a Chrome extension that blocks ads"
|
|
36
|
+
"List all my Chrome extensions"
|
|
37
|
+
"Submit my extension to Chrome Web Store"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What You Can Do
|
|
41
|
+
|
|
42
|
+
- 🧩 **Extension Development**: Load, debug, and reload Chrome extensions during development
|
|
43
|
+
- 🏪 **Automated Web Store Submission**: Complete publishing workflow with form filling and screenshots
|
|
44
|
+
- 🔧 **Browser Testing**: Test extensions across real websites with full Chrome functionality
|
|
45
|
+
- 🐛 **Advanced Debugging**: Service worker inspection, console monitoring, error detection
|
|
46
|
+
- 📸 **Screenshot Generation**: Auto-create store listing images in all required formats
|
|
47
|
+
|
|
48
|
+
## Configuration Options
|
|
29
49
|
|
|
30
50
|
<details>
|
|
31
|
-
<summary>
|
|
51
|
+
<summary>Manual MCP Configuration</summary>
|
|
32
52
|
|
|
33
53
|
**Configuration file locations:**
|
|
34
|
-
|
|
35
54
|
- **Cursor**: `~/.cursor/extensions_config.json`
|
|
36
55
|
- **VS Code Copilot**: `.vscode/settings.json`
|
|
37
56
|
- **Cline**: Follow Cline's MCP setup guide
|
|
38
57
|
|
|
39
|
-
**
|
|
58
|
+
**Basic configuration:**
|
|
40
59
|
```json
|
|
41
60
|
{
|
|
42
61
|
"mcpServers": {
|
|
@@ -48,7 +67,7 @@ claude mcp add chrome-devtools-extension npx chrome-devtools-mcp-for-extension@l
|
|
|
48
67
|
}
|
|
49
68
|
```
|
|
50
69
|
|
|
51
|
-
**With extension loading:**
|
|
70
|
+
**With extension auto-loading:**
|
|
52
71
|
```json
|
|
53
72
|
{
|
|
54
73
|
"mcpServers": {
|
|
@@ -62,27 +81,239 @@ claude mcp add chrome-devtools-extension npx chrome-devtools-mcp-for-extension@l
|
|
|
62
81
|
}
|
|
63
82
|
}
|
|
64
83
|
```
|
|
84
|
+
|
|
85
|
+
**Debug mode:**
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"chrome-devtools-extension": {
|
|
90
|
+
"command": "npx",
|
|
91
|
+
"args": ["chrome-devtools-mcp-for-extension@latest"],
|
|
92
|
+
"env": {
|
|
93
|
+
"DEBUG": "mcp:*"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
65
99
|
</details>
|
|
66
100
|
|
|
67
|
-
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Technical Details
|
|
104
|
+
|
|
105
|
+
### What Makes This Different
|
|
106
|
+
|
|
107
|
+
This fork significantly restructures the original Chrome DevTools MCP for extension-focused development:
|
|
108
|
+
|
|
109
|
+
### Added Extension-Specific Tools
|
|
110
|
+
- **Extension Management**: 3 specialized tools for extension development workflow
|
|
111
|
+
- **Web Store Automation**: 2 tools for automated submission and screenshot generation
|
|
112
|
+
- **Focus**: Extension-specific operations added to comprehensive browser automation
|
|
113
|
+
|
|
114
|
+
### Chrome Security & Technical Challenges Solved
|
|
115
|
+
|
|
116
|
+
#### Extension Loading Security Restrictions
|
|
117
|
+
Chrome's security model makes automated extension loading complex for legitimate development:
|
|
118
|
+
|
|
119
|
+
- **Chrome 137+ Policy Changes**: Google disabled `--load-extension` by default in automation contexts
|
|
120
|
+
- **Solution**: Added `--disable-features=DisableLoadExtensionCommandLineSwitch` flag bypass
|
|
121
|
+
- **Automation Detection**: Chrome blocks many operations when detecting automated control
|
|
122
|
+
- **Solution**: `--disable-blink-features=AutomationControlled` for real-world testing scenarios
|
|
123
|
+
|
|
124
|
+
#### Puppeteer Integration Challenges
|
|
125
|
+
- **Default Args Conflict**: Puppeteer's `--disable-extensions` conflicts with extension loading
|
|
126
|
+
- **Solution**: Selective `ignoreDefaultArgs` removal only when extensions are present
|
|
127
|
+
- **Profile Management**: System profile access vs. temporary profile isolation
|
|
128
|
+
- **Solution**: Automatic fallback to temporary profiles when system profile conflicts occur
|
|
129
|
+
|
|
130
|
+
#### Manifest Discovery & Validation
|
|
131
|
+
- **Build System Variations**: Extensions may be in `/dist`, `/build`, `/extension` subdirectories
|
|
132
|
+
- **Solution**: Intelligent manifest.json discovery across common build patterns
|
|
133
|
+
- **Manifest V3 Compliance**: Strict validation for Web Store compatibility
|
|
134
|
+
- **Solution**: Comprehensive validation with actionable security warnings
|
|
135
|
+
|
|
136
|
+
### New Automation Tools
|
|
137
|
+
- `webstore-submission.ts`: Full Chrome Web Store submission automation
|
|
138
|
+
- `webstore-auto-screenshot.ts`: Multi-format screenshot generation for store listings
|
|
139
|
+
- Enhanced manifest validation with Web Store compliance checking
|
|
140
|
+
|
|
141
|
+
### Added Dependencies
|
|
142
|
+
- **archiver**: ZIP package creation for extension submission
|
|
143
|
+
- **Enhanced manifest parsing**: Validates Manifest V3 compliance and permissions
|
|
68
144
|
|
|
69
|
-
###
|
|
145
|
+
### MCP Server Coexistence
|
|
146
|
+
- **Server Name**: `chrome-devtools-extension` (vs original `chrome-devtools`)
|
|
147
|
+
- **Package Name**: `chrome-devtools-mcp-for-extension`
|
|
148
|
+
- **Purpose**: Allows both servers to run simultaneously for different use cases
|
|
149
|
+
|
|
150
|
+
## Implementation Details
|
|
151
|
+
|
|
152
|
+
### Architecture
|
|
153
|
+
```
|
|
154
|
+
Extension Development Flow:
|
|
155
|
+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
156
|
+
│ AI Assistant │───▶│ MCP Server │───▶│ Chrome Browser │
|
|
157
|
+
│ (Claude/Cursor) │ │ (Extension Tools)│ │ + Extensions │
|
|
158
|
+
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
159
|
+
│
|
|
160
|
+
▼
|
|
161
|
+
┌──────────────────┐
|
|
162
|
+
│ Web Store │
|
|
163
|
+
│ Automation │
|
|
164
|
+
└──────────────────┘
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Extension Management Tools (3 Tools)
|
|
168
|
+
|
|
169
|
+
#### 1. `list_extensions` - Extension Inventory
|
|
170
|
+
- **Purpose**: Comprehensive extension status monitoring
|
|
171
|
+
- **Technical**: Accesses `chrome://extensions/` via shadow DOM manipulation
|
|
172
|
+
- **Output**: Extension metadata, enabled/disabled status, version, error detection
|
|
173
|
+
- **Use Case**: "List all my Chrome extensions" → Shows development and installed extensions
|
|
174
|
+
|
|
175
|
+
#### 2. `reload_extension` - Development Hot-Reload
|
|
176
|
+
- **Purpose**: Streamlined extension development workflow
|
|
177
|
+
- **Technical**: Finds extensions by name/partial match, triggers reload via Chrome extension API
|
|
178
|
+
- **Output**: Confirmation of reload success/failure with error details
|
|
179
|
+
- **Use Case**: "Reload my ad-blocker extension" → Instantly applies code changes
|
|
180
|
+
|
|
181
|
+
#### 3. `inspect_service_worker` - Debug Integration
|
|
182
|
+
- **Purpose**: Deep debugging of extension background processes
|
|
183
|
+
- **Technical**: Opens DevTools for service workers, supports Manifest V2/V3 architectures
|
|
184
|
+
- **Output**: Direct DevTools access to extension console, network, sources
|
|
185
|
+
- **Use Case**: "Debug why my content script isn't working" → Opens debugging interface
|
|
186
|
+
|
|
187
|
+
### Automation Tools
|
|
188
|
+
|
|
189
|
+
#### Web Store Submission (`submit_to_webstore`)
|
|
190
|
+
**Comprehensive submission automation including:**
|
|
191
|
+
|
|
192
|
+
1. **Manifest Validation**
|
|
193
|
+
- Manifest V3 compliance checking
|
|
194
|
+
- Permission validation and security warnings
|
|
195
|
+
- File structure verification
|
|
196
|
+
|
|
197
|
+
2. **Package Creation**
|
|
198
|
+
- Automated ZIP generation with optimal compression
|
|
199
|
+
- Exclusion of development files (`node_modules`, `.git`, tests)
|
|
200
|
+
- Size optimization for Web Store limits
|
|
201
|
+
|
|
202
|
+
3. **Store Listing Generation**
|
|
203
|
+
- Auto-generated descriptions based on manifest permissions
|
|
204
|
+
- Category suggestions based on functionality
|
|
205
|
+
- SEO-optimized content structure
|
|
206
|
+
|
|
207
|
+
4. **Browser Automation**
|
|
208
|
+
- Automated login flow handling
|
|
209
|
+
- Form field population from manifest data
|
|
210
|
+
- File upload automation
|
|
211
|
+
- Error detection and reporting
|
|
212
|
+
|
|
213
|
+
#### Screenshot Generation (`generate_extension_screenshots`)
|
|
214
|
+
**Multi-format screenshot creation:**
|
|
215
|
+
|
|
216
|
+
- **Primary Screenshots**: 1280x800 (Web Store requirement)
|
|
217
|
+
- **Promotional Tiles**:
|
|
218
|
+
- Small: 440x280
|
|
219
|
+
- Large: 920x680
|
|
220
|
+
- Marquee: 1400x560
|
|
221
|
+
- **Automated Capture**: Extension popup, options page, in-context usage
|
|
222
|
+
- **Smart Navigation**: Tests extension across multiple websites
|
|
223
|
+
|
|
224
|
+
### Manifest Validation System
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
interface ManifestValidation {
|
|
228
|
+
required: string[]; // name, version, manifest_version
|
|
229
|
+
warnings: string[]; // description length, icon sizes
|
|
230
|
+
security: string[]; // dangerous permissions analysis
|
|
231
|
+
suggestions: string[]; // optimization recommendations
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Validation Features:**
|
|
236
|
+
- Manifest V3 compliance enforcement
|
|
237
|
+
- Permission analysis with security implications
|
|
238
|
+
- Icon size recommendations
|
|
239
|
+
- Service worker file verification
|
|
240
|
+
- Host permission optimization suggestions
|
|
70
241
|
|
|
71
|
-
Tell your AI: "List all my Chrome extensions"
|
|
72
242
|
|
|
73
243
|
## Features
|
|
74
244
|
|
|
75
|
-
|
|
76
|
-
- **
|
|
77
|
-
- **
|
|
78
|
-
- **
|
|
79
|
-
- **
|
|
245
|
+
### 🧩 Extension Development
|
|
246
|
+
- **Live Development**: Load and reload extensions during development
|
|
247
|
+
- **Debug Integration**: Service worker and background script debugging
|
|
248
|
+
- **Manifest Analysis**: V3 compliance checking and optimization
|
|
249
|
+
- **Error Detection**: Real-time extension error monitoring
|
|
250
|
+
|
|
251
|
+
### 🏪 Web Store Automation
|
|
252
|
+
- **Automated Submission**: End-to-end publishing workflow
|
|
253
|
+
- **Screenshot Generation**: Multi-size promotional images
|
|
254
|
+
- **Listing Optimization**: AI-generated store descriptions
|
|
255
|
+
- **Compliance Checking**: Web Store policy validation
|
|
256
|
+
|
|
257
|
+
### 🔧 Browser Control
|
|
258
|
+
- **Extension-Aware Navigation**: Understands extension contexts
|
|
259
|
+
- **Permission Testing**: Validate extension permissions in real scenarios
|
|
260
|
+
- **Cross-Origin Testing**: Test extensions across different domains
|
|
261
|
+
- **Performance Analysis**: Extension impact measurement
|
|
262
|
+
|
|
263
|
+
### 🔍 Advanced Debugging
|
|
264
|
+
- **Console Integration**: Extension console log aggregation
|
|
265
|
+
- **Network Monitoring**: Extension-specific request tracking
|
|
266
|
+
- **Storage Analysis**: Extension storage (local, sync, session) inspection
|
|
267
|
+
- **Message Passing**: Inter-component communication debugging
|
|
268
|
+
|
|
269
|
+
## Developer Information
|
|
270
|
+
|
|
271
|
+
### Supported Extension Types
|
|
272
|
+
- **Manifest V3**: Full support (recommended)
|
|
273
|
+
- **Service Workers**: Background script debugging
|
|
274
|
+
- **Content Scripts**: Page interaction testing
|
|
275
|
+
- **Popup Extensions**: UI testing and screenshots
|
|
276
|
+
- **Options Pages**: Settings interface validation
|
|
277
|
+
|
|
278
|
+
### Browser Compatibility
|
|
279
|
+
- **Chrome**: Primary target (latest stable)
|
|
280
|
+
- **Chrome Canary**: Development testing
|
|
281
|
+
- **Chromium**: Community builds
|
|
282
|
+
- **Edge**: Chromium-based versions
|
|
283
|
+
|
|
284
|
+
### Development Workflow Integration
|
|
285
|
+
```bash
|
|
286
|
+
# Typical AI-assisted development flow:
|
|
287
|
+
1. "Create a Chrome extension that blocks ads"
|
|
288
|
+
2. "Test the extension on youtube.com"
|
|
289
|
+
3. "Debug why the content script isn't working"
|
|
290
|
+
4. "Generate screenshots for the Web Store"
|
|
291
|
+
5. "Submit the extension to Chrome Web Store"
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Technical Requirements
|
|
295
|
+
- **Node.js**: 22.12.0+ (for latest Chrome DevTools Protocol)
|
|
296
|
+
- **Chrome**: Any version with extension support
|
|
297
|
+
- **Storage**: ~50MB for dependencies and Chrome profile
|
|
298
|
+
- **Network**: Required for Web Store automation
|
|
299
|
+
|
|
300
|
+
### Extension Loading Capabilities
|
|
301
|
+
- **Development Extensions**: Unpacked extensions from filesystem
|
|
302
|
+
- **Dynamic Loading**: Runtime extension installation
|
|
303
|
+
- **Hot Reloading**: Instant updates during development
|
|
304
|
+
- **Multi-Extension**: Support for multiple extensions simultaneously
|
|
305
|
+
|
|
306
|
+
### Security Considerations
|
|
307
|
+
- **Isolated Profiles**: Optional temporary Chrome profiles
|
|
308
|
+
- **Permission Scoping**: Extension permissions are sandboxed
|
|
309
|
+
- **Secure Storage**: No sensitive data persistence
|
|
310
|
+
- **Web Store Auth**: Uses standard Google OAuth flow
|
|
80
311
|
|
|
81
312
|
---
|
|
82
313
|
|
|
83
314
|
# 日本語 / Japanese
|
|
84
315
|
|
|
85
|
-
**
|
|
316
|
+
**Chrome 拡張機能開発用の MCP サーバー**
|
|
86
317
|
|
|
87
318
|
## クイックスタート
|
|
88
319
|
|
package/build/src/cli.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import fs from 'node:fs';
|
|
7
6
|
import os from 'node:os';
|
|
8
7
|
import path from 'node:path';
|
|
9
8
|
import yargs from 'yargs';
|
|
@@ -13,35 +12,8 @@ function getDefaultUserDataDir() {
|
|
|
13
12
|
return path.join(os.homedir(), '.cache', 'chrome-devtools-mcp', 'chrome-profile');
|
|
14
13
|
}
|
|
15
14
|
function getDefaultExtensionsDir() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Check if extensions directory exists and has valid extensions
|
|
19
|
-
if (fs.existsSync(extensionsDir)) {
|
|
20
|
-
try {
|
|
21
|
-
const entries = fs.readdirSync(extensionsDir, { withFileTypes: true });
|
|
22
|
-
const hasValidExtensions = entries.some(entry => {
|
|
23
|
-
if (entry.isDirectory()) {
|
|
24
|
-
const manifestPath = path.join(extensionsDir, entry.name, 'manifest.json');
|
|
25
|
-
if (fs.existsSync(manifestPath)) {
|
|
26
|
-
try {
|
|
27
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
28
|
-
return manifest.manifest_version;
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
});
|
|
37
|
-
if (hasValidExtensions) {
|
|
38
|
-
return extensionsDir;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
// Ignore errors and return undefined
|
|
43
|
-
}
|
|
44
|
-
}
|
|
15
|
+
// Disabled automatic detection of ./extensions folder
|
|
16
|
+
// Users should explicitly use --loadExtension or --loadExtensionsDir flags
|
|
45
17
|
return undefined;
|
|
46
18
|
}
|
|
47
19
|
export const cliOptions = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp-for-extension",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Chrome extension development
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "MCP server for Chrome extension development with Web Store automation. Fork of chrome-devtools-mcp with extension-specific tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./build/src/index.js",
|
|
7
7
|
"main": "index.js",
|