
Codex
STDIO将OpenAI Codex CLI转换为MCP服务器
将OpenAI Codex CLI转换为MCP服务器
This project wraps OpenAI's Codex CLI as an MCP (Model Context Protocol) server, making it accessible through the TeaBranch/open-responses-server middleware.
nvm install 22.15.1 | nvm use 22.15.1
) required for CodexThe setup consists of three main components:
# Clone this repository git clone https://github.com/yourusername/codex-mcp-wrapper.git cd codex-mcp-wrapper # Start the services ./start.sh
This will start:
# Install dependencies npm install # Install Codex CLI globally npm install -g @openai/codex # Start the MCP server node mcp-server.js # Install the package in development mode pip install -e .
You can run the MCP server using either stdio or SSE transport:
# Using stdio (default) python -m mcp_server # Using SSE on a specific port python -m mcp_server --transport sse --port 8000
Clones a repository, checks out a specific branch (optional), navigates to a specific folder (optional), and runs Codex with the given request.
repository
(required): Git repository URLbranch
(optional): Git branch to checkoutfolder
(optional): Folder within the repository to focus onrequest
(required): Codex request/prompt to run{ "repository": "https://github.com/username/repo.git", "branch": "main", "folder": "src", "request": "Analyze this code and suggest improvements" }
Clones a repository, reads the system prompt from .agent/system.md
, parses modelId
from .agent/agent.json
, writes the request to a .prompt
file, and invokes the Codex CLI with the extracted model.
repository
(required): Git repository URLrequest
(required): Prompt text to run through Codexfolder
(optional, default /
): Subfolder within the repository to operate in{ "repository": "https://github.com/username/repo.git", "folder": "src", "request": "Analyze this code and suggest improvements" }
Place a mcps.json
file under the .agent/
directory to register available MCP tools. Codex will load this configuration automatically.
Example .agent/mcps.json
:
{ "mcpServers": { "agentic-developer-mcp": { "url": "..." } } }
This project uses the MCP Python SDK to implement an MCP server. The primary implementation is in mcp_server/server.py
.
MIT