Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables ChatGPT to execute Codex CLI prompts locally through a secure MCP tool, with support for both local stdio and remote HTTP modes.

README.md

2Bot

2Bot is a FastMCP server that lets ChatGPT (or any MCP client) call your local Codex CLI through a controlled MCP tool.

  • MCP server name is fixed to 2Bot.
  • Local mode uses stdio.
  • Remote mode uses HTTP (Streamable HTTP) for ChatGPT-compatible deployments.

What 2Bot does

2Bot exposes a single typed tool, run_codex_prompt, which runs codex exec --json - safely:

  • no shell=True
  • prompt passed via stdin
  • timeout handling
  • working-directory validation and allowlist support
  • JSON-serializable structured output

Installation

python -m venv .venv
source .venv/bin/activate
pip install -e .

For tests:

pip install -e .[dev]
pytest

Configuration

2Bot is environment-driven.

| Variable | Default | Description | |---|---|---| | TWOBOT_TRANSPORT | stdio | stdio or http | | TWOBOT_HOST | 127.0.0.1 | HTTP bind host | | TWOBOT_PORT | 9000 | HTTP bind port | | TWOBOT_BASE_URL | unset | Optional public HTTPS URL for docs/ops | | TWOBOT_LOG_LEVEL | INFO | Logging level | | TWOBOT_ENABLE_NO_AUTH | true | Enable no-auth mode for initial ChatGPT testing | | CODEX_ALLOWED_ROOTS | unset | Optional cwd allowlist (:-separated on macOS/Linux) |

Authentication note: for first connection tests, use no auth. For production, prefer standards-based MCP-compatible auth in front of or integrated with this service.

Local mode (stdio)

Run with stdio (default):

2bot-mcp
# or
python -m twobot_codex_mcp.server

You can also force stdio:

TWOBOT_TRANSPORT=stdio 2bot-mcp

Remote mode (HTTP / Streamable HTTP)

Run HTTP mode locally on loopback:

TWOBOT_TRANSPORT=http TWOBOT_HOST=127.0.0.1 TWOBOT_PORT=9000 2bot-mcp

Or with explicit CLI flags:

2bot-mcp --transport http --host 127.0.0.1 --port 9000

Expose via HTTPS for ChatGPT

ChatGPT must reach a public HTTPS URL. Typical setup:

  1. Run 2Bot in HTTP mode on 127.0.0.1:9000.
  2. Put a reverse proxy or tunnel in front (Nginx, Caddy, Cloudflare Tunnel, etc.).
  3. Publish a TLS endpoint like https://mcp.example.com forwarding to http://127.0.0.1:9000.
  4. Configure ChatGPT custom MCP connection to that public URL.

ChatGPT connection notes

ChatGPT connects to the remote HTTPS MCP endpoint, not to stdio.

High-level flow:

  1. Start 2Bot in HTTP mode.
  2. Expose the endpoint at a public HTTPS URL.
  3. Create/connect the custom MCP app in ChatGPT pointing at that URL.

Use URL pattern:

  • https://<your-public-hostname>/ (or the exact path your reverse proxy maps to the FastMCP HTTP app)

Security notes (important)

Exposing a tool that can execute local Codex workflows is sensitive.

Recommendations:

  • Restrict CODEX_ALLOWED_ROOTS to minimal directories.
  • Keep conservative defaults (sandbox=read-only, allow_edits=false).
  • Avoid danger-full-access unless absolutely necessary and trusted.
  • Prefer private deployments (VPN, private network, authenticated gateway).
  • Do not expose an unrestricted instance on the public internet casually.

Example deployment notes

1) Local-only HTTP bind

TWOBOT_TRANSPORT=http TWOBOT_HOST=127.0.0.1 TWOBOT_PORT=9000 2bot-mcp

2) Reverse proxy / tunnel

  • Proxy https://mcp.example.com -> http://127.0.0.1:9000
  • Keep TLS at the edge
  • Keep 2Bot private behind the proxy where possible

3) Keep stdio mode for local MCP clients

TWOBOT_TRANSPORT=stdio 2bot-mcp

Tool reference: run_codex_prompt

Parameters:

  • prompt: str
  • cwd: str | None = None
  • model: str | None = None
  • profile: str | None = None
  • sandbox: "read-only" | "workspace-write" | "danger-full-access" = "read-only"
  • approval_policy: "untrusted" | "on-request" | "never" | None = None
  • allow_edits: bool = False
  • skip_git_repo_check: bool = False
  • add_dirs: list[str] | None = None
  • timeout_sec: int = 1800
  • ephemeral: bool = True
  • include_event_log: bool = False

Behavior is preserved from local mode while adding transport/config flexibility.

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Developer Tools servers.