Get the FREE Ultimate OpenClaw Setup Guide →

codex -go

codex-mcp-go is a Go-based MCP (Model Context Protocol) server that serves as a bridge for Codex CLI, enabling various AI coding assistants (such as Claude Code, Roo Code, KiloCode, etc.) to seamlessly collaborate with Codex.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio w31r4-codex-mcp-go npx -y @zenfun510/codex-mcp-go \
  --env OPENAI_API_KEY="your-api-key"

How to use

codex-mcp-go is an MCP server that wraps OpenAI's Codex CLI to expose Codex as an MCP tool accessible from any MCP-compatible client (e.g., Claude Code, Roo Code, KiloCode, Cursor). It supports session-based multi-turn interactions, sandboxing policies to control file and workspace access, and concurrent handling for multiple clients via Go routines. Clients can enumerate available tools, which include the codex command set exposed by the MCP server, and invoke them through the MCP protocol. Use this server to delegate complex coding tasks to Codex while maintaining context and safety boundaries across multi-step tasks.

How to install

Prerequisites:\n- You need a working OpenAI Codex CLI installation and configuration. Install codex CLI with npm (recommended):\nbash\nnpm i -g @openai/codex\n\n- A Go 1.24+ environment if you plan to build from source:\nbash\n# example: clone and build the binary\ngit clone https://github.com/w31r4/codex-mcp-go.git\ncd codex-mcp-go\ngo build -o codex-mcp-go cmd/server/main.go\n\n\nInstallation options:\n1) Run via npx (recommended, no Go install required):\nbash\nnpx -y @zenfun510/codex-mcp-go\n\n2) Download prebuilt binaries from the Releases page and run directly:\nbash\n# download the appropriate binary for your platform, then\n./codex-mcp-go\n\n3) Build from source (needs Go 1.24+):\nbash\ngit clone https://github.com/w31r4/codex-mcp-go.git\ncd codex-mcp-go\ngo build -o codex-mcp-go cmd/server/main.go\n

Additional notes

Tips and notes:\n- The MCP server relies on the Codex CLI; ensure Codex is installed and accessible in your PATH when using the npx approach.\n- You can configure the server with a TOML config or environment variables to control timeouts, sandbox modes, allowed models, and logging. Example environment variables include OPENAI_API_KEY, CODEX_DEFAULT_SANDBOX, CODEX_ALLOWED_MODELS, CODEX_LOG_LEVEL, etc.\n- For security, prefer sandbox read-only mode by default and only enable workspace-write when needed. The system supports session IDs (SESSION_ID) to maintain multi-turn conversations across calls.\n- If using the npx approach, you do not need to install Go locally; if you need a local binary, point your MCP client to the binary path (e.g., /path/to/codex-mcp-go) as shown in the JSON configuration example.\n- The MCP tools list will present available operations exposed by the server; verify that initialize occurs before calling tools/list.\n- When using in IDEs or editors, you can embed the server configuration into your MCP settings (e.g., in Roo Code, Cursor, or KiloCode) to streamline workflow.

Related MCP Servers

Sponsor this space

Reach thousands of developers