Pyxel MCP

io.github.kitaoPublished by GitHub account kitaov1.3.2Updated Oct 25, 2026

MCP server for Pyxel, a retro game engine for Python

VerifiedSTDIODesktop onlyDeveloper ToolsMedia & Design

Overview

AI-generated overview

An MCP server that runs Pyxel retro game scripts headlessly, feeds them scheduled input, and returns screenshots, state, assets, audio and frame diffs.

What you can do
Validate a Pyxel script's syntax and recognizable code patterns without executing it, and report installed versions, paths, examples and resource URIs. Run a script headlessly for a frame budget or until a game attribute condition holds, with per-frame button, axis and mouse input and a random seed. Capture state values, screen images, pixel grids or video at chosen frames, optionally returning PNGs inline as image content. Read the palette, image-bank pixels and tilemap data, with optional PNG renders. Render a sound or music slot to WAV with measurable audio data, and compare two PNG frames pixel by pixel.
When to use it
Useful when an assistant writes or edits a Pyxel game and needs to actually playtest it: drive inputs, stop at an event such as a score change, and inspect the resulting screen, state or assets. Also handy for checking sprite, tilemap and audio data or spotting visual regressions between frames.
Requirements
Runs locally over stdio, typically launched with uvx pyxel-mcp. Needs Python 3.11+ and Pyxel 2.9.6 or later, which is installed as a dependency. Script arguments must be absolute file paths; no accounts, keys or environment variables are declared.
Before you install
Script tools execute local Python in subprocesses; this isolates Pyxel state but is not a sandbox, so only run trusted scripts. Runs write artifact files to paths you choose, and inline frames without a path land in the system temp directory. Stopping relies on internal signals, so scripts that suppress them may run post-run code. Randomness, timing and external state can still affect frames.

Installation

In SourceWeft

  1. Open Pyxel MCP in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

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.

[PyPI] [Python] [Tests] [License] [MCP Registry]

