@@ -45,6 +45,8 @@ cd chrome-devtools-mcp
45
45
mcp install server.py -n " Chrome DevTools MCP" --with-editable .
46
46
```
47
47
48
+ > ** Note** : The ` mcp ` command is part of the [ Python MCP SDK] ( https://github.com/modelcontextprotocol/python-sdk ) . Install it with ` pip install mcp ` if not already available.
49
+
48
50
** All Installation Options:**
49
51
50
52
``` bash
@@ -82,37 +84,61 @@ git clone https://github.com/benjaminr/chrome-devtools-mcp.git
82
84
cd chrome-devtools-mcp
83
85
```
84
86
85
- 2 . ** Install dependencies**
87
+ 2 . ** Install dependencies with UV (creates venv) **
86
88
``` bash
87
- uv sync # or pip install -r requirements.txt
89
+ uv sync # Creates .venv and installs dependencies
88
90
```
89
91
90
- 3 . ** Add MCP server using Claude CLI**
92
+ 3 . ** Add MCP server using Claude CLI with absolute paths **
91
93
92
- ** Quick setup (recommended):**
94
+ ** IMPORTANT** : Claude Code needs absolute paths to both the Python interpreter and the server script to work correctly.
95
+
96
+ ** Recommended setup using absolute paths:**
93
97
``` bash
94
- # Add the server with environment variable
95
- claude mcp add chrome-devtools python server.py -e CHROME_DEBUG_PORT=9222
98
+ # Get the absolute paths
99
+ SERVER_PATH=" $( pwd) /server.py"
100
+ PYTHON_PATH=" $( pwd) /.venv/bin/python"
101
+
102
+ # Add the server with absolute paths
103
+ claude mcp add chrome-devtools " $PYTHON_PATH " " $SERVER_PATH " -e CHROME_DEBUG_PORT=9222
104
+ ```
105
+
106
+ ** Alternative: Using the system Python (if dependencies are installed globally):**
107
+ ``` bash
108
+ # Only if you've installed dependencies globally
109
+ claude mcp add chrome-devtools python " $( pwd) /server.py" -e CHROME_DEBUG_PORT=9222
96
110
```
97
111
98
112
** With custom scope:**
99
113
``` bash
100
114
# Add to user scope (available across all projects)
101
- claude mcp add chrome-devtools python server.py -s user -e CHROME_DEBUG_PORT=9222
115
+ claude mcp add chrome-devtools " $( pwd ) /.venv/bin/ python" " $( pwd ) / server.py" -s user -e CHROME_DEBUG_PORT=9222
102
116
103
117
# Add to project scope (only for this project)
104
- claude mcp add chrome-devtools python server.py -s project -e CHROME_DEBUG_PORT=9222
118
+ claude mcp add chrome-devtools " $( pwd ) /.venv/bin/ python" " $( pwd ) / server.py" -s project -e CHROME_DEBUG_PORT=9222
105
119
```
106
120
107
121
4 . ** Verify installation**
108
122
``` bash
109
123
# List configured MCP servers
110
124
claude mcp list
111
125
112
- # Get details about the server
126
+ # Get details about the server (check that paths are absolute)
113
127
claude mcp get chrome-devtools
128
+
129
+ # The output should show absolute paths like:
130
+ # Command: /Users/you/chrome-devtools-mcp/.venv/bin/python
131
+ # Args: ["/Users/you/chrome-devtools-mcp/server.py"]
114
132
```
115
133
134
+ ** Common Path Issues and Solutions:**
135
+ - ** Problem** : "python: command not found" or "server.py not found"
136
+ - ** Solution** : Use absolute paths as shown above
137
+ - ** Problem** : "ModuleNotFoundError" when server starts
138
+ - ** Solution** : Use the venv Python interpreter that has dependencies installed
139
+ - ** Problem** : Server doesn't start or shows as disconnected
140
+ - ** Solution** : Test the command manually: ` /path/to/.venv/bin/python /path/to/server.py `
141
+
116
142
### Option 4: Manual Claude Desktop Setup
117
143
118
144
1 . ** Clone this repository**
@@ -470,7 +496,7 @@ If the server appears in Claude but shows as "disabled", try these steps:
470
496
4 . ** Restart Claude Desktop** completely (quit and reopen)
471
497
472
498
### Installation Issues
473
- - ** MCP CLI not found** : Install MCP CLI with ` pip install mcp ` or ` npm install -g @modelcontextprotocol/cli `
499
+ - ** MCP CLI not found** : Install MCP CLI from the [ Python MCP SDK ] ( https://github.com/modelcontextprotocol/python-sdk ) with ` pip install mcp `
474
500
- ** Server not appearing in Claude** :
475
501
- For MCP CLI: Run ` mcp list ` to verify the server is installed
476
502
- For manual setup: Check Claude Desktop configuration file path and JSON syntax
@@ -520,10 +546,32 @@ claude mcp list
520
546
# Get details about a specific server
521
547
claude mcp get chrome-devtools
522
548
549
+ # IMPORTANT: Verify paths are absolute, not relative
550
+ # Good example output:
551
+ # Command: /Users/you/chrome-devtools-mcp/.venv/bin/python
552
+ # Args: ["/Users/you/chrome-devtools-mcp/server.py"]
553
+ # Bad example output:
554
+ # Command: python
555
+ # Args: ["server.py"]
556
+
557
+ # Test the exact command Claude Code will use
558
+ /path/to/.venv/bin/python /path/to/server.py
559
+
523
560
# Check if server is working
524
561
claude mcp serve --help
525
562
```
526
563
564
+ ** Step 3.5: Fix Path Issues (Claude Code specific)**
565
+ ``` bash
566
+ # If paths are relative, remove and re-add with absolute paths
567
+ claude mcp remove chrome-devtools
568
+
569
+ # Re-add with absolute paths
570
+ SERVER_PATH=" $( pwd) /server.py"
571
+ PYTHON_PATH=" $( pwd) /.venv/bin/python"
572
+ claude mcp add chrome-devtools " $PYTHON_PATH " " $SERVER_PATH " -e CHROME_DEBUG_PORT=9222
573
+ ```
574
+
527
575
** Step 4: Reinstall if Needed**
528
576
529
577
** For MCP CLI:**
@@ -554,6 +602,9 @@ claude mcp add chrome-devtools python server.py -s user -e CHROME_DEBUG_PORT=922
554
602
| "Import error" | Check ` pip install mcp websockets aiohttp ` |
555
603
| "Permission denied" | Use absolute paths in config |
556
604
| "Server disabled" | Check Claude Desktop logs, restart Claude |
605
+ | "python: command not found" (Claude Code) | Use absolute path to venv Python: ` /path/to/.venv/bin/python ` |
606
+ | "server.py: No such file" (Claude Code) | Use absolute path to server: ` /path/to/server.py ` |
607
+ | "ModuleNotFoundError" (Claude Code) | Use venv Python that has dependencies installed |
557
608
558
609
### Manual Configuration Fallback
559
610
@@ -575,22 +626,37 @@ If MCP CLI isn't working, add this to Claude Desktop config manually:
575
626
```
576
627
577
628
** For Claude Code:**
578
- If the ` claude mcp add ` command isn't working, you can use the JSON format:
629
+ If the ` claude mcp add ` command isn't working, you can use the JSON format with absolute paths :
579
630
580
631
``` bash
581
- # Add server using JSON configuration
582
- claude mcp add-json chrome-devtools ' {
583
- "command": "python3",
584
- "args": ["' $( pwd) ' /server.py"],
585
- "env": {
586
- "CHROME_DEBUG_PORT": "9222"
632
+ # Get absolute paths first
633
+ SERVER_PATH=" $( pwd) /server.py"
634
+ PYTHON_PATH=" $( pwd) /.venv/bin/python"
635
+
636
+ # Add server using JSON configuration with absolute paths
637
+ claude mcp add-json chrome-devtools " {
638
+ \" command\" : \" $PYTHON_PATH \" ,
639
+ \" args\" : [\" $SERVER_PATH \" ],
640
+ \" env\" : {
641
+ \" CHROME_DEBUG_PORT\" : \" 9222\"
587
642
}
588
- }'
643
+ }"
589
644
590
- # Or import from Claude Desktop if you have it configured there
645
+ # Or if you have it working in Claude Desktop, import from there
591
646
claude mcp add-from-claude-desktop
592
647
```
593
648
649
+ ** Example of correct Claude Code configuration (with absolute paths):**
650
+ ``` json
651
+ {
652
+ "command" : " /Users/you/chrome-devtools-mcp/.venv/bin/python" ,
653
+ "args" : [" /Users/you/chrome-devtools-mcp/server.py" ],
654
+ "env" : {
655
+ "CHROME_DEBUG_PORT" : " 9222"
656
+ }
657
+ }
658
+ ```
659
+
594
660
### Connection Issues
595
661
- ** Chrome won't start** : The MCP server will start Chrome automatically when you use ` start_chrome() `
596
662
- ** Can't connect** : Try ` get_connection_status() ` to check the connection
0 commit comments