Content
# Tool List
## Overview
MCP Server on Rust, which combines browser-based ChatGPT and full-fledged repository work. Manages headless Chrome via Chrome DevTools Protocol (CDP) for access to ChatGPT. Provides 16 MCP tools: ChatGPT bridge, filesystem, git, bash, handoff, skills. Includes OpenAI-compatible HTTP provider.
## Architecture
```
┌─────────────┐ stdio (MCP) ┌──────────────────────┐ CDP WebSocket ┌─────────────────────┐
│ OpenCode │ ──────────────────> │ CodexDCP │ <────────────────> │ Headless Chrome │
│ (MCP client) │ │ (Rust MCP server) │ Runtime.evaluate │ (Brave/Chromium) │
└─────────────┘ └──────────────────────┘ └─────────────────────┘
│ │
┌─────────────────────┼─────────────────────┐ │ DOM
│ │ HTTP (OpenAI API) │ ▼
│ ▼ │ ┌─────────────────────┐
┌──────────────┐ ┌──────────────────────┐ │ │ chatgpt.com │
│ FS / Git / │ │ HTTP provider :8766 │────────┘ └─────────────────────┘
│ Bash / Skill │ │ /v1/chat/completions │
└──────────────┘ └──────────────────────┘
```
- **Rust MCP server** — 16 tools via stdio: ChatGPT bridge + filesystem + git + bash + handoff + skills
- **CDP bridge** — launches headless Chrome, connects via DevTools Protocol, executes JS via `Runtime.evaluate`
- **HTTP provider** — OpenAI-compatible API on port 8766 (`/v1/chat/completions`, `/v1/models`, `/health`), supports streaming (SSE)
- **Workspace tools** — direct work with files, git, shell commands in working directory (without Chrome)
## Capabilities
### ChatGPT bridge
- **Headless Chrome** — browser runs in background, doesn't distract user
- **Temporary chat** — all requests go to temporary chat via `?temporary-chat=true` (history not saved)
- **Cookie reuse** — Brave/Chrome profile copied once, no login required
- **Anti-detection** — `--disable-blink-features=AutomationControlled` bypasses Cloudflare
- **Model selection** — pass `model: "GPT-4o"`, `"o1"`, etc.
- **Markdown saving** — answers save code blocks, headers, links, tables
- **Streaming** — partial answers via SSE for HTTP provider
- **Retries with backoff** — automatic retry on temporary errors
- **Bridge readiness** — MCP tool calls wait for bridge readiness (up to 60 sec) instead of immediate timeout
### Workspace tools (hybrid mode)
- **Filesystem** — `read_file`, `write_file`, `edit_file`, `tree` with path containment check
- **Search** — `search_files` via ripgrep (with grep fallback)
- **Bash** — `bash` with safe allowlist (blocks rm -rf, git push, curl, sudo)
- **Git** — `git_status`, `git_diff`, `show_changes`
- **Handoff** — `.ai-bridge/` with plans for Codex/OpenCode/Pi (`read_handoff`, `handoff_to_agent`)
- **Skills** — discovery and loading of `SKILL.md` files (`load_skill`, `list_skills`)
- **Context** — `codex_context` (AGENTS.md chain + git state), `export_pro_context`
- **Tiered tool surface** — `--tool-mode minimal|standard|full` manages available tools
- **Security** — blocked globs (.git, .env, *.pem, *.key), write mode toggle, bash allowlist
## Requirements
- Rust >= 1.85 (edition 2024; tested on 1.96)
- Chrome, Brave or Chromium browser
- ChatGPT account (active session in browser for cookie copying)
- OpenCode with MCP support
## Installation
### Step 1. Get binary
**Option A — from sources:**
```bash
git clone https://github.com/DurkaEbanaya/codexdcp.git
cd codexdcp
cargo build --release
# Binary: target/release/codexdcp
```
**Option B — pre-built:**
Download from [Releases](https://github.com/DurkaEbanaya/codexdcp/releases).
### Step 2. Copy cookies from browser
CodexDCP uses a separate Chrome profile, which requires copying cookies from your browser:
```bash
# Create profile
mkdir -p ~/.codexdcp/chrome-profile/Default
# Copy cookies and localStorage from Brave
BRAVE="$HOME/Library/Application Support/BraveSoftware/Brave-Browser/Default"
cp "$BRAVE/Cookies" ~/.codexdcp/chrome-profile/Default/
cp "$BRAVE/Login Data" ~/.codexdcp/chrome-profile/Default/ 2>/dev/null
cp -r "$BRAVE/Local Storage" ~/.codexdcp/chrome-profile/Default/ 2>/dev/null
cp "$BRAVE/Preferences" ~/.codexdcp/chrome-profile/Default/ 2>/dev/null
# For Chrome instead of Brave:
# CHROME="$HOME/Library/Application Support/Google/Chrome/Default"
```
Alternative — run once with `--visible`, log in manually, and close:
```bash
./target/release/codexdcp --visible --chrome-path "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
```
### Step 3. Configure OpenCode
Add server to `~/.config/opencode/opencode.jsonc`:
```jsonc
{
// IMPORTANT: mcp_timeout should be sufficiently large (120000 ms = 2 min).
// ChatGPT tool calls require 30-90 seconds: Chrome loading (~15 sec) +
// navigation to temp chat (~10 sec) + model response (~10-60 sec).
// Without this setting, OpenCode uses default timeout (5 sec)
// and tool calls fail with "MCP error -32001: Request timed out".
// Filesystem/git/bash tools respond instantly — 120 sec is max, not min.
"experimental": {
"mcp_timeout": 120000
},
"mcp": {
"chatgpt-codex": {
"type": "local",
"command": [
"/ABSOLUTE/PATH/TO/codexdcp",
"--http-port", "8766",
"--cdp-port", "9222",
"--chrome-path", "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
],
"enabled": true
}
}
}
```
Specify browser path via `--chrome-path`. If not specified, binary attempts to auto-detect.
### Step 4. (Optional) Connect as model provider
```jsonc
{
"provider": {
"chatgpt-browser": {
"npm": "@ai-sdk/openai-compatible",
"name": "ChatGPT (Browser)",
"options": {
"baseURL": "http://127.0.0.1:8766/v1"
},
"models": {
"gpt-4o": { "name": "GPT-4o" },
"o1": { "name": "o1" },
"gpt-4o-mini": { "name": "GPT-4o mini" }
}
}
}
}
```
### Step 5. (Optional) Slash commands
```jsonc
{
"command": {
"навайбкодь": {
"description": "Delegate code task to ChatGPT",
"template": "Use the chatgpt_coder MCP tool to delegate: $ARGUMENTS"
},
"спроси": {
"description": "Ask ChatGPT a question",
"template": "Use the chatgpt_ask MCP tool to ask: $ARGUMENTS"
}
}
}
```
## MCP Tools
### ChatGPT bridge (always available)
| Tool | Description | Parameters |
|---|---|---|
| `chatgpt_coder` | Delegate code task (Codex-style) | `task`, `context`, `language`, `model`, `format` |
| `chatgpt_ask` | Ask general question | `prompt`, `model`, `format` |
### Filesystem (minimal+)
| Tool | Description | Parameters |
|---|---|---|
| `read_file` | Read file with line numbers | `path`, `offset`, `limit` |
| `write_file` | Create/overwrite file | `path`, `content` |
| `edit_file` | Exact string replacement in file | `path`, `old_string`, `new_string` |
| `tree` | Directory tree | `path`, `max_depth` |
| `bash` | Shell command (safe allowlist) | `command` |
### Search (standard+)
| Tool | Description | Parameters |
|---|---|---|
| `search_files` | Regex search via ripgrep/grep | `pattern`, `path`, `include` |
### Git (standard+)
| Tool | Description | Parameters |
|---|---|---|
| `git_status` | Git status (short format) | — |
| `git_diff` | Git diff (--stat) | `staged` |
| `show_changes` | Summary of all changes | — |
### Skills (standard+)
| Tool | Description | Parameters |
|---|---|---|
| `load_skill` | Load SKILL.md by name | `name` |
| `list_skills` | List all skills | — |
### Handoff (standard+)
| Tool | Description | Parameters |
|---|---|---|
| `read_handoff` | Read `.ai-bridge/` directory | — |
| `handoff_to_agent` | Write plan for agent | `plan`, `agent`, `model` |
### Context (full only)
| Tool | Description | Parameters |
|---|---|---|
| `codex_context` | AGENTS.md chain + git state | — |
| `export_pro_context` | Export context to `.ai-bridge/pro-context.md` | — |
### Tool modes (`--tool-mode`)
| Mode | Tools |
|---|---|
| `minimal` | ChatGPT + filesystem + bash |
| `standard` | + search, git, skills, handoff |
| `full` | + context tools |
## HTTP API
### Ordinary Request
```bash
curl http://127.0.0.1:8766/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Write fizzbuzz on Rust"}
]
}'
```
### Streaming (SSE)
```bash
curl http://127.0.0.1:8766/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"stream": true,
"messages": [
{"role": "user", "content": "Write haiku about compiler"}
]
}'
```
### Health
```bash
curl http://127.0.0.1:8766/health
# → {"status":"ok","connected":true,"mode":"temporary_chat"}
```
## CLI Flags
```
--http-host 127.0.0.1 HTTP provider host
--http-port 0 HTTP port (0 = disabled)
--default-timeout 120 ChatGPT response timeout (sec)
--system-prompt - Custom system prompt
--max-retries 3 Number of retries
--retry-delay-ms 2000 Initial retry delay (ms)
--chrome-path - Path to Chrome/Brave/Chromium
--chrome-profile ~/.codexdcp/chrome-profile Path to user-data-dir
--headless true Headless Chrome mode
--cdp-port 9222 DevTools Protocol port
--visible Launch Chrome with visible window (for login)
--selectors-path - Path to custom selectors
--log-level info Logging level
--http-only HTTP provider only (without MCP stdio)
--root CWD Workspace root for filesystem/git/bash
--tool-mode standard minimal | standard | full
--bash-mode safe safe | off | full
--write-mode workspace workspace | off
```
All flags are also available as env-variables (`CODEXDCP_*` or `CHATGPT_BRIDGE_*`).
## Security
- **Path containment** — all paths are checked relative to workspace root; escaping is blocked
- **Blocked globs** — `.git/`, `.env`, `*.pem`, `*.key`, etc. are not accessible for read/write
- **Bash allowlist** — in safe mode (default) only build/test/lint/git-inspect commands are executed; `rm -rf`, `git push`, `curl`, `sudo`, etc. are blocked
- **Write mode** — `--write-mode off` switches all tools to read-only
- **DOM selectors** — ChatGPT DOM may change, selectors are updated in `src/js.rs` (`DEFAULT_SELECTORS`), overridable via `--selectors-path`
- **Chrome profile** — contains cookies with access to ChatGPT. Don't commit `~/.codexdcp/chrome-profile/`
- **Terms of Service** — automating ChatGPT web interface may violate OpenAI ToS. Use at your own risk
## Debugging
- Binary with debug logs: `codexdcp --log-level debug`
- Visible Chrome for debugging: `codexdcp --visible --log-level debug`
- HTTP only (without MCP): `codexdcp --http-only --http-port 8766 --log-level debug`
- Check CDP: `curl http://127.0.0.1:9222/json/version`
- Check HTTP: `curl http://127.0.0.1:8766/health`
- Chrome logs are inherited in stderr of codexdcp
## Development
```bash
cargo build --release # build
cargo test # tests
cargo clippy --tests -- -D warnings # linter
cargo run -- --help # help
cargo run -- --visible --log-level debug # launch with visible Chrome
```
## License
MIT
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available