
kky42/codex-as-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
kky42/codex-as-mcp は、https://github.com/kky42/codex-as-mcp. からインポートされた MCP サーバー候補です。
概要
kky42/codex-as-mcp は、https://github.com/kky42/codex-as-mcp. からインポートされた MCP サーバー候補です。
概要(AI 翻訳)
中文版
codex-as-mcpは、MCPクライアント(Claude Code、カーソルなど)が Codex CLI に作業を委任できる小型の**Model Context Protocol(MCP)**サーバーです。
サーバーの現在のワーキングディレクトリでCodexを実行する2つのツールを公開します。
spawn_agent(prompt: str)spawn_agents_parallel(agents: list[dict])
内部では、各エージェントが次のような動作をしています:
codex exec --cd --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -。
プロンプトはstdin経由で送信され、その後閉じられます。これによりコマンドラインの引用や長さの問題を避け、CodexがMCPサーバーのJSON-RPCのstdinパイプを誤って読み取るのを防ぎます。
注意:--dangerously-bypass-approvals-and-sandboxはサンドボックスおよび確認プロンプトを無効にします。信頼できるリポジトリでのみこのサーバーを使用してください。
Claude Codeで使え
codex-as-mcpには2つのツールがあります
プロンプトを使って並行するコデックスのサブエージェントをスポーンできます。
こちらは二つのタスクを並行して割り当てたサンプルのコデックスセッションです。
クイックスタート
1.Codex CLI をインストールする
Codex CLI >= 0.46.0
Codex CLIが非対話的にあなたのマシン上で動作できるか確認してください(プロバイダー+認証情報は’~/.codex/config)。
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
codex-as-mcp
codex-as-mcp is a small Model Context Protocol (MCP) server that lets MCP clients (Claude Code, Cursor, etc.) delegate work to the Codex CLI.
It exposes two tools that run Codex in the server’s current working directory:
spawn_agent(prompt: str)spawn_agents_parallel(agents: list[dict])
Under the hood, each agent runs something like:
codex exec --cd --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -.
The prompt is sent through stdin and then closed. This avoids command-line quoting/length issues and prevents Codex from accidentally reading from the MCP server’s JSON-RPC stdin pipe.
Note: --dangerously-bypass-approvals-and-sandbox disables sandboxing and confirmation prompts. Use this server only in repos you trust.
Use it in Claude Code
There are two tools in codex-as-mcp
You can spawn parallel codex subagents using prompt.
Here’s a sample Codex session delegating two tasks in parallel.
Quick start
1. Install Codex CLI
Requires Codex CLI >= 0.46.0
npm install -g @openai/codex@latest
codex login
# Verify installation
codex --version
Make sure Codex CLI can run non-interactively on your machine (provider + credentials in ~/.codex/config.toml, or via the provider-specific env var it references).
Example: third-party provider + env_key
If you’re using a third-party provider, configure it in Codex config.toml and point model_provider at it. When a provider uses env_key, Codex CLI expects that env var to be present when it runs.
Example:
model_provider = "custom_provider"
[model_providers.custom_provider]
name = "custom_provider"
base_url = "https://..."
wire_api = "responses"
env_key = "PROVIDER_API_KEY"
show_raw_agent_reasoning = true
When using codex-as-mcp, make sure the MCP server process has that env var set, so it can pass it through to the spawned codex process. The env var name must match the env_key value above (here: PROVIDER_API_KEY).
Option A (recommended): set env in your MCP client config (if supported)
{
"mcpServers": {
"codex-subagent": {
"type": "stdio",
"command": "uvx",
"args": ["codex-as-mcp@latest"],
"env": {
"PROVIDER_API_KEY": "KEY_VALUE"
}
}
}
}
Option B: pass env via server args
uvx codex-as-mcp@latest --env PROVIDER_API_KEY=KEY_VALUE
Option C: add via Codex CLI (codex mcp add)
codex mcp add codex-subagent --env PROVIDER_API_KEY=KEY_VALUE -- uvx codex-as-mcp@latest
Security note: passing secrets via command-line args may be visible via process lists on your machine; prefer option A when possible.
2. Configure MCP
Add to your .mcp.json:
{
"mcpServers": {
"codex-subagent": {
"type": "stdio",
"command": "uvx",
インストール
uvx codex-as-mcp@latest設定
{
"mcpServers": {
"codex-subagent": {
"type": "stdio",
"command": "uvx",
"args": ["codex-as-mcp@latest"],
"env": {
"PROVIDER_API_KEY": "KEY_VALUE"
}
}
}
}