
Generate Game Assets from Codex CLI and Gemini CLI with MCP
Connect Codex CLI and Gemini CLI to the Sprixen MCP server and generate style-locked sprites, animations, tiles and music from your terminal agent.
To generate game assets from Codex CLI or Gemini CLI, register Sprixen's MCP server (https://api.sprixen.com/v1/mcp) with your API key in the client's config, then ask the agent for the sprite, animation, tile or music you need. Codex reads the server from ~/.codex/config.toml; Gemini CLI adds it with one gemini mcp add command. The agent then calls the same tools Claude Code uses, polls each job and saves the results into your project.
This is the Codex and Gemini version of the Claude Code MCP walkthrough, with the exact config for each client, the instruction file that teaches the agent the workflow, and prompts that work.
Step 1: Get an API key
Create a Sprixen account (6 free credits, no card) and generate a key in your account settings. Keys look like spx_live_... and are shown once. Every MCP call is billed to that key's credits, so treat it like a password.
Step 2a: Connect Codex CLI
Add the server to ~/.codex/config.toml:
[mcp_servers.sprixen]
url = "https://api.sprixen.com/v1/mcp"
[mcp_servers.sprixen.http_headers]
Authorization = "Bearer spx_live_YOUR_KEY"
Codex uses Streamable HTTP when a server has a url. If you would rather keep the key out of the file, OpenAI's Codex MCP documentation also supports bearer_token_env_var, which reads the token from an environment variable and sends it in the Authorization header:
[mcp_servers.sprixen]
url = "https://api.sprixen.com/v1/mcp"
bearer_token_env_var = "SPRIXEN_API_KEY"
Run codex mcp list to confirm the server is configured, and type /mcp inside the Codex TUI to see active servers and their tools.
Step 2b: Connect Gemini CLI
Gemini CLI registers HTTP servers from the command line. Following the syntax in the Gemini CLI MCP documentation:
gemini mcp add --transport http \
--header "Authorization: Bearer spx_live_YOUR_KEY" \
sprixen https://api.sprixen.com/v1/mcp
The default scope is the project, which writes to .gemini/settings.json in the current folder. Add -s user to store it in ~/.gemini/settings.json instead. The user scope keeps the key out of your repository; if you use the project scope, add .gemini/settings.json to .gitignore.
The equivalent settings entry uses httpUrl and a headers object:
{
"mcpServers": {
"sprixen": {
"httpUrl": "https://api.sprixen.com/v1/mcp",
"headers": { "Authorization": "Bearer spx_live_YOUR_KEY" }
}
}
}
Check it with gemini mcp list, which shows each server and its connection status, or with /mcp inside a session.
Step 3: Teach the agent the workflow
Connecting the server lists the tools. It does not tell the agent the order that avoids wasted credits: one project per game, the base sprite before its animations, poll a job before starting the next, export at the end. Sprixen publishes that as a plain instruction file.
For Codex, which reads AGENTS.md:
curl -fsSL https://sprixen.com/agents/AGENTS.md >> AGENTS.md
Gemini CLI reads GEMINI.md context files by default, so append the same text there:
curl -fsSL https://sprixen.com/agents/AGENTS.md >> GEMINI.md
Step 4: Prompt for assets
A first prompt that exercises the whole flow:
Check my Sprixen credits. Then create a Sprixen project called
"moss-keep" with 32x32 pixel art, top-down view and a muted green
palette. Generate a knight sprite in it, then a 6-frame walk
animation facing down. When both are complete, export the character
package for Godot and unzip it into assets/characters/knight/.
The agent maps that to these tools:
| Step | Tool | Cost |
|---|---|---|
| Check balance | get_credits | Free |
| Find or create the project | list_projects, then call_api for the project endpoint | Free |
| Generate the knight | generate_sprite, polled with get_generation | 2 credits per variant |
| Animate it | generate_animation, checked with list_sprite_animations | 4 standard, 8 premium |
| Export for the engine | export_character_package | Free |
More prompts that map cleanly to single tools:
- "Generate a pack of 6 dungeon items in the moss-keep project: key, potion, torch, scroll, coin pouch, map." Uses
generate_spritewithpackItems(up to 8 items, 2 credits for the pack). - "Make a top-down stone floor tile with walkable collision." Uses
generate_tileat 1 credit. - "Generate 30 seconds of calm exploration music at 90 BPM in D minor." Uses
generate_musicat 3 credits, polled withget_music. - "Create a 16x16 top-down map called courtyard and export it." Uses
create_mapandexport_map.
Anything without a dedicated shortcut (parallax backgrounds, batch animations, project edits) is reachable through list_api_operations, describe_api_operation and call_api, which run with the same validation and credit checks as the app.
Limits to tell your agent about
- Generation is asynchronous. Every generate tool returns an ID immediately. The asset exists only after a poll reports completed.
- Five active jobs per account for sprites and tiles. A sixth returns
ACTIVE_GENERATION_LIMITwith a retry delay. - Rate limit of 120 MCP requests per minute per user, and sessions expire after 30 idle minutes; reinitialize instead of retrying a dead session.
- Errors carry a stable code. On
INSUFFICIENT_CREDITSthe agent should stop and show you the upgrade link, without retrying or quietly switching to a cheaper operation.
Verify what the agent delivered
A tool call that returns an ID means the job was accepted. Before you build on the result, check three things:
- The files exist where you asked. List
assets/characters/knight/and confirm the sheets,atlas.pngandmanifest.jsonare there. - The manifest matches the request.
manifest.jsonlists each animation with its frame count, fps and loop flag, plus awarningsfield for anything the export had to substitute, such as a mirrored direction. - The engine import works. Ask the agent to load the package in a test scene. The Godot package includes SpriteFrames and a scene, so a broken frame size shows up immediately.
Troubleshooting
- The server does not appear in Codex. Check the table names:
[mcp_servers.sprixen]and[mcp_servers.sprixen.http_headers]must match exactly, and the file must be valid TOML. Restart Codex after editing. - Gemini lists the server but the agent never uses it. You may have added it with the project scope in a different folder. Run
gemini mcp listfrom your game's folder, or re-add it with-s user. - Every call fails with an authentication error. The key is mistyped, revoked, or missing the
Bearerprefix in the header. Generate a new key in Sprixen and update the config. - A tool seems to be missing. Reconnect the client so it refreshes the tool list. The catalog can change when a feature is turned off in production, which is why 3D generation tools are absent today.
Codex or Gemini: which one
Both clients reach the same tools with the same results, because the server does the work. Pick the agent you already use for the game's code, so asset generation and engine import happen in the same session and the agent can wire the exported files into your scenes right away.
Every client config, including Cursor, Windsurf, VS Code and Claude Desktop, is on the Sprixen MCP docs page.
FAQ
Does the Sprixen MCP server work with Codex CLI?
Yes. Add an mcp_servers.sprixen table with the server URL and an Authorization header to ~/.codex/config.toml, or use bearer_token_env_var to read the key from an environment variable. Codex connects over Streamable HTTP.
How do I add an HTTP MCP server to Gemini CLI?
Run gemini mcp add with --transport http, a --header for the Authorization bearer token, the server name and the URL. Add -s user to save it in ~/.gemini/settings.json instead of the project's settings file.
Is connecting the MCP server free?
Connecting and the discovery tools are free. Generation spends credits: 2 per sprite variant, 4 per standard animation, 8 per premium animation, 1 per tile and 3 per music track. New accounts get 6 free credits and Pro is $10 a month for 200.
How does the agent keep every asset in the same style?
It creates one Sprixen project per game and passes that project ID to every generation call. The project's art style, resolution, view angle and palette apply to everything generated in it.
Do I need the AGENTS.md instructions?
The tools work without them, since each one has a description. The instruction file encodes the safe order of operations, which cuts down on duplicate jobs and wasted credits.
Wire Sprixen into your agent.
The Sprixen MCP server lets Claude Code, Cursor and other agents generate sprites, animations and VFX without leaving the chat.
Related Articles
How to Generate Game Sprites from Claude Code with MCP (Step by Step)
A complete walkthrough for generating style-consistent game sprites and animations from Claude Code using Sprixen's MCP server, from API key to exported Phaser package.
MCP Game Asset Pipelines: What Claude Code and Cursor Can Actually Automate
A grounded guide to MCP for game asset workflows: what an agent can safely automate, where approvals belong, and how to connect generation, validation and export.
Build a Phaser Game in Cursor with Consistent AI Art (Sprixen MCP)
Clone the Sprixen Phaser starter, connect Sprixen's MCP server to Cursor, and generate a style-locked character with idle and walk animations that import cleanly into Phaser.