Skip to content

OpenAI Codex

Work with Val Town in Codex using our CLI or MCP server. You can ask Codex to:

  • List or examine your vals and read your sqlite data, logs, and almost any of your Val Town data
  • Edit your vals and even agentically iterate, viewing the output and logs until it’s done
  1. Install OpenAI Codex and log in
  2. Install the Val Town CLI and log in
deno install -grAf jsr:@valtown/vt
  1. vt create, vt remix, or vt clone a val. Select “Yes” to add editor files*
  2. cd into your val’s directory
  3. vt checkout -b <branch> to isolate changes (optional)
  4. vt watch to sync with Val Town
  5. codex to start your Codex session

* Running vt create|remix|clone will prompt you to add editor files, including AGENTS.md with our system prompt, which Codex should recognize.

  1. Install OpenAI Codex and log in
  2. Connect Codex to the Val Town MCP server
codex mcp add val-town --url https://api.val.town/v3/mcp
  1. Set up a Val Town API token in ~/.codex/config.toml and export it (or persist in ~/.zshrc or equivalent)
[mcp_servers.val-town]
url = "https://api.val.town/v3/mcp"
bearer_token_env_var = "VAL_TOWN_API_TOKEN"
Terminal window
export VAL_TOWN_TOKEN="vtwn_..."
  1. Run codex