Connect Codex

OpenAI’s coding agent. TOML config via the stdio bridge. Two ways to wire it up: let our CLI do it, or edit the config by hand.

The agent runs on credits

Building gives you your own cloud sandbox, where your projects and the Phaser Agentic Engine live. Time on it is billed per minute, and generating images and audio costs credits too. A fully featured game typically costs around 500 credits to build.

You need credits on your Phaser account before you can build.

Option A · Automatic Recommended

Let the CLI configure it

Signs you in and writes Codex’s MCP config for you. Needs Node.js 20+.

Terminal
npx @phaserjs/game-agent setup --tool codex

Or run npx @phaserjs/game-agent with no arguments to detect every editor you have installed and pick from a list.

Codex runs a small local bridge.mjs, and the config stores an absolute path to it. Install globally so that path stays valid: npm i -g @phaserjs/game-agent.

Option B · Manual

Edit the config by hand

Prefer to wire it up yourself? Generate a token, then add the phaser-game-agent server to Codex’s config file under the mcp_servers key.

Your access token

A token and a positive credit balance are required to perform any operation on the MCP server.

Checking your account…

The config file lives here (create it if it doesn’t exist):

  • macOS · Linux~/.codex/config.toml
  • Windows%USERPROFILE%\.codex\config.toml

Set CODEX_HOME to override where Codex looks for this file.

config.toml
[mcp_servers.phaser-game-agent]
command = "/absolute/path/to/node"
args = ["/absolute/path/to/bridge.mjs"]
startup_timeout_sec = 120

[mcp_servers.phaser-game-agent.env]
PHASER_AGENT_MCP_URL = "https://mcp.phaser.io/agent/mcp"
PHASER_GAME_AGENT_TOKEN = "pga_YOUR_TOKEN"
The node and bridge.mjs paths are specific to your machine. Run npx @phaserjs/game-agent manual to print this config with the real paths filled in, then copy those.

Restart & verify

  1. Restart Codex

    MCP servers are read at startup, so the new tools won’t appear until you fully restart Codex.

  2. Ask it to check your account

    Ask Codex’s agent to check your account. A greeting with your name and credit balance means you’re connected.

    Check my Phaser Game Agent account
The written entry includes startup_timeout_sec = 120 so the bridge has time to connect on a cold start.

What you can ask it

You describe what you want in plain language and your agent calls the tools for you. Tap a prompt to copy it.

Account and games

Build a game

Tweak and polish

Build your first game

Three prompts, start to finish. Paste them into your agent’s chat.

  1. Prove the connection

    It greets you by name and reports your credit balance, which tells you the tool loaded and your token works.

    Check my Phaser Game Agent account
  2. Describe a game

    Your agent reads the built-in guide, opens a cloud project, reuses known-good blocks, writes the code, type-checks it and publishes a preview. You get a public playUrl when it finishes.

    Use the Phaser Game Agent: open a project and build me a Breakout clone, then preview it.
  3. Play it and ask for changes

    Open the play URL in your browser, then keep talking. Your sandbox pauses automatically after every operation, so you pay for the work it does and not for the time you spend playing or thinking.

    Make the paddle wider and add a particle burst when a brick breaks.
    Add a high-score table that survives a refresh.
    How many plays has my game had?

After the build

Finished games land in your library at /agent/games, with versions and play analytics. From there you can:

Play it

Runs in the browser. Players need no download and no account.

Share it

Every game gets a public link you can send to anyone.

Export it

Download a standalone build for Web, Windows, macOS or Linux.

Embed it

Drop it into your own site with an iframe.