pyxel-mcp
You can use pyxel-mcp to inspect, validate, execute, and measure Pyxel/Cube games headlessly through MCP tools.
Run Pyxel scripts for a frame budget or until a condition holds, with scheduled keyboard, mouse, axis, text, and dropped-file input.
Capture game state, screen grids, inline PNG screenshots, and GIF/MP4 videos, and inspect logs, errors, exit status, frame counts, and timing.
Validate Python/Pyxel scripts for syntax issues and recognizable Pyxel code patterns without executing them.
Look up installed Pyxel/Cube APIs, signatures, declarations, class members, and available documentation.
Report installed versions, type-stub paths, bundled examples, and resource URIs.
Read palettes, image-bank pixels/renders, tilemaps/renders, and audio/WAV/tracker data from scripts or .pyxres assets.
Diff two PNG frames pixel by pixel to get changed regions and ratios.
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 "Deploy 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-mcp Run 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
Let AI agents play, watch, and measure Pyxel games. pyxel-mcp is an MCP server that runs a Pyxel script headlessly, feeds it scheduled input, stops when a condition holds, and hands back the facts: screenshots, pixel grids, game state, assets, audio, and frame diffs.
Try it
After installing, ask your MCP client to run a bundled game:
Use pyxel_info to find 10_platformer. Hold KEY_RIGHT for 30 frames and show me the first and last frames.
The agent can use the returned script path, send input on frame 0, and request two inline screenshots. No game window or separate image viewer is needed.
Related MCP server: Aseprite MCP
Install
Register the stdio server with your client:
claude mcp add --scope user pyxel -- uvx pyxel-mcpcodex mcp add pyxel -- uvx pyxel-mcpgemini mcp add pyxel uvx pyxel-mcpFor Cursor (~/.cursor/mcp.json), a project-scoped Claude Code .mcp.json, or any other client that reads the common JSON format, add:
{
"mcpServers": {
"pyxel": {
"command": "uvx",
"args": ["pyxel-mcp"]
}
}
}VS Code uses .vscode/mcp.json with a top-level servers key and "type": "stdio"; Codex CLI can also be configured in ~/.codex/config.toml as [mcp_servers.pyxel]. Run uvx pyxel-mcp install to print every variant.
Claude Code users can instead install the pyxel-skill plugin, which registers this server together with the skill that teaches agents how to use it:
claude plugin marketplace add kitao/pyxel-skill && claude plugin install pyxel@pyxel-skillRestart the client after changing its configuration. The server writes this diagnostic to stderr:
[pyxel-mcp] starting - 9 toolsPython 3.11+ is required, and Pyxel >= 3.0.3 is installed as a dependency. Script tools execute local Python in subprocesses to isolate Pyxel state, but they do not sandbox untrusted code. See SECURITY.md.
Tools
Pass a local file path as script. The four asset readers also accept a .pyxres file directly, including its sibling palette if present. This lets an agent inspect editor assets before a game exists.
Tool | Returns |
| Installed Pyxel and Cube declarations, overloads, class members and available documentation. Use a name such as |
| Syntax errors and recognizable Pyxel code patterns, without executing. |
| Frames from |
| Installed versions, Pyxel and Cube type stub paths, bundled examples, and resource URIs. |
| Palette colors and image-bank indices in use. |
| Image-bank pixels and an optional PNG render. |
| Tile coordinates, source bank, usage counts, bounds, and an optional PNG. Set |
| A sound or music WAV, duration, peak amplitude, and tracker fields. Set |
| Pixel differences between two PNG files. |
Every tool declares input and output schemas. A result includes ok and errors, with unsuccessful observations flagged as MCP tool errors. Syntax issues appear under issues. Inspect log for game output and warnings for capture details.
Game scripts run in their own directory with their enclosing resources available. With pyxel.run() the MCP drives update and draw. With pyxel.show() it observes the displayed image. In manual loops each call to pyxel.flip() completes a frame. The frame budget, stop condition, and snapshots apply to all three forms. An explicit quit retains the last completed frame.
Use inline: true for a single screen snapshot, asset PNG, or WAV to receive the media without choosing an output path. The server also returns the temporary file path for follow-up tools. A reply embeds up to 12 PNGs.
Pyxel Cube
Pyxel 3 adds software-rendered 3D through pyxel.cube. Use the same run tool,
scheduled inputs, and screen snapshots to observe Cube programs. pyxel_info
includes Cube examples such as cube/c01_hello_cube; pass an example's path
to run so its bundled assets resolve correctly. Read its source through
pyxel://examples/cube/c01_hello_cube.
stubs_path and cube_stubs_path point to the API type stubs installed with
Pyxel. The Pyxel API reference and
Cube API reference provide full
descriptions. State snapshots can inspect explicit numeric paths such as
scene.camera.transform.pos.x; whole Cube objects are returned as text
representations. The asset readers continue to inspect image banks, tilemaps,
and audio; they do not export a Cube scene or mesh.
When updating older projects, Pyxel 3 no longer accepts the old MML syntax or pre-2.0 resource files. See the current MML commands.
Example
For a game with a score attribute, hold right, jump at frame 25, and capture the frame when the score reaches 1.
{
"script": "/absolute/path/game.py",
"frames": 600,
"random_seed": 7,
"inputs": [
{"frame": 0, "buttons": ["KEY_RIGHT"]},
{"frame": 25, "buttons": ["KEY_RIGHT", "KEY_SPACE"]},
{"frame": 26, "buttons": ["KEY_RIGHT"]}
],
"until": "score >= 1",
"snapshots": [
{"kind": "state", "frame": "end", "attrs": ["score", "player.x"]},
{"kind": "screen_image", "frame": "end", "scale": 3, "inline": true}
]
}In games that keep state at module level, use a path such as __main__.player.x in both attrs and until. This also works when the update callback is a bound method, as in the bundled platformer.
The result reports until_met, the reached frame_count, the requested state values, the PNG path, and the PNG itself as image content. Button and axis sets persist until replaced. Mouse wheel deltas, input text, and dropped files apply on the scheduled frame only. Artifact paths you choose must be absolute. Read log even when ok is true, and inspect captured images directly when appearance matters.
Resources
pyxel://run-snapshots-schema— completerun.snapshotsgrammar, including"end", ranges, andinline.pyxel://validation-patterns— categories reported byvalidate.pyxel://palette/default— default palette table.pyxel://examples/{name}— source for a top-level example bundled with the installed Pyxel package.pyxel://examples/cube/{name}— source for a bundled Pyxel Cube example.
Discover examples with pyxel_info. Append its returned name to
pyxel://examples/ to read the source, or pass its path to run.
Update
uvx caches packages. Force a refresh with:
uvx --refresh-package pyxel-mcp --refresh-package pyxel pyxel-mcp installTroubleshooting
If tools do not appear, look for the
starting - 9 toolsdiagnostic and restart the client.If
runfails, inspecterrors,exit_status, andlog.If a script cannot find an asset, check the path relative to the script file, not to the client's working directory.
If a validation category is unfamiliar, read
pyxel://validation-patterns.
Related
Pyxel — the retro game engine this server observes.
pyxel-skill — the Agent Skill that turns these tools into a build-and-verify workflow.
CHANGELOG.md — what changed in each release.
MCP Registry
mcp-name: io.github.kitao/pyxel-mcp
License
MIT — see LICENSE.
Available Tools
9 toolsdiff_framesARead-onlyIdempotent
Compare two PNG frames pixel by pixel and return their changed region and ratio.
Inputs: frame_a (required), frame_b (required). Returns: ok, ratio, errors, region, +7 more
lookup_apiARead-onlyIdempotent
Look up an installed Pyxel or Cube API by name, e.g. blt, Image.set, or cube.Vec3.lerp. Exact names return signatures, available documentation and class members. Partial names return up to 30 matching names.
Inputs: name (required). Returns: ok, name, errors, matches, +3 more
pyxel_infoARead-onlyIdempotent
Report installed versions, Pyxel and Cube type stub paths, examples, and resource URIs.
Inputs: no named parameters. Returns: ok, errors, examples, resources, +5 more
read_audioBDestructive
Render one Pyxel sound or music slot to WAV and return measurable audio data. Set inline=true to return audio content (up to 4 MiB) and omit output_path if desired. Notes describe tracker fields.
Inputs: script (required), target (required), inline, output_path. Returns: ok, path, notes, errors, +5 more
read_imageADestructive
Read palette-index pixels from a Pyxel image-bank region and optionally render it to PNG; inline=true returns the render as image content and makes render_path optional.
Inputs: image (required), script (required), h, w, +4 more. Returns: ok, errors, pixels, region, +4 more
read_paletteCDestructive
Read the active Pyxel palette and the palette indices used by image banks.
Inputs: script (required). Returns: ok, colors, errors, palette_size, +2 more
read_tilemapBDestructive
Read Pyxel tile coordinates, usage, bounds, source bank, and optional rendered output. bbox=[x,y,w,h] selects a region in tiles. inline=true returns the render as image content and makes render_path optional.
Inputs: script (required), tilemap (required), bbox, inline, +1 more. Returns: ok, size, tiles, usage, +8 more
runADestructive
Run a Pyxel script headlessly for a frame budget or until a condition holds, with scheduled input and state, screen, or video capture. screen_image snapshots with inline=true also return the PNG as image content, and a single inline frame may omit its output path.
Inputs: frames (required), script (required), until, inputs, +4 more. Returns: ok, log, errors, seeded, +5 more
validateARead-onlyIdempotent
Check Python syntax and report recognizable Pyxel code patterns.
Inputs: script (required). Returns: ok, errors, issues
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
The read_* family is cleanly partitioned by resource type (palette, image, tilemap, audio), and run, validate, and diff_frames each have a distinct role. The only mild overlap is pyxel_info versus lookup_api, both of which surface installed-API information, though one reports versions/paths and the other returns signatures and members.
There is a coherent read_<resource> group plus verb_noun forms (lookup_api, diff_frames), but bare verbs (run, validate) and a noun-style prefixed name (pyxel_info) break the pattern. It stays readable, but no single convention governs the whole set.
Nine tools is well within a comfortable range and each appears to earn its place: one execution tool, one validation tool, one API lookup, one info tool, four resource readers, and one frame comparison utility. No obvious filler or redundancy.
The read side of the domain is well covered (palette, image, tilemap, audio, screen/video capture, frame diffing) alongside execution, validation, and API lookup. The main gap is direct write/mutate operations for image banks, tilemaps, or palettes, which an agent can only do indirectly by authoring and running a Pyxel script.
Maintenance
Related MCP Connectors
Make games with AI: one MCP server that connects your agent to Unity, Unreal and Godot editors.
Generate authentic pixel art - sprites, animations, and tilesets - from any MCP client
Remote MCP server with 23 tools to generate and reuse 2D game sprites, animations, maps, and audio.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for programmatically creating and editing Aseprite sprites, enabling AI agents to draw, manage layers and frames, and iterate until the desired result is achieved.MIT
- AlicenseBqualityBmaintenanceAn MCP server that lets AI agents create and edit Aseprite sprites headlessly, enabling pixel art, animation, and export via 98 tools.15642MIT
- FlicenseAqualityDmaintenanceAn MCP server that enables AI coding agents to create pixel art programmatically by providing canvas manipulation tools and PNG export.1010-
- AlicenseNot gradedqualityCmaintenanceAn AI-native game engine MCP server that enables AI agents to create, modify, and run games using 53 tools for scene creation, physics, audio, 3D rendering, and AI-generated images and music.1MIT