How to use OpenAI Codex with Unreal Engine
Short answer: in Unreal Engine 5.8, enable Epic's Unreal MCP and All Toolsets plugins, start the server, then add http://127.0.0.1:8000/mcp to Codex as a Streamable HTTP MCP server. You can do that in the ChatGPT desktop app's settings, with the Codex CLI, or with two lines in config.toml. Everything below comes from Epic's Unreal MCP docs and OpenAI's Codex docs, checked October 2026.
What you are connecting
Unreal MCP is an MCP server that runs inside Unreal Editor. MCP (Model Context Protocol) is a standard way to let an AI agent use tools in another app. With it, Codex can spawn actors, set up lighting, make material instances, work with Blueprints and run automation tests in your open project. Epic marks it Experimental in 5.8 and warns that many features are incomplete and may change.
OpenAI Codex is OpenAI's coding agent. It runs in the ChatGPT desktop app, a terminal CLI and an IDE extension, and all three share the same MCP settings. Set it up once and it works in each.
What you need
- Unreal Engine 5.8. That is the version Epic's Unreal MCP docs cover.
- Codex. ChatGPT Free and Go include limited Codex in the desktop app, subject to rollout. The CLI and IDE extension start with ChatGPT Plus at $20/mo (checked October 2026).
- The editor open. Codex can only use Unreal tools while the editor is running with the server started.
OpenAI Codex
OpenAI's coding agent for the desktop app, terminal, IDE and web. It can read your project, write code and use MCP servers.
Pricing: Freemium, from $8/mo (Go, desktop app only). Beginner rating: 3/5. Very capable, but you work in a terminal or IDE.
What we use to build our own game, a multiplayer archery FPS in Godot.
Unreal Engine
High end 3D engine with Blueprints visual scripting and C++.
Pricing: Free. Beginner rating: 2/5. Amazing visuals, but heavy and complex for a first game.
Free to download. Big and powerful, so expect a learning curve.
Step 1: turn on Unreal MCP
- In Unreal Editor open Edit, then Plugins. Enable Unreal MCP and All Toolsets, then restart the editor. Without All Toolsets the server has no tools to offer.
- Start the server. Open the console (backtick key) and type
ModelContextProtocol.StartServer. Or turn on Auto Start Server under Edit, Editor Preferences, General, Model Context Protocol so it starts every time. - The server listens on
http://127.0.0.1:8000/mcp. If port 8000 is taken, useModelContextProtocol.StartServer 8001and change the port in the steps below.
Step 2: add the server to Codex
Pick one of these. You only need one, because the desktop app, CLI and IDE extension share the same config.
Option A: the ChatGPT desktop app
- Open Settings, then MCP servers, then Add server.
- Name it
unreal-mcp, choose Streamable HTTP, and enterhttp://127.0.0.1:8000/mcp. - Save, then select Restart. Type
/mcpin the composer to see connected servers.
Option B: let Unreal write the config
In the Unreal console type ModelContextProtocol.GenerateClientConfig Codex. Epic says this writes the TOML config the Codex CLI uses. It is write once: the command will not overwrite an existing file, so if you change ports later, delete the old file by hand and run it again. Codex only reads a project's .codex/config.toml when you mark that project as trusted.
Option C: add it yourself
Open ~/.codex/config.toml (or .codex/config.toml in a trusted project) and add:
[mcp_servers.unreal-mcp]
url = "http://127.0.0.1:8000/mcp" Step 3: check that it works
- Launch the editor first and make sure the server started. Then start Codex from your project folder.
- In the Codex CLI, run
/mcpand look forunreal-mcp. - Try Epic's test prompts: What actors do I have selected? or What are a few things you can do in Unreal?
Only seeing three tools named list_toolsets, describe_toolset and call_tool? That is Epic's Tool Search, on by default. Codex uses those three to find the real tools.
Things to try first
- Spawn a cube at the player start and give it a red material.
- Create a material instance from my base material with roughness set to 0.3.
- List the Blueprints in my project and tell me what each one does.
- Run the automation tests for my project.
Tips that save time
- Use source control or save often. Codex changes your real project.
- One agent at a time. Epic runs tool calls one by one on the editor's game thread and says clients should not send overlapping calls.
- If Codex cannot find the server, restart Codex after the editor is up, and make sure you launched it from the project folder.
- Keep Codex approvals on. Epic warns that one of its tools runs any Python script inside the editor and can change or delete project content, with no second confirmation if approvals are off.
- Keep it on your own machine. The server has no login and is built for local use only.
- Want it inside the editor? Epic's Terminal plugin can run an agent CLI in an editor panel. Set
TERM=xterm-256colorandcdto your project folder in its startup commands. - Start small. Unreal is a heavy engine for a first game. If you are brand new, a lighter engine may be easier.
Codex or Claude Code for Unreal?
Both connect to the same Unreal MCP server. Epic also publishes an official plugin with Unreal skills for Claude Code, so Claude Code gets a bit more Unreal specific help. Codex makes sense if you already pay for ChatGPT, or want to try the free desktop app first. See How to use Claude Code with Unreal Engine and Claude Code vs Codex vs Cursor for game dev.
Sources
- Unreal MCP, Unreal Engine 5.8 docs (Epic)
- Unreal Engine Skills plugin README, with the toolset list (Epic Games on GitHub)
- Model Context Protocol in Codex (OpenAI)
- Codex config basics (OpenAI)
- Codex pricing (OpenAI)
Related
Comparing engines? Read Best game engines for beginners in 2026. Prefer Godot? See Build a Godot game with AI coding agents like Codex.
FAQ
Does Codex work with Unreal Engine officially?
Epic's Unreal MCP docs for Unreal Engine 5.8 list Codex as a supported client for the GenerateClientConfig command. Unreal MCP is marked Experimental. Epic's agent plugin with Unreal specific skills is built for Claude Code, and we did not find an Epic plugin for Codex (checked October 2026).
Can I do this on ChatGPT's free plan?
Maybe. OpenAI says ChatGPT Free and Go include limited Codex in the desktop app, subject to rollout, and the desktop app can add MCP servers. The Codex CLI and IDE extension need Plus ($20/mo) or higher. Check OpenAI's Codex pricing page before you rely on it.
Where does Unreal write the Codex config?
Epic's docs say the command writes the TOML config the Codex CLI uses, but they do not name the exact path. Codex reads ~/.codex/config.toml and, in trusted projects only, a project .codex/config.toml. If Codex does not see the server, add it yourself with the two lines shown in this guide.
Why does Codex only show three Unreal tools?
That is normal. Unreal MCP has Tool Search turned on by default, so it lists three helper tools (list_toolsets, describe_toolset and call_tool) instead of every tool. Codex uses those to find and call the real tools.
Can Codex edit Blueprints?
Not as text files, since Blueprint assets are stored in binary .uasset files. Through Unreal MCP it can use Epic's Blueprint toolset inside the running editor. Epic lists Blueprints among its toolsets on GitHub.