MCP (Model Context Protocol) server that bridges Codex CLI to OpenClaw Gateway.
Codex CLI ←MCP (stdio)→ openclaw-mcp-server ←HTTP→ OpenClaw Gateway
Codex sends messages to OpenClaw agent → agent decides which tools to use → returns result.
Available Tools:
| Tool | Description |
|---|---|
openclaw_chat |
Send message to OpenClaw assistant |
openclaw_status |
Check Gateway health |
- Node.js 20+
- OpenClaw Gateway running with chat completions enabled
Enable chat completions in OpenClaw:
openclaw config set gateway.http.endpoints.chatCompletions.enabled true
openclaw gateway restartcd /Users/zhang/.openclaw/workspace/projects/openclaw-mcp-server
npm install
npm run build# Add MCP server to Codex
codex mcp add openclaw -- node /path/to/openclaw-mcp-server/dist/index.jsOr edit ~/.codex/config.toml:
[mcp_servers.openclaw]
command = "node"
args = ["/Users/zhang/.openclaw/workspace/projects/openclaw-mcp-server/dist/index.js"]
[mcp_servers.openclaw.env]
OPENCLAW_URL = "http://127.0.0.1:18789"
OPENCLAW_GATEWAY_TOKEN = "your-gateway-token"
OPENCLAW_MODEL = "openclaw"
OPENCLAW_TIMEOUT_MS = "120000"codex mcp list
codex mcp get openclawcodex
# Then ask: "Use openclaw_chat to search for recent AI news"| Variable | Default | Description |
|---|---|---|
OPENCLAW_URL |
http://127.0.0.1:18789 |
Gateway URL |
OPENCLAW_GATEWAY_TOKEN |
- | Gateway auth token |
OPENCLAW_MODEL |
openclaw |
Model name |
OPENCLAW_TIMEOUT_MS |
120000 |
Request timeout |
npm run dev # Watch mode
npm run build # Compile- Layer 1: Delegation mode (chat completion)
- Layer 2: Direct tool calling (web_search, exec, browser, etc.)
- Async task support
- Multi-instance support
- SSE transport for remote access
- OAuth authentication
MIT