Skip to main content
Glama
Claude-Codex MCP Server
by daviiidle

Claude-Codex MCP Server

A powerful Model Context Protocol (MCP) server that enables Claude to act as the strategic brain with full granular control over code operations, quality checks, and CI/CD workflows.

Philosophy: Claude as Brain, Tools as Hands

Unlike agent-delegation models where you send a task to a black box, this MCP server gives Claude fine-grained control over every step:

  • Visibility: Claude sees results at each step

  • Control: Claude makes decisions between operations

  • Quality Gates: Lint and test checks prevent bad code from being committed

  • Security: Secret scanning and path validation protect your codebase

  • Auditability: Structured logging creates a complete audit trail

Related MCP server: Codex on Adderall

Architecture

Claude Code (Strategic Orchestrator)
    ↓
Claude-Codex MCP Server (Python)
    ├─ Repository Operations (read, search, write)
    ├─ Codex Integration (optional code generation)
    ├─ Quality Tools (lint, test)
    ├─ Artifact Tools (download, parse CI reports)
    ├─ Git Operations (status, commit, diff)
    └─ Security (secret scanning, path validation)

Features

🔍 Repository Operations

  • repo_read: Read multiple files with security validation

  • repo_search: Fast ripgrep-powered code search with regex

  • repo_write: Write files with secret scanning and path checks

🤖 Codex Integration (Optional)

  • codex_exec: Call Codex CLI for complex code generation

  • codex_get_diff: Review changes made by Codex

  • Uses your existing Codex CLI installation and authentication

✅ Quality Tools

  • quality_lint: Run linters (ruff, eslint, pylint, flake8)

  • quality_test: Run tests (pytest, jest, mocha, cargo)

  • Auto-detection of tools and frameworks

📦 Artifact Tools

  • artifact_download: Download and extract CI artifacts

  • artifact_parse_junit: Parse JUnit XML test reports

🔧 Git Operations

  • git_status: Get repo status (branch, staged, modified files)

  • git_diff: View changes

  • git_commit: Create commits

  • git_log: View commit history

🔒 Security Features

  • Secret scanning (API keys, tokens, credentials)

  • Path validation (block access to sensitive directories)

  • Configurable allowed/blocked path patterns

  • Structured audit logging

Installation

Prerequisites

Install the MCP Server

cd claude-codex-mcp
pip install -e .

Configure Environment

Copy the example environment file and customize:

cp .env.example .env

Edit .env:

# Security Configuration
ALLOWED_PATHS=src,tests,docs,examples,configs
BLOCKED_PATHS=~/.ssh,/etc,.env,.aws,~/.config

# Repository Configuration
DEFAULT_REPO_ROOT=.

# Logging Configuration
LOG_FILE=logs/bridge.jsonl
LOG_LEVEL=INFO

# Codex CLI Configuration (if using Codex integration)
CODEX_BINARY=codex
CODEX_DEFAULT_MODEL=o1
CODEX_TIMEOUT=300

Usage

Starting the MCP Server

The server uses stdio transport (standard input/output) to communicate with Claude Code:

python -m src.server

Configuring Claude Code

Add the server to your Claude Code MCP configuration:

For Claude Code CLI:

Edit ~/.config/claude-code/mcp.json (or equivalent on your system):

{
  "mcpServers": {
    "claude-codex-mcp": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/claude-codex-mcp",
      "env": {
        "REPO_ROOT": "/path/to/your/project"
      }
    }
  }
}

For Claude Desktop:

Edit your Claude Desktop MCP settings to include:

{
  "mcpServers": {
    "claude-codex-mcp": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/claude-codex-mcp",
      "env": {
        "REPO_ROOT": "/path/to/your/project"
      }
    }
  }
}

Example Workflows

Workflow 1: Find and Fix TODOs

1. Claude: "Find all TODO comments in the codebase"
   → Calls: repo_search(pattern="TODO:")

2. Claude: "Let me read these files to understand context"
   → Calls: repo_read(paths=["file1.py", "file2.py"])

3. Claude: "I'll use Codex to implement the first TODO"
   → Calls: codex_exec(instruction="Implement rate limiting at line 42")

4. Claude: "Let me review the changes"
   → Calls: codex_get_diff()

5. Claude: "Changes look good. Let me run tests"
   → Calls: quality_test(selectors=["tests/test_auth.py"])

6. Claude: "Tests pass! Committing..."
   → Calls: git_commit(message="Add rate limiting to login")

Workflow 2: Parse CI Test Failures

1. Claude: "Download the test artifacts from CI"
   → Calls: artifact_download(url="https://ci.example.com/artifacts/123.zip")

2. Claude: "Parse the JUnit reports"
   → Calls: artifact_parse_junit(glob_pattern="artifacts/**/*.xml")

3. Claude: "I see 3 tests failed. Let me read those test files"
   → Calls: repo_read(paths=["tests/test_api.py"])

4. Claude: "The issue is in the auth logic. Let me check the implementation"
   → Calls: repo_search(pattern="def authenticate")

5. Claude: "Found the bug. I'll use Codex to fix it"
   → Calls: codex_exec(instruction="Fix null pointer in authenticate function")

Tool Reference

Repository Tools

repo_read

{
  "name": "repo_read",
  "parameters": {
    "paths": ["src/file1.py", "src/file2.py"]
  }
}
{
  "name": "repo_search",
  "parameters": {
    "pattern": "TODO:|FIXME:",
    "globs": ["*.py", "*.js"]
  }
}

repo_write

{
  "name": "repo_write",
  "parameters": {
    "path": "src/new_feature.py",
    "content": "def hello():\n    print('Hello')",
    "mode": "create"
  }
}

Codex Tools

codex_exec

{
  "name": "codex_exec",
  "parameters": {
    "instruction": "Add rate limiting to the login function",
    "context_files": ["src/auth.py", "src/utils.py"],
    "model": "o1",
    "sandbox": "workspace-write"
  }
}

Quality Tools

quality_lint

{
  "name": "quality_lint",
  "parameters": {
    "globs": ["src/**/*.py"],
    "linter": "ruff"
  }
}

quality_test

{
  "name": "quality_test",
  "parameters": {
    "selectors": ["tests/test_auth.py", "tests/unit/"],
    "framework": "pytest"
  }
}

Git Tools

git_status

{
  "name": "git_status",
  "parameters": {}
}

git_commit

{
  "name": "git_commit",
  "parameters": {
    "message": "Implement rate limiting for login endpoint",
    "files": ["src/auth.py", "tests/test_auth.py"]
  }
}

Security

Path Validation

The server restricts file access to configured paths:

  • Allowed: src/, tests/, docs/, examples/, configs/

  • Blocked: ~/.ssh, /etc, .env, .aws, ~/.config, credentials.json

Configure via ALLOWED_PATHS and BLOCKED_PATHS environment variables.

Secret Scanning

Before writing any file, the server scans for:

  • AWS keys (AKIA..., aws_secret_key)

  • GitHub tokens (ghp_..., gho_...)

  • OpenAI API keys (sk-...)

  • Private keys (-----BEGIN PRIVATE KEY-----)

  • JWT tokens

  • Slack tokens

  • Stripe keys

Writes are blocked if secrets are detected.

Audit Logging

All tool calls are logged to logs/bridge.jsonl:

{
  "timestamp": "2025-10-12T10:30:45Z",
  "tool": "repo_write",
  "operation": "execute",
  "status": "success",
  "details": {
    "params": {"path": "src/auth.py", "mode": "overwrite"},
    "result_size": 1024
  }
}

Development

Running Tests

pytest tests/

Linting

ruff check src/ tests/

Project Structure

claude-codex-mcp/
├── src/
│   ├── server.py              # MCP server entry point
│   ├── tools/
│   │   ├── repo.py           # Repository operations
│   │   ├── codex.py          # Codex CLI integration
│   │   ├── quality.py        # Linting and testing
│   │   ├── artifacts.py      # CI artifact handling
│   │   ├── git_ops.py        # Git operations
│   │   └── security.py       # Secret scanning
│   └── utils/
│       ├── config.py         # Security config
│       ├── logger.py         # Structured logging
│       └── diff_tools.py     # Diff utilities
├── examples/
│   └── demo_workflow.py      # Example workflow
└── logs/
    └── bridge.jsonl          # Audit log

FAQ

Q: Do I need Codex CLI installed?

A: No, the codex_exec tool is optional. You can use all other tools without Codex. Claude is quite capable of many tasks on its own!

Q: Does this use my OpenAI/Codex account?

A: Yes, if you use the codex_exec tool, it calls your locally installed Codex CLI which uses your ChatGPT/OpenAI authentication. This counts against your API usage.

Q: How is this different from Codex's built-in MCP server?

A: Codex's MCP exposes Codex as an agent (black-box delegation). This MCP server gives Claude granular tools with full visibility and control at each step. You get quality gates, security scanning, and structured logging.

Q: Can I use both Codex's MCP and this MCP together?

A: Yes! Configure Claude Code to use both servers. Claude will choose which tools to use based on the task.

Q: How do I customize the security settings?

A: Edit the .env file to configure ALLOWED_PATHS and BLOCKED_PATHS. You can also modify src/tools/security.py to add custom secret patterns.

Contributing

Contributions welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Add tests for new functionality

  4. Ensure linting passes: ruff check src/

  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Built on the Model Context Protocol (MCP)

  • Inspired by the need for granular control in AI-assisted development

  • Thanks to Anthropic for Claude Code and the MCP specification

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to perform software-development tasks such as deep research, codebase mapping, context curation, requirements and user-story generation, full-stack starter project scaffolding, and multi-step workflow execution.
      42 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude Code to query a locally built knowledge base of a repository's git history, code structure, contracts and verified insights, and to search code, commits and discussions. It also acts as a change-safety gate, assessing blast radius and hazards before an edit and returning block/warn/pass verdicts with the tests to run after one.
      MIT