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.
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
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go