pyxel-mcp
pyxel-mcp is an MCP server for the Pyxel retro game engine that enables AI agents to autonomously run, verify, debug, and iterate on retro game programs written in Python.
Run & Capture
Run a Pyxel script and capture a screenshot after a specified number of frames
Capture screenshots at multiple frame points to verify animations
Record frames as a GIF for animation/transition verification
Simulate keyboard/mouse input at specific frames and capture screenshots to test input-dependent logic
Inspect & Debug
Validate a Pyxel script via AST parsing without running it (syntax errors and anti-patterns)
Read game object attributes at specific frames for debugging, with multi-frame diff support
Capture the screen as a compact color index grid for programmatic analysis
Compare screenshots at two frames to report pixel differences and changed regions (visual regression testing)
Visual Analysis
Inspect sprite pixel data from a Pyxel image bank, including symmetry and color usage
Analyze screen layout, text alignment, centering, and visual balance
Analyze color usage, distribution, background color, and contrast issues
Visualize an entire 256×256 Pyxel image bank as a screenshot
Inspect tilemap content, tile usage statistics, and layout
Check sprite sheet consistency across animation frames
Audio
Render a Pyxel sound or music track to WAV and return waveform analysis (note sequence, timing, frequency, volume)
Utility
Retrieve Pyxel installation info: package location, examples path, and API stubs path
Resources
Access official Pyxel API reference, user guide, MML commands, and pyxres format
Browse official Pyxel example programs and the default 16-color palette
Enables AI to autonomously run, verify, and iterate on retro game programs created with the Pyxel engine, providing tools for Python script validation, state inspection, and visual/audio analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pyxel-mcpRun main.py and capture a screenshot to verify the game visuals"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pyxel-mcp
MCP server for Pyxel, the retro game engine for Python. It gives AI agents a compact set of verbs to run and observe Pyxel programs without a window — headless, deterministic, and scriptable — so an agent can close the verification loop on the game it just wrote.
Why this exists
LLM agents writing Pyxel code without feedback stop at "the script runs". pyxel-mcp closes that loop with facts, not judgments:
Headless runs. Drive frame counts, schedule inputs, and stop on a condition (
until="score >= 1") without opening a window.Subprocess isolation. Each tool call starts fresh; Pyxel state cannot leak between calls.
Structured output. Every tool returns JSON with uniform
ok/errorsfields and a declared schema.Pyxel footguns.
validateand the resource catalog surface common mistakes such as missingcls, missingcolkey, and the tilemap(0, 0)trap.No universal quality score. The agent writes the predicates that matter for the current game and visually inspects captured PNGs.
Related MCP server: aseprite-mcp
See it work
One run call takes the game to the moment a condition holds and captures proof:
{
"script": "/abs/path/game.py",
"frames": 600,
"until": "score >= 1",
"snapshots": [
{"kind": "state", "frame": "end", "attrs": ["score", "player.x"]},
{"kind": "screen_image", "frame": "end", "output": "/tmp/goal.png"}
]
}Result (excerpt):
{
"ok": true,
"until_met": true,
"frame_count": 42,
"snapshots": [
{"kind": "state", "frame": 41, "values": {"score": 1, "player.x": 88.0}},
{"kind": "screen_image", "frame": 41, "path": "/tmp/goal.png", "size": [160, 120]}
]
}The agent then reads /tmp/goal.png with its own eyes. State proves mechanics; pixels prove what the player actually sees.
Quick start
Register the server. For Claude Code:
claude mcp add pyxel -- uvx pyxel-mcpFor any other MCP client,
uvx pyxel-mcp installprints this snippet and where to put it:{ "mcpServers": { "pyxel": { "command": "uvx", "args": ["pyxel-mcp"] } } }Claude Code:
~/.claude/.mcp.jsonor per-project.mcp.jsonCursor:
~/.cursor/mcp.jsonCodex CLI:
~/.codex/mcp.json
Restart your client.
Confirm it loaded — the server logs one line to stderr:
[pyxel-mcp] starting - 9 tools
Pyxel >= 2.9.6 is installed as a dependency. Tools that accept script execute that file as trusted local Python — pyxel-mcp isolates Pyxel state per subprocess, but it is not a sandbox for untrusted code (see SECURITY.md).
For full game-building workflow guidance, pair the server with the separate pyxel-skill repository. pyxel-mcp does not ship or publish skills.
Tools
Every script parameter is a path to a Python file, not source code.
Tool | Purpose |
| Drive N frames headlessly — or stop early with |
| Syntax and common Pyxel anti-pattern checks. |
| Version, path, example, and resource discovery. |
| Palette state, used indices, hierarchy hints, and contrast warnings. |
| Image-bank region pixels and optional rendered PNG. |
| Adjacent sprite-frame consistency and per-pair diffs. |
| Tile usage, non-empty region, and |
| Render a sound or music target to WAV and return duration, peak, notes, warnings. Music renders a fixed 10-second window. |
| Pixel-wise diff between two PNG files. |
Minimal loop
Run
validatebefore the first dynamic run.Use
runwith astatesnapshot and ascreen_imageat the frame being verified — oruntilplus"frame": "end"snapshots when the target is "the moment X happens".Inspect the captured PNG yourself; pixels are the player-facing truth.
Add
read_*ordiff_framesonly when the task needs that specific observation.Keep proof bundles and long reports for release/audit requests, not for every small game.
Resources
pyxel://run-snapshots-schema- full grammar forrun.snapshots,until, and the"end"token.pyxel://anti-patterns-validateissue catalog.pyxel://api-reference,pyxel://user-guide,pyxel://mml-commands,pyxel://pyxres-format- Pyxel docs, fetched live from GitHub with a 24h cache (stale cache served offline).pyxel://palette/default- default palette table.pyxel://examples/<name>- the examples bundled with the installed Pyxel; discover names viapyxel_info.
Update
uvx caches packages. Force a refresh with:
uvx --refresh-package pyxel-mcp pyxel-mcp installTroubleshooting
Tools do not appear. Look for [pyxel-mcp] starting - 9 tools in client logs, then restart the client if the config changed.
run returns ok: false. Check exit_status: crashed (script raised), timeout (wall-clock cap), stalled (no observable change for stall_window_frames), or invalid (payload rejected before execution). Read log even when ok is true.
A script crashes on pyxel.init(). User scripts should call pyxel.init() once. Tool calls are isolated subprocesses, so repeated runs should go through pyxel-mcp rather than re-importing a script in the same process.
A validation issue is unfamiliar. Read pyxel://anti-patterns.
MCP Registry
mcp-name: io.github.kitao/pyxel-mcp
The line above is this repo's ownership marker for the MCP Registry.
License
MIT — see LICENSE.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kitao/pyxel-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server