How to Generate Game Sprites from Claude Code with MCP (Step by Step)
tutorial10 min

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.

If you build games with Claude Code, you already know the drill. You describe the mechanic, Claude writes the code, and then you hit a wall: the game has no art. You could open an image generator in another tab, describe a knight, download a PNG, remove the background by hand, resize it, and drop it into your project. Do that for a knight, a goblin, three animations, and a tileset, and you've spent an afternoon on plumbing instead of on your game.

Sprixen runs a native Model Context Protocol (MCP) server at https://api.sprixen.com/v1/mcp. Once it's added to Claude Code, Claude can generate sprites, animate them, and export them for your engine, directly from your prompts, without you leaving the terminal. This guide walks through the full setup and a real generation session, end to end.

TL;DR: Get an API key, run one claude mcp add command, optionally install the Sprixen skill, then just ask Claude for the character and animations you need. Claude calls the tools, polls the jobs, and hands you back sprite sheets and an engine-ready ZIP.

Step 1: Create a Sprixen account and API key

Sign up at sprixen.com. New accounts get 6 free credits, enough to test the workflow before paying for anything. The paid plan is $10/month for 200 generations, which is where you'll land once you're generating a full character roster.

Once you're in, go to your account settings and create an API key. It will look like spx_live_.... Treat it like a password: it authenticates every MCP call as you, and it's billed against your credits.

Step 2: Add Sprixen as an MCP server in Claude Code

Claude Code's CLI has a built-in command for registering remote MCP servers over Streamable HTTP:

claude mcp add --transport http sprixen \
  https://api.sprixen.com/v1/mcp \
  --header "Authorization: Bearer spx_live_YOUR_KEY"

Run that once, replacing the placeholder with your real key. Claude Code stores the connection, and on the next session Claude will have access to Sprixen's tools: generate_sprite, generate_animation, list_sprites, create_map, export_map, get_credits, and around 40 others, including list_api_operations / describe_api_operation / call_api, which let the agent reach any product endpoint that isn't already a dedicated shortcut. If you ever update Sprixen's MCP server and Claude seems to be missing a tool, reconnect the client to refresh its tool list.

You can verify the connection worked by asking Claude to check your credits. If it calls get_credits and reports a number back, you're wired up.

Step 3: Install the Sprixen skill (optional, but worth it)

A skill is a short instruction file that teaches Claude how to use a set of tools well, not just that they exist. Sprixen publishes one at https://sprixen.com/skills/sprixen/SKILL.md. Installing it means Claude already knows the right order of operations (project first, then sprite, then animations, then export) instead of guessing.

mkdir -p ~/.claude/skills/sprixen
curl -fsSL https://sprixen.com/skills/sprixen/SKILL.md \
  -o ~/.claude/skills/sprixen/SKILL.md

Restart Claude Code (or start a new session) after installing it. This step is optional. Claude can drive the raw MCP tools without it, but the skill cuts down on back-and-forth, especially around style consistency and polling.

Step 4: Prompt for the character you actually need

With the server and skill in place, you talk to Claude the same way you'd talk to a teammate. A realistic prompt for a top-down RPG might look like this:

Create a Sprixen project called "dungeon-crawler" with a 32x32
pixel art style, muted earth-tone palette, dark fantasy setting.
Generate a knight character with sword and shield, side view.
Then generate idle, walk, and attack animations for it, 8 frames
each. When they're done, export the character for Phaser.

Claude breaks this into a sequence of tool calls. Here's roughly what happens under the hood, so you know what to expect and what to check if something looks off.

What Claude actually calls

  1. Project setup. There isn't a dedicated create_project shortcut tool yet, so Claude uses list_api_operations to find the project creation endpoint and calls it through call_api. This is the step that locks in your resolution and palette so every asset generated afterward matches.
  2. generate_sprite with the knight prompt, the project ID, and usually pixelPerfect: true for a 32x32 style. This costs 2 credits per variant. The tool returns a job, not a finished image.
  3. get_generation, polled until the sprite's status flips from pending to completed, returning the sprite ID and image URL.
  4. generate_animation, called three times, once per animation type (idle, walk, attack), each referencing the knight's sprite ID. Standard-quality animations cost 4 credits each; premium quality (better motion, worse budget) costs 8.
  5. Polling again, this time on the animation job, until each sheet is ready.
  6. export_character_package with engine: "phaser", which normalizes every animation to a uniform frame size, packs them into one atlas, and returns a manifest plus an authenticated download URL for the ZIP.

If any step fails, look at the error message before retrying. Sprixen's API errors are written to be machine-actionable: insufficient credits comes with an upgrade link, a revoked key comes with instructions to issue a new one, an invalid frame count comes back with the accepted range. A well-instructed Claude session will read the error and self-correct instead of just retrying blindly.

Pitfalls to watch for

  • Credits run out faster than you'd expect. A single character with three animations is roughly 14 credits (2 for the sprite, 12 for three standard animations). Your 6 free credits won't cover that; budget for the $10/month plan if you're doing this more than once.
  • Generation is asynchronous. generate_sprite and generate_animation return a job immediately, not a finished asset. If Claude reports success right after calling one of those tools without a follow-up poll, it's reporting the job was accepted, not that the art exists yet. Ask it to confirm the sprite sheet URL is live before you trust the result.
  • Keep one project per game. Style Lock only works within a project. If Claude creates a new project for every character because it lost track of the ID mid-session, you'll get a knight and a goblin that look like they're from different games. Tell it explicitly to reuse the existing project ID for every asset in the same game.
  • Direction and archetype matter for animations. generate_animation accepts an archetype field (humanoid_biped, quadruped, winged, amorphous, serpentine) that drives motion physics. If you're animating a dragon and Claude doesn't set this, it falls back to a vision-based classifier, which is usually right but not guaranteed. Say the archetype in your prompt if you know it.

Verifying the output

Don't just trust that the export worked because the tool call returned 200. Open the sprite in the Sprixen gallery (sprixen.com/gallery) to see it rendered at actual size, or unzip the character package locally and check manifest.json for the animation list, frame counts, and any warnings field, which flags anything Sprixen had to substitute (like mirroring a missing direction). For Phaser specifically, the package includes phaser/example.js with a working this.load.atlas and this.anims.create setup you can paste straight into a scene, which is the fastest way to confirm the frames line up before you wire in real gameplay code.

The cost math

AssetCredits
Sprite (per variant)2
Animation, standard quality4
Animation, premium quality8
Tile1
Map exportFree
Character package exportFree (repackages existing assets)

A small roster of four characters (hero, two enemies, one NPC), each with idle and walk animations, runs about 4 x (2 + 4 + 4) = 40 credits. On the $10/month plan with 200 generations, that's one fifth of a month's budget for a playable prototype's worth of characters.

Once you've got sprites into an engine, the follow-up work is engine-specific. If you're targeting Phaser, see building a Phaser game in Cursor with consistent AI art and Phaser atlas JSON from AI sprites. For background on why style consistency needs a locked project in the first place, read why AI sprites look inconsistent. Full tool and endpoint reference lives at sprixen.com/docs/mcp and sprixen.com/docs.

FAQ

Do I need the Sprixen skill, or does the MCP server work on its own?

The MCP server works without it. Claude can read tool descriptions and figure out a reasonable sequence on its own. The skill just encodes the order that avoids common mistakes, like generating animations before the base sprite has finished, or forgetting to reuse a project ID. It's a shortcut, not a requirement.

Can Claude generate a whole game's worth of assets in one conversation?

Yes, but expect it to take several minutes for anything beyond a handful of characters, since every sprite and animation is a real asynchronous job that Claude has to poll for. For a large roster, it's more reliable to ask for one or two characters at a time and confirm each before moving on, rather than firing off twenty generations in one prompt.

What happens if I run out of credits mid-session?

The next generation call returns an error with an upgrade link instead of silently failing. Claude will surface that error to you rather than pretend the asset was created; there's no fallback that delivers a lower-quality result instead.

Is this different from just pasting a prompt into an image generator?

Yes, in the ways that matter for game assets specifically: every sprite in a project shares a locked palette and resolution, animations use consistent motion physics per archetype, backgrounds are removed with a real segmentation model rather than a color key, and the final export is a file your engine can actually import rather than a flat PNG you have to slice by hand.

Does this work with Claude Desktop or only Claude Code?

The MCP server is transport-standard Streamable HTTP, so any MCP-compatible client can connect to it, including Claude Desktop. The setup differs by client; see /docs/mcp for the exact configuration for each.

Claude CodeMCPAI game makergame asset pipelinetutorial

Ready to try Sprixen?

Generate consistent, style-locked sprites for your game. 6 free credits on signup, no credit card required.

Get Started Free