Codex Free Worker
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Codex Free Workerrun the test suite and fix any mechanical failures, but ask before architectural changes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Codex Free Worker
Local MCP bridge that lets Codex delegate bounded execution loops to OpenCode.
The worker keeps raw test/build/CI output out of the primary-model context. OpenCode inspects command output itself, can perform bounded execution loops, and returns only a compact structured result to Codex.
The OpenCode model is a runtime choice configured through FREE_WORKER_MODEL; this
repository does not prescribe a particular model.
Intended split
Use the worker when delegation is likely to save meaningful primary-model context or avoid repeated command/diagnosis cycles.
Good worker targets:
failing test suites with large output;
CI/GitHub Actions and other large log inspection;
Docker/Compose/build failures;
run -> diagnose -> mechanical fix -> rerunloops;large repository searches and routine exploration;
bounded repetitive or mechanical refactors;
validation workflows where several commands may need to be run before a compact conclusion can be returned.
Keep on the primary model:
architecture and public contracts;
security decisions;
migration/persistence strategy;
concurrency/transaction design;
deployment design;
ambiguous behavior;
final acceptance/review.
Small deterministic commands with tiny output are usually cheaper to run directly from
Codex. Examples include git status, git diff --stat, or a short successful
make check.
Delegate whole execution loops rather than individual commands.
Related MCP server: Codex to OpenCode MCP Server
Requirements
Python 3.11+
OpenCode available as
opencodea provider/model configured for OpenCode
Codex CLI with stdio MCP support
The worker invokes OpenCode non-interactively with opencode run, --auto, --dir,
--model, and --format json.
Native install (recommended)
Native mode is simplest because OpenCode gets the same repository paths and host tooling as Codex.
python -m venv .venv
. .venv/bin/activate
pip install -e '.[dev]'
make checkIf the environment was created with a tool that does not seed pip, install/seed pip
before pip install -e '.[dev]'.
Check OpenCode separately with the same model you intend to configure for the worker:
export FREE_WORKER_MODEL="provider/model"
opencode run \
--auto \
--dir "$PWD" \
--model "$FREE_WORKER_MODEL" \
--format json \
"Reply with OK"Connect to Codex
Add the MCP server to ~/.codex/config.toml using absolute paths:
[mcp_servers.free_worker]
command = "/home/YOU/Work/codex-free-worker-mcp/.venv/bin/codex-free-worker"
args = ["stdio"]
cwd = "/home/YOU/Work/codex-free-worker-mcp"
startup_timeout_sec = 10
tool_timeout_sec = 900
[mcp_servers.free_worker.env]
FREE_WORKER_MODEL = "provider/model"
FREE_WORKER_OPENCODE_BIN = "/absolute/path/to/opencode"FREE_WORKER_OPENCODE_BIN is optional when opencode is already available in the MCP
process PATH. To find the host path:
which opencodeRestart Codex after changing its config, then verify the server is visible:
codex mcp listMCP tool
The server exposes one tool:
delegate_task(
task: string,
cwd: absolute repository path,
mode: "inspect" | "fix" = "inspect"
)inspect asks the worker not to modify repository files.
fix permits bounded mechanical changes within the delegated task. Architecture,
security, persistence, deployment policy, concurrency, public contracts, and other
ambiguous design decisions should be returned to the primary model instead.
Inspect example
Run the repository validation workflow. Do not modify files.
If it fails, identify only the meaningful failing stage, concise root cause, useful
path:line locations, and whether a primary-model decision is required.
Do not return raw logs.Fix example
Run the repository validation workflow.
Fix only bounded mechanical formatting/lint/type/test issues without changing intended
behavior. Rerun the smallest useful checks, then the project-level validation.
Stop if an architectural or behavioral decision is required.Result returned to Codex
Example:
{
"status": "failed",
"summary": "Type checking failed in the repository layer.",
"changed_files": [],
"checks": {"mypy": "failed"},
"relevant_locations": ["backend/app/repository.py:47"],
"needs_main_model_decision": false,
"decision_required": null
}Raw stdout/stderr from OpenCode is captured inside the MCP process and is not returned to Codex by default.
Possible statuses:
passed— delegated work completed without changes;fixed— bounded changes were made and validation succeeded;failed— the worker or delegated validation failed;blocked— continuing requires a decision from the primary model.
Integrating with project standards or skills
This repository is designed to be referenced by Codex project standards, AGENTS.md,
or a reusable skill. The integration rule should decide when delegation is worth it;
it should not hard-code a model choice.
A suitable rule is:
Prefer free_worker.delegate_task when a bounded execution loop is expected to produce
large logs, repeated run/diagnose/fix/rerun cycles, broad repository exploration, or
mechanical work that would otherwise consume substantial primary-model context.
Run tiny deterministic commands with small output directly when delegation overhead
would be larger than the output itself.
Delegate the whole execution loop rather than one shell command at a time.
Keep architecture, security, transaction/concurrency decisions, migration strategy,
deployment design, ambiguous behavior, public contracts, and final acceptance on the
primary model.
Raw logs stay with the worker. Ask for additional diagnostics only when the compact
result is insufficient.Suggested integration workflow
When integrating this MCP into another repository or standards repository:
Confirm
free_workeris configured globally in Codex and visible throughcodex mcp list.Add a project/organization rule or reusable skill describing the delegation boundary above.
Do not copy a concrete OpenCode model into project instructions; model selection is runtime configuration through
FREE_WORKER_MODEL.Prefer project-owned validation entry points such as
make check,make verify, or equivalent commands when they exist.Let the worker inspect raw output and iterate internally; return only the compact
WorkerResultto the primary model.Escalate to the primary model when
needs_main_model_decision=trueor when the compact result is insufficient for a safe decision.
A useful first integration test is:
Use free_worker in inspect mode.
Run the repository validation command.
Do not modify files and do not run the command yourself.
Return only the compact worker result.Docker
The image contains the MCP server and OpenCode:
docker build -t codex-free-worker .For stdio MCP, Codex can start Docker directly:
[mcp_servers.free_worker]
command = "docker"
args = [
"run", "--rm", "-i",
"-e", "FREE_WORKER_MODEL",
"-e", "OPENROUTER_API_KEY",
"-v", "/home/YOU/Work:/home/YOU/Work",
"codex-free-worker"
]
tool_timeout_sec = 900The mount deliberately preserves the same absolute repository paths because Codex passes
an absolute cwd to delegate_task.
Docker mode contains only generic tooling plus OpenCode. Delegated project checks may
need project runtimes, Docker CLI/socket, gh, or other tools already available on the
host. For that reason native stdio is the recommended mode for development.
Security boundary
The bridge starts OpenCode through a fixed argument list and never uses shell=True.
OpenCode is started with --auto so the delegated worker can execute allowed actions
without interactive approval. The worker prompt forbids privilege escalation,
destructive Git operations, merges, production deployment, secret retrieval, and
unrelated edits.
These restrictions are prompt-level policy, not an OS sandbox. inspect is likewise an
instruction to the worker rather than a filesystem-level read-only guarantee. Keep normal
Codex/OpenCode permission controls enabled and do not expose secrets or production
credentials to an untrusted model/provider.
Development
make fix
make checkTests cover configuration, inspect/fix prompt boundaries, compact-result extraction from noisy JSONL, refusal to forward raw logs, and OpenCode command construction.
Available Tools
1 tooldelegate_taskC
Delegate a bounded repository task to OpenCode.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | ||
| mode | No | inspect | |
| task | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| checks | No | |
| status | Yes | |
| summary | Yes | |
| changed_files | No | |
| decision_required | No | |
| relevant_locations | No | |
| needs_main_model_decision | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It hints at scope limitation with 'bounded', but does not disclose permissions, side effects, whether fix mutates the repository, rate limits, or other operational traits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single sentence is front-loaded and free of filler, but it is too terse for a three-parameter tool with behavioral implications. Its brevity reflects under-specification rather than efficient completeness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Although an output schema exists and return values need not be explained, the description omits usage guidance, parameter semantics, and behavioral context. With no annotations and 0% schema description coverage, it is nearly inadequate for this tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It mentions no parameters at all and does not explain task, cwd, or the inspect/fix enum, leaving all parameter meaning to undocumented schema fields.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource (delegate a repository task) and names the target (OpenCode) with a scope qualifier (bounded). This is clear, though it does not explain what OpenCode is or what delegation entails.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus alternatives, nor when to choose inspect versus fix. The intended context is only implied by 'bounded repository task'.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
delegate_task
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of an agent confusing it with another. Its purpose (delegating a bounded repository task) is stated unambiguously in the description.
The single tool follows a clear verb_noun convention (delegate_task), which is predictable and readable. With one name there is no inconsistency to introduce.
A single-tool surface is thin for anything but a very narrow fire-and-forget worker. It is defensible if delegation is the entire purpose, but it leaves no room for the supporting operations such a workflow implies.
The domain (delegated task execution) typically needs status polling, result retrieval, cancellation, and error handling, none of which exist. An agent can submit work but has no defined path to observe or manage it, assuming the call is asynchronous.
Maintenance
Related MCP Connectors
Deterministic AI code review, with an audit record. Governance inside the agent loop.
Adaptive plan/build/review cycles for AI coding assistants, persisted across sessions.
- mcp-serverOAuthai.cdbx
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables Codex to delegate routine repository exploration, implementation, refactors, tests, and fixes to DeepSeek Harness in isolated Git worktrees, returning compact results and patches for review while keeping the main workspace protected.526 npmMIT
- AlicenseAqualityCmaintenanceEnables Codex to delegate coding tasks to an OpenCode CLI locally, returning structured results such as exit codes, session summaries, tool calls, and git diffs.2MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-capable coding assistants to delegate repository investigation, bounded implementation work, and noisy command runs (tests, builds, linters) to sandboxed OpenCode agents. Each role can use an independently selected model, and only concise results are returned to the parent agent, which keeps responsibility for architecture and high-risk operations.MIT
- AlicenseBqualityBmaintenanceEnables MCP clients such as Claude Code, Codex CLI, and Cursor-agent to delegate bounded coding tasks to a local OpenCode v2.x installation via a single opencode_execute tool, returning the model's response, git diff/status summary, exit code, and session ID.1MIT