pico-8-mcp
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., "@pico-8-mcpSimulate my cart for 10 minutes and report how many times I get hit."
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.
pico-8-mcp
An MCP server that lets an AI assistant build, test and balance PICO-8 games —
not just count tokens. Edit a .p8 cart, validate it, simulate a whole 25-minute game headless in about a minute,
author sprites / sound effects / music from readable notation, and launch the real PICO-8 to take screenshots.
Works with Claude Code, Claude Desktop, Codex, Cursor, or any other MCP client.
Credits. This is a fork of EBonura/pico8-mcp-server, which provided the original server and the cart analysis tools. Token counting, linting, minification and cart parsing come from shrinko8 by thisismypassport. PICO-8 is made by Lexaloffle. This fork adds the headless simulator, window control, data-section authoring and the workflow skill.
Why
Writing PICO-8 games with an LLM hits the same walls every time: you can't see the game, you can't play it for 20 minutes to check the balance, lint drowns you in false positives about globals, and the sprite / sfx / music sections are raw hex nobody should type by hand. The tools here remove each of those:
Problem | Tool |
"Does it crash 12 minutes in?" / "Is sector 4 too hard?" |
|
"Does this helper function work?" |
|
"What does it look like?" |
|
"Draw me a sprite / write a jingle" |
|
300 lint warnings about globals |
|
Related MCP server: agent-game-engine
Install
Requirements: PICO-8 (any recent 0.2.x), Python 3.11+, uv.
git clone --recurse-submodules https://github.com/nutshot2000/pico-8-mcp.git
cd pico-8-mcp
uv syncPICO-8 is auto-detected in the usual install locations on Windows, macOS and Linux, or set PICO8_EXE to the
executable path. The window tools (run_cart, send_keys, capture_game) are Windows-only for now; everything
else, including headless simulation, is cross-platform.
Claude Code
claude mcp add pico8 --scope user -- uv --directory /path/to/pico-8-mcp run server.pyClaude Desktop / other clients
{
"mcpServers": {
"pico8": {
"command": "uv",
"args": ["--directory", "/path/to/pico-8-mcp", "run", "server.py"]
}
}
}Optional: the workflow skill
skills/pico8-dev/SKILL.md teaches Claude Code the edit → validate → simulate → look loop and the PICO-8
gotchas that bite LLM-written carts (fixed-point overflow, token budget, uninitialised globals). Copy it to
~/.claude/skills/pico8-dev/SKILL.md and it loads automatically whenever PICO-8 comes up.
The workflow
Edit the
__lua__section of the.p8as plain text.validate_cart— tokens (8192 max), compressed size, syntax, meaningful lint.simulate_cart— run it. Catch runtime errors (reported with cart line numbers) and read your own telemetry: levels per minute, kills, enemies on screen, boss HP, hits taken. Usepatchesto inject a god mode or an autopilot so the game plays itself;stop_whento end on win/death.set_sprite/set_sfx/set_music, thenrender_gfxto check the art.run_cart+capture_gamewhen you actually need to see it.
Example simulate_cart call:
{
"cart_path": "game.p8",
"seconds": 1500,
"setup_lua": "newgame() st=\"play\"",
"log_every": 60,
"log_lua": "\"lvl=\"..p.lvl..\" hits=\"..hits..\" enemies=\"..#e..\" boss=\"..(boss and boss.hp or 0)",
"stop_when": "st==\"win\" or st==\"over\"",
"patches": [
{"old": "function hurt_p()\n if p.inv>0 then return end\n",
"new": "function hurt_p()\n if p.inv>0 then return end\n hits+=1 p.inv=60 do return end\n"}
]
}returns
[1:00] lvl=3 hits=2 enemies=4 boss=0
[2:00] lvl=5 hits=4 enemies=3 boss=0
...
[24:39] STOP lvl=31 hits=33 enemies=0 boss=0Tools
Analysis (from shrinko8)
validate_cart
(cart_path, lint="default"|"all"|"none")count_tokens, analyze_cart, search_code, compare_carts, list_carts, minify_cart
read_cart
(cart_path, section)— code with PICO-8 glyphs intact, plus a summary of the sprites / sfx / music defined
Headless execution (pico8 -x)
simulate_cart
(cart_path, seconds, setup_lua, log_every, log_lua, stop_when, patches, call_draw, timeout)run_headless
(cart_path, driver_lua, timeout)
Window control (Windows)
run_cart
(cart_path, width=1024, height=1024, restart=true)—restart=truecloses any PICO-8 already running; passfalsewhen a human may be playing in their own windowsend_keys
(keys)—x z c v up down left right enter esc p space r f6,wait:MS,hold:KEY:MScapture_game
(keys?, delay_ms, count, interval_ms, max_size)— PNG screenshots of the game areastop_cart
Data authoring
set_sprite
(cart_path, index, rows, overwrite=false)— rows of hex digits; 8×8 or larger blocks. The sheet is a 16-wide grid of 8×8 cells, so a 16×16 sprite atindexalso occupiesindex+1,index+16andindex+17and is drawn withspr(index, x, y, 2, 2). Place 16×16 sprites at 0, 2, 4 … and 32, 34 … — never at consecutive indices. The tool refuses to write a multi-cell block over cells that already contain pixels (the error explains the stride);overwrite=trueforces it, e.g. when redrawing an existing sprite. The result includes the coveredcellsand the matchingspr()call.render_gfx
(cart_path, sprites="0-15", scale, size=8)— each index is one 8×8 cell by default, so a 16×16 sprite appears as four labelled quarters; passsize=16and list the top-left indices to see it wholeset_sfx
(cart_path, index, notes, speed, wave, volume, effect, loop_start, loop_end)—note:len:wave:vol:fxtokens,r= rest, a4 = 440 Hz, range c2..d#7set_music
(cart_path, pattern, channels[4], loop_start, loop_end, stop)
PICO-8 facts the tools rely on
Numbers are 16.16 fixed point: anything above 32767 wraps negative. A frame counter overflows at 18:12 and
for i=1,36000runs zero times. Track time in seconds; keep scores small.Code budget: 8192 tokens, 65535 chars, 15616 compressed bytes.
__gfx__rows are 128 hex chars,__sfx__rows 168 chars (00 speed loop_start loop_end+ 32 ×pitch wave vol fx),__music__rowsflags ch0ch1ch2ch3with41..44meaning a muted channel.pico8 -x cart.p8runs a cart headless;printhgoes to stdout. On a runtime error it prints the message and hangs, and if_update/_drawexist it starts the game loop — the server handles both.The screen is always 128×128;
-width/-heightonly scale the window.
Development
uv run python test_p8tools.py # runs against examples/demo.p8
uv run python test_p8tools.py my.p8 # or your own cart
uv run python test_tools.py # the analysis-tool smoke tests take the same optional cart argumentserver.py registers the MCP tools; p8tools.py holds the simulator, window control and data authoring;
shrinko8/ is the analysis submodule. Contributions welcome — a macOS/Linux capture backend and a set_map
tool are the obvious next additions.
License
MIT — see LICENSE. shrinko8 is MIT licensed by its author; the original server is © EBonura.
This server cannot be deployed
Maintenance
Related MCP Connectors
AI game assets for agents: consistent sprites, 2D animations, tiles, maps, music and engine exports.
Create, test and play AI-native games through server-authoritative contracts.
Generate game assets with AI: sprites, 3D models, animations, sound effects, music, and voices.
Turn prompts into production-ready game assets: animated characters, textures, terrain, VFX, HUD.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to build and test games headlessly using the llmgine game engine, with tools for world creation, prefab definition, spawning, acting, and simulation.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to create, run, and debug 2D games in a sandboxed engine, providing tools for simulation, state inspection, and quality validation.1MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to procedurally generate, edit, quantize, and export 2D retro pixel art textures and tilesets for game development, with built-in palettes, dithering, and pixel-level manipulation tools.14MIT
- FlicenseNot gradedqualityCmaintenanceEnables generating game assets from natural language prompts, including sprite sheets, animations, voiceover, sound effects, chiptune music, tilesets, backgrounds, VFX, and cohesive asset packs with shared style and audio DSP presets.-