puppeteer-mcp-claude 0.1.2 → 0.1.4
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 +9 -3
- package/bin/cli.js +40 -23
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -4,7 +4,13 @@ A Model Context Protocol (MCP) server that provides Claude Code with comprehensi
|
|
|
4
4
|
|
|
5
5
|
## 🚀 Quick Start
|
|
6
6
|
|
|
7
|
-
**Want browser automation in Claude
|
|
7
|
+
**Want browser automation in Claude Code? Run this one command:**
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
claude mcp add puppeteer-mcp-claude
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Alternative - works for both Claude Desktop & Claude Code:**
|
|
8
14
|
|
|
9
15
|
```bash
|
|
10
16
|
npx puppeteer-mcp-claude install
|
|
@@ -124,9 +130,9 @@ For development or contribution:
|
|
|
124
130
|
|
|
125
131
|
## Alternative Installation Methods
|
|
126
132
|
|
|
127
|
-
### Method 1: Using Claude Code MCP Command
|
|
133
|
+
### Method 1: Using Claude Code MCP Command (Recommended)
|
|
128
134
|
|
|
129
|
-
|
|
135
|
+
Configure this server using Claude Code's built-in MCP management:
|
|
130
136
|
|
|
131
137
|
```bash
|
|
132
138
|
claude mcp add puppeteer-mcp-claude
|
package/bin/cli.js
CHANGED
|
@@ -138,14 +138,25 @@ class PuppeteerMCPInstaller {
|
|
|
138
138
|
async installForConfig(config) {
|
|
139
139
|
console.log(`📝 Configuring ${config.name}...`);
|
|
140
140
|
|
|
141
|
-
//
|
|
141
|
+
// Use claude mcp add for Claude Code
|
|
142
|
+
if (config.type === 'code') {
|
|
143
|
+
console.log('🔧 Using claude mcp add command...');
|
|
144
|
+
const cliPath = join(this.packageDir, 'bin', 'cli.js');
|
|
145
|
+
execSync(`claude mcp add ${this.serverName} "node ${cliPath} serve"`, {
|
|
146
|
+
stdio: 'inherit',
|
|
147
|
+
cwd: this.packageDir
|
|
148
|
+
});
|
|
149
|
+
console.log(`✅ Successfully added via claude mcp add`);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Manual configuration for Claude Desktop
|
|
142
154
|
const configDir = path.dirname(config.path);
|
|
143
155
|
if (!existsSync(configDir)) {
|
|
144
156
|
console.log(`📁 Creating directory: ${configDir}`);
|
|
145
157
|
mkdirSync(configDir, { recursive: true });
|
|
146
158
|
}
|
|
147
159
|
|
|
148
|
-
// Read or create config
|
|
149
160
|
let claudeConfig = {};
|
|
150
161
|
let hasExistingConfig = false;
|
|
151
162
|
|
|
@@ -161,26 +172,23 @@ class PuppeteerMCPInstaller {
|
|
|
161
172
|
}
|
|
162
173
|
}
|
|
163
174
|
|
|
164
|
-
// Initialize mcpServers if it doesn't exist
|
|
165
175
|
if (!claudeConfig.mcpServers) {
|
|
166
176
|
claudeConfig.mcpServers = {};
|
|
167
177
|
}
|
|
168
178
|
|
|
169
|
-
// Check if our server already exists
|
|
170
179
|
if (claudeConfig.mcpServers[this.serverName]) {
|
|
171
180
|
console.log(`⚠️ Puppeteer MCP already configured, updating...`);
|
|
172
181
|
}
|
|
173
182
|
|
|
174
|
-
// Add/update our MCP server configuration
|
|
175
183
|
claudeConfig.mcpServers[this.serverName] = {
|
|
176
|
-
command: '
|
|
177
|
-
args: ['
|
|
184
|
+
command: 'node',
|
|
185
|
+
args: [join(this.packageDir, 'dist', 'index.js')],
|
|
186
|
+
cwd: this.packageDir,
|
|
178
187
|
env: {
|
|
179
188
|
NODE_ENV: 'production'
|
|
180
189
|
}
|
|
181
190
|
};
|
|
182
191
|
|
|
183
|
-
// Write the updated configuration
|
|
184
192
|
writeFileSync(config.path, JSON.stringify(claudeConfig, null, 2));
|
|
185
193
|
|
|
186
194
|
if (hasExistingConfig) {
|
|
@@ -189,7 +197,6 @@ class PuppeteerMCPInstaller {
|
|
|
189
197
|
console.log(`✅ Configuration created: ${config.path}`);
|
|
190
198
|
}
|
|
191
199
|
|
|
192
|
-
// Verify the installation
|
|
193
200
|
await this.verifyInstallationForConfig(config, claudeConfig);
|
|
194
201
|
}
|
|
195
202
|
|
|
@@ -197,21 +204,31 @@ class PuppeteerMCPInstaller {
|
|
|
197
204
|
console.log(`🔍 Verifying ${config.name} installation...`);
|
|
198
205
|
|
|
199
206
|
try {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
// If claude mcp add was used, the configuration might not be in the expected format
|
|
208
|
+
// So we'll read the config file again to verify
|
|
209
|
+
if (existsSync(config.path)) {
|
|
210
|
+
const configContent = readFileSync(config.path, 'utf8');
|
|
211
|
+
const currentConfig = JSON.parse(configContent);
|
|
212
|
+
|
|
213
|
+
if (currentConfig.mcpServers?.[this.serverName]) {
|
|
214
|
+
const serverConfig = currentConfig.mcpServers[this.serverName];
|
|
215
|
+
|
|
216
|
+
if (!serverConfig.command || !serverConfig.args) {
|
|
217
|
+
throw new Error('Incomplete MCP server configuration');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Verify either npx or node command structure
|
|
221
|
+
if ((serverConfig.command === 'npx' && serverConfig.args[0] === 'puppeteer-mcp-claude') ||
|
|
222
|
+
(serverConfig.command === 'node' && serverConfig.args[0].includes('dist/index.js'))) {
|
|
223
|
+
console.log(`✅ ${config.name} configuration verified`);
|
|
224
|
+
} else {
|
|
225
|
+
console.log(`✅ ${config.name} configuration verified (custom format)`);
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
throw new Error(`${this.serverName} not found in configuration`);
|
|
229
|
+
}
|
|
213
230
|
} else {
|
|
214
|
-
throw new Error('
|
|
231
|
+
throw new Error('Configuration file not found');
|
|
215
232
|
}
|
|
216
233
|
|
|
217
234
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "puppeteer-mcp-claude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"puppeteer-mcp-claude": "./bin/cli.js"
|
|
@@ -26,7 +26,13 @@
|
|
|
26
26
|
"prepublishOnly": "npm run build",
|
|
27
27
|
"prepack": "npm run build"
|
|
28
28
|
},
|
|
29
|
-
"keywords": [
|
|
29
|
+
"keywords": [
|
|
30
|
+
"mcp",
|
|
31
|
+
"puppeteer",
|
|
32
|
+
"claude",
|
|
33
|
+
"browser-automation",
|
|
34
|
+
"model-context-protocol"
|
|
35
|
+
],
|
|
30
36
|
"author": "jaenster",
|
|
31
37
|
"repository": {
|
|
32
38
|
"type": "git",
|