codex-async-mcp
codex-async-mcp
Lokaler MCP-Server, der das codex-CLI asynchron umschließt – er gibt sofort eine job_id zurück, anstatt zu blockieren, sodass Claude niemals das MCP-Protokoll-Timeout (-32001) erreicht.
Anforderungen
Python 3.11+
codex-CLI installiert und im$PATH(v0.125.0+)Claude Code CLI
Installation
cd ~/payroll-mcp # or wherever this repo lives
pip install -e ".[dev]"Überprüfung:
python -c "from codex_async_mcp.server import mcp; print(mcp.name)"
# → codex-async-mcpRegistrierung bei Claude
Global (alle Projekte)
claude mcp add codex-async -s user -- python -m codex_async_mcp.serverNur für Projekte
cd ~/payrollservice-thailand # or any project
claude mcp add codex-async -- python -m codex_async_mcp.serverÜberprüfung
claude mcp list
# codex-async: python -m codex_async_mcp.server - ✓ ConnectedTool-Berechtigungen hinzufügen (settings.local.json)
{
"permissions": {
"allow": [
"mcp__codex-async__codex_start",
"mcp__codex-async__codex_poll",
"mcp__codex-async__codex_list",
"mcp__codex-async__codex_cancel"
]
}
}Tools
Tool | Beschreibung |
| Startet Codex im Hintergrund → gibt sofort |
| Überprüft Status + Ausgabe-Ende |
| Listet aktuelle Jobs auf (neueste zuerst) |
| Beendet laufenden Job |
approval_policy-Werte
Wert | Codex-Flag | Verhalten |
|
| Schreibgeschützte Sandbox, keine Schreibvorgänge |
|
| Wendet Änderungen automatisch an |
|
| Keine Abfragen, keine Sandbox |
Für Claude-Automatisierung immer full-auto verwenden – der suggest-Modus wartet auf interaktive Eingaben, die innerhalb eines Subprozesses niemals eintreffen werden.
Beispielanwendung
codex_start(
prompt="In app/services/prorate_calculation_service.rb line 96, change format(...) to number_to_currency(...)",
cwd="/Users/bbgummybear/payrollservice-thailand",
approval_policy="full-auto"
)
# → { job_id: "f3a9b2", status: "running", pid: 12345 }
codex_poll(job_id="f3a9b2")
# → { status: "running", output: "Reading file..." }
codex_poll(job_id="f3a9b2")
# → { status: "done", exit_code: 0, output: "Applied changes to prorate_calculation_service.rb" }Job-Status
Jobs werden unter ~/.codex-async/jobs/{job_id}/ gespeichert:
~/.codex-async/jobs/f3a9b2/
meta.json ← status, pid, timestamps, exit_code
output.txt ← stdout + stderr from codexStruktur von meta.json:
{
"job_id": "f3a9b2",
"status": "running | done | error | cancelled",
"prompt": "...",
"cwd": "/path/to/repo",
"approval_policy": "full-auto",
"pid": 12345,
"started_at": "2026-04-29T10:00:00+00:00",
"finished_at": null,
"exit_code": null
}Fehlerbehebung
codex-async: ... - ✗ Failed in claude mcp list
Python kann nicht gefunden werden oder das Paket ist nicht in der richtigen Umgebung installiert.
# Check which python Claude is using
which python
# If using conda, register with the full path
claude mcp add codex-async -s user -- /Users/bbgummybear/miniconda3/bin/python -m codex_async_mcp.server
# Verify the package is installed in that environment
/Users/bbgummybear/miniconda3/bin/python -c "import codex_async_mcp; print('ok')"status: "error" sofort nach codex_start
Codex konnte nicht gestartet werden. Überprüfen Sie die Rohausgabe:
cat ~/.codex-async/jobs/<job_id>/output.txtHäufige Ursachen:
Ausgabemeldung | Lösung |
|
|
| Codex-Version < 0.125.0 – führen Sie |
|
|
status: "running" für immer, wird nie fertig
Der Subprozess hängt (wartet auf Eingabe oder steckt in einer Schleife fest).
# Check if the process is still alive
ps aux | grep codex
# Check live output
tail -f ~/.codex-async/jobs/<job_id>/output.txt
# Cancel the job
codex_cancel(job_id="<job_id>")Häufigste Ursache: Verwendung von approval_policy="suggest", was auf eine interaktive Bestätigung wartet. Verwenden Sie stattdessen "full-auto".
Job zeigt status: "running" nach Server-Neustart
Der MCP-Server hat die In-Memory-Popen-Registrierung beim Neustart verloren. Der nächste codex_poll-Aufruf erkennt, dass die PID tot ist, und aktualisiert den Status automatisch.
codex_poll(job_id="<job_id>")
# → { status: "done", ... } ← auto-resolved on first pollAlte Jobs belegen Speicherplatz
# View all jobs sorted by date
ls -lt ~/.codex-async/jobs/
# Delete jobs older than 7 days
find ~/.codex-async/jobs -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +Projektstruktur
codex-async-mcp/
├── README.md
├── pyproject.toml
├── src/
│ └── codex_async_mcp/
│ ├── __init__.py
│ ├── server.py # MCP entry point, tool definitions
│ ├── job_manager.py # spawn / poll / cancel / list
│ └── config.py # JOBS_DIR, CODEX_BIN, defaults
└── tests/
└── test_job_manager.pyTests ausführen
pytest tests/ -vResources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/benzkittisak/claude-codex-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server