[Pyxel's bundled platformer example driven headlessly with right held and three scheduled jumps] [Frame 80 of the same run at scale 3, returned inline as image content]

Both images come from one run call against Pyxel's bundled 10_platformer.py: 150 frames, right held from frame 0, jumps scheduled at frames 25, 70, and 110, a video snapshot, and an inline screen_image snapshot.

Why

An agent can write a Pyxel game in seconds, but it cannot open a window, press the arrow keys, or look at the screen. Editor-bound engines solve this with MCP servers that live inside the editor. Pyxel has no editor process to attach to, so pyxel-mcp drives the game itself:

  • Headless execution. Every call runs the script in a fresh subprocess with SDL dummy drivers and a frame budget. Set random_seed to seed Python's random module and Pyxel's random generator. Other randomness, timing, and external state can still affect the frames.
  • Input as data. Buttons, axes, and mouse position are scheduled per frame, so a playtest is a JSON document the agent can rerun and extend.
  • Stop on the event, not the clock. until="score >= 1" ends the run at the first frame where a game attribute holds, and "frame": "end" snapshots capture that moment.
  • Facts, not scores. Tools report pixels, values, and measurements. Deciding whether the game is good stays with the agent and the person asking for it.
  • See the frame in the result. inline: true returns a PNG as MCP image content, so the model looks at the screen without a second file read.

Install

Register the stdio server with your client:

bash
claude mcp add --scope user pyxel -- uvx pyxel-mcp
bash
codex mcp add pyxel -- uvx pyxel-mcp
bash
gemini mcp add pyxel uvx pyxel-mcp

For Cursor (~/.cursor/mcp.json), a project-scoped Claude Code .mcp.json, or any other client that reads the common JSON format, add:

json
   {     "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:

bash
claude plugin marketplace add kitao/pyxel-skill && claude plugin install pyxel@pyxel-skill

Restart the client after changing its configuration. The server writes this diagnostic to stderr:

text
[pyxel-mcp] starting - 8 tools

Python 3.11+ is required, and Pyxel >= 2.9.6 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.

How an agent uses it

mermaid
flowchart LR    W["Write or edit<br>game.py"] --> V["validate"]    V --> R["run<br>inputs · until · snapshots"]    R --> O{"Inspect facts<br>state · pixels · log"}    O -- "defect" --> W    O -- "looks right" --> A["read_image · read_tilemap<br>read_audio · diff_frames"]    A --> D["Report evidence"]

The loop is deliberately small. The separate pyxel-skill project teaches agents when to use each tool and what counts as enough evidence; this package only supplies the observations.

Tools

Every script argument is a file path, not Python source. Relative asset paths inside the script resolve from the script's directory, as when running python game.py from that directory.

ToolReturns
validateSyntax errors and recognizable Pyxel code patterns, without executing.
runHeadless frames, scheduled input, logs, and state, screen_image, screen_grid, or video snapshots.
pyxel_infoInstalled versions, paths, bundled examples, and resource URIs.
read_palettePalette colors and image-bank indices in use.
read_imageImage-bank pixels and an optional PNG render.
read_tilemapTile coordinates, source bank, usage counts, bounds, and an optional render.
read_audioA rendered sound or music WAV plus measurable audio data.
diff_framesPixel differences between two PNG files.

All tools declare input and output schemas. Every result includes ok and errors.

Script tools observe the first pyxel.run() call while its enclosing resources remain active. run drives the callbacks there; the asset readers inspect the pre-loop state. pyxel.quit() ends a run normally and preserves completed frames. Statements after pyxel.run() are not executed. Enclosing cleanup runs after observation, and cleanup failures are reported with phase: "script_exit". Stopping uses internal BaseException signals. Scripts or context-manager cleanup that suppress these signals are unsupported and may execute post-run code.

Captured PNGs can travel inside the result: set inline: true on a screen_image snapshot, or inline=true on read_image and read_tilemap, and the PNG is returned as MCP image content next to the structured data. A single inline frame may omit its output path; the file is then written under the system temp directory and its path is still reported, so diff_frames and later comparisons keep working. At most 12 images are embedded per call.

Example

Hold right, jump at frame 25, stop as soon as the score changes, and look at that frame:

json
{  "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}  ]}

The result reports until_met, the reached frame_count, the requested state values, the PNG path, and the PNG itself as image content. 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 — complete run.snapshots grammar, including "end", ranges, and inline.
  • pyxel://validation-patterns — categories reported by validate.
  • pyxel://palette/default — default palette table.
  • pyxel://examples/{name} — source for an example bundled with the installed Pyxel package; discover names with pyxel_info.

Update

uvx caches packages. Force a refresh with:

bash
uvx --refresh-package pyxel-mcp pyxel-mcp install

Troubleshooting

  • If tools do not appear, look for the starting - 8 tools diagnostic and restart the client.
  • If run fails, inspect errors, exit_status, and log.
  • 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.

Source: README.md at commit e1b6b74

Tools

8

run

Run Pyxel script headlessly

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.

Parametersuntilframesrequiredinputsscriptrequiredtimeoutsnapshotsrandom_seedstall_window_frames

validate

Validate Pyxel script

Check Python syntax and report recognizable Pyxel code patterns.

Parametersscriptrequired

pyxel_info

Pyxel environment info

Report installed versions, paths, examples, and Pyxel resource URIs.

Takes no parameters.

read_palette

Read Pyxel palette

Read the active Pyxel palette and the palette indices used by image banks.

Parametersscriptrequired

read_image

Read image bank region

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.

Parametershwxyimagerequiredinlinescriptrequiredrender_path

read_tilemap

Read tilemap

Read Pyxel tile coordinates, usage, bounds, source bank, and optional rendered output; inline=true returns the render as image content and makes render_path optional.

Parametersinlinescriptrequiredtilemaprequiredrender_path

read_audio

Render audio to WAV

Render one Pyxel sound or music slot to WAV and return measurable audio data. Notes describe tracker fields, not an MML or PCM transcription.

Parametersscriptrequiredtargetrequiredoutput_pathrequired

diff_frames

Diff two frames

Compare two PNG frames pixel by pixel and return their changed region and ratio.

Parametersframe_arequiredframe_brequired

Version history

3
  1. v1.3.2LatestOct 24, 2026
  2. v1.3.1Sep 22, 2026
  3. v1.3.0Sep 16, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts