2.7 KiB
2.7 KiB
CLI MCP Configuration Guide
This guide explains how to configure Codex CLI and Claude Code to connect to the Chrome MCP Server.
Overview
The Chrome MCP Server exposes its MCP interface at http://127.0.0.1:12306/mcp (default port).
Both Codex CLI and Claude Code can connect to this endpoint to use Chrome browser control tools.
Codex CLI Configuration
Option 1: HTTP MCP Server (Recommended)
Add the following to your ~/.codex/config.json:
{
"mcpServers": {
"chrome-mcp": {
"url": "http://127.0.0.1:12306/mcp"
}
}
}
Option 2: Via Environment Variable
Set the MCP URL via environment variable before running codex:
export MCP_HTTP_PORT=12306
Claude Code Configuration
Option 1: HTTP MCP Server
Add the following to your ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"chrome-mcp": {
"url": "http://127.0.0.1:12306/mcp"
}
}
}
Option 2: Stdio Server (Alternative)
If you prefer stdio-based MCP communication:
{
"mcpServers": {
"chrome-mcp": {
"command": "node",
"args": ["/path/to/mcp-chrome/dist/mcp/mcp-server-stdio.js"]
}
}
}
Verifying Connection
After configuration, the CLI tools should be able to see and use Chrome MCP tools such as:
chrome_get_windows_and_tabs- Get browser window and tab informationchrome_navigate- Navigate to a URLchrome_click_element- Click on page elementschrome_get_page_content- Get page content- And more...
Troubleshooting
Connection Refused
If you get "connection refused" errors:
- Ensure the Chrome extension is installed and the native server is running
- Check that the port matches (default: 12306)
- Verify no firewall is blocking localhost connections
- Run
mcp-chrome-bridge doctorto diagnose issues
Tools Not Appearing
If MCP tools don't appear in the CLI:
- Restart the CLI tool after configuration changes
- Check the configuration file syntax (valid JSON)
- Ensure the MCP server URL is accessible
Port Conflicts
If port 12306 is already in use:
- Set a custom port in the extension settings
- Update the CLI configuration to match the new port
- Run
mcp-chrome-bridge update-port <new-port>to update the stdio config
Environment Variables
| Variable | Description | Default |
|---|---|---|
MCP_HTTP_PORT |
HTTP port for MCP server | 12306 |
MCP_ALLOWED_WORKSPACE_BASE |
Additional allowed workspace directory | (none) |
CHROME_MCP_NODE_PATH |
Override Node.js executable path | (auto) |