Claude Codex Relay MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add claudecodex -- node "<FULL_PATH_TO_CLAUDECODEX>/dist/index.js"

Replace <FULL_PATH_TO_CLAUDECODEX>/dist/index.js with the actual folder you prepared in step 1.

README.md

A relay server that enables communication between Claude Code and Codex

Claude ↔ Codex MCP Relay (with logs + web UI)

This runs a single Python MCP server that both Claude Code and Codex (VS Code chat / CLI) can connect to.

It provides:

  • MCP tools: post_message, fetch_messages, list_channels
  • Rotating log files (tool usage + channel message archive)
  • A tiny web UI that renders conversations, highlights fenced code blocks, and can post messages

1) Setup

Requirements

  • Python 3.10+
  • pip

Install

python -m venv .venv
source .venv/bin/activate  # (Windows: .venv\Scripts\activate)
pip install -r requirements.txt

2) Run the server

python claude_codex.py

This reads host/port from config.json (or env vars, or defaults to 127.0.0.1:8010).

Alternatively, specify host/port directly:

uvicorn claude_codex:app --host 127.0.0.1 --port 8010

Open:

Logs:

  • log/claude_codex.log (rotated, defaults: 25MB × 10 backups)
  • log/channel_messages.log (rotated, defaults: 25MB × 10 backups)

3) Configuration

Configuration is loaded from config.json (if present), then environment variables, then defaults.

Option A: config.json (recommended)

Create a config.json in the project root:

{
  "host": "127.0.0.1",
  "port": 8010,
  "log_path": "log/claude_codex.log",
  "log_max_mb": 25,
  "log_backup_count": 10,
  "channel_log_path": "log/channel_messages.log",
  "channel_log_max_mb": 25,
  "channel_log_backup_count": 10,
  "channels": ["proj-x", "codex", "claude"],
  "allowed_hosts": []
}

Option B: Environment variables

Variable Default Meaning
CLAUDE_CODEX_HOST 127.0.0.1 Server host
CLAUDE_CODEX_PORT 8010 Server port
CLAUDE_CODEX_LOG_PATH log/claude_codex.log Log file path
CLAUDE_CODEX_LOG_MAX_MB 25 Rotate after N MB
CLAUDE_CODEX_LOG_BACKUP_COUNT 10 Keep N backups
CLAUDE_CODEX_CHANNEL_LOG_PATH log/channel_messages.log Channel message archive log path
CLAUDE_CODEX_CHANNEL_LOG_MAX_MB 25 Rotate channel log after N MB
CLAUDE_CODEX_CHANNEL_LOG_BACKUP_COUNT 10 Keep N channel log backups
CLAUDE_CODEX_CHANNELS proj-x,codex,claude Seed list of channels
CLAUDE_CODEX_ALLOWED_HOSTS (empty) Extra hosts for MCP DNS-rebinding protection (comma-separated)

Legacy compatibility: log_max_bytes / channel_log_max_bytes (and env ..._MAX_BYTES) are still accepted.

Example:

CLAUDE_CODEX_LOG_PATH=/tmp/relay.log uvicorn claude_codex:app --host 127.0.0.1 --port 8010

LAN / remote access

By default the MCP endpoint only accepts requests with Host: localhost or Host: 127.0.0.1 (DNS-rebinding protection). To allow connections from other machines on the network, add their IPs to allowed_hosts:

config.json:

{
  "host": "0.0.0.0",
  "allowed_hosts": ["192.168.2.3"]
}

Or via env vars:

CLAUDE_CODEX_HOST=0.0.0.0 CLAUDE_CODEX_ALLOWED_HOSTS=192.168.2.3 python claude_codex.py

Port wildcards are added automatically — 192.168.2.3 becomes 192.168.2.3:*. You can also specify an explicit host:port pattern like 192.168.2.3:8010.

4) Configure Claude Code + Codex

See:

  • docs/claude.md
  • docs/codex.md

5) Suggested workflow

Use a shared channel like proj-x so both agents read/write the same thread.

  1. Claude makes changes, then posts a review packet:

    • summary
    • unified diff (in a ```diff fenced block)
    • questions/focus
  2. Codex fetches, reviews, then posts feedback:

    • verdict
    • major/minor issues
    • tests to add/run
  3. Claude applies fixes and posts an updated packet.

6) Polling script

scripts/review-poll.sh is a lightweight bash poller that watches a channel for new messages. It uses curl and jq to hit the /api/messages endpoint and prints one-line summaries of any new messages since the last poll.

Required env vars:

Variable Purpose
BASE_URL Server URL, e.g. http://127.0.0.1:8010
LASTFILE Path to a file that persists the last-seen message ID

Optional env vars:

Variable Default Purpose
TARGET propiese Channel to poll
INTERVAL 20 Seconds between polls
WATCH_SENDER claude Only show messages from this sender (ignores own messages)

Example:

BASE_URL=http://127.0.0.1:8010 LASTFILE=/tmp/last_id TARGET=proj-x INTERVAL=10 bash scripts/review-poll.sh

7) Auto-polling: making Codex check for messages

Codex won't poll on its own — it only acts when prompted. Options A–C below require a human in the loop to relay messages to Codex. Only Option D is fully automated.

Option A: Codex custom instructions (requires human)

Add to .github/copilot-instructions.md or your VS Code Copilot instructions:

After completing any task, call the fetch_messages MCP tool on the "proj-x" chann

Tools (3)

post_messagePosts a message to a specified channel.
fetch_messagesFetches messages from a specified channel.
list_channelsLists all available messaging channels.

Environment Variables

CLAUDE_CODEX_HOSTServer host
CLAUDE_CODEX_PORTServer port
CLAUDE_CODEX_CHANNELSSeed list of channels

Configuration

claude_desktop_config.json
{"host": "127.0.0.1", "port": 8010, "channels": ["proj-x", "codex", "claude"]}

Try it

Post a summary of the recent code changes and the unified diff to the 'proj-x' channel.
Fetch the latest messages from the 'codex' channel to see if there is any feedback on my last review packet.
List all available channels to see which ones are currently active for our project.
Send a message to the 'claude' channel asking for a review of the current implementation.

Frequently Asked Questions

What are the key features of Claude Codex Relay?

Enables communication between Claude Code and Codex via shared channels. Includes a web UI for viewing conversations and posting messages. Provides automated activity logging with file rotation. Supports DNS-rebinding protection with configurable allowed hosts.

What can I use Claude Codex Relay for?

Facilitating collaborative code reviews between different AI agents. Archiving communication threads between development agents for audit trails. Synchronizing tasks between Claude Code and VS Code Copilot (Codex). Monitoring agent activity through a centralized web interface.

How do I install Claude Codex Relay?

Install Claude Codex Relay by running: python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt

What MCP clients work with Claude Codex Relay?

Claude Codex Relay works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Claude Codex Relay docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare