PixelLabRat
MCP server for generating style-consistent pixel art assets from PixelLab API, with project management, asset review, and an embedded Claude assistant.
README
PixelLabRat
A local, project-based desktop app and MCP server for generating style-consistent pixel art with the PixelLab API.
Point it at a project, describe what you want, and it keeps every asset — characters, objects, tilesets, UI, animations — on the same visual style. There's an embedded Claude assistant for hands-off art direction, and the whole thing doubles as an MCP server so you can drive it from Claude Code.
It's built for game dev, where you end up needing dozens of matching sprites and don't want each one to look like it came from a different game.
What it does
- Per-project style contract. A style description, perspective and transparency settings, and up to four reference images that get applied to every generation automatically. Generate until you like a look, promote it to a reference, and everything after that matches it.
- The full PixelLab toolset, wrapped so it's actually usable from one prompt:
- Text-to-pixel-art (Pixflux) and style-matched generation
- Characters with up to 8 directional rotations, and animations per direction
- Objects (8-direction, or single-view with a candidate picker)
- Tilesets — top-down and sidescroller — plus standalone isometric tiles
- UI elements (buttons, bars, panels, icons)
- Image ops: background removal, upscale-to-pixel-art, rotate, resize, text-described edits, and inpainting with a mask you paint by hand
- Asset library with review. Everything lands as a draft you can approve, reject, rate, or promote to a style reference. Click any thumbnail to see it big; animations play back full size.
- An embedded assistant ("Art-Director"). A Claude agent that drives the same
actions you do and keeps a per-project
STYLE_GUIDE.mdas memory. It uses your Claude Code login or subscription if you have one, so no separate API key is required. - MCP server. The same project-aware actions exposed as MCP tools, so Claude Code or any MCP client can generate art directly.
A project is just a folder — a small manifest, a few JSON files, and the PNGs — so there's no database to manage and you can check assets into git alongside your game.
Requirements
- Bun — the repo is a Bun workspace
- A PixelLab account and API token (https://pixellab.ai/account)
- Optional: Claude Code or a Claude API key, if you want the in-app assistant
Getting started
bun install
cp .env.example .env # put your PixelLab token in API_KEY
The generated PixelLab client is checked in, so that's all you need. (bun run gen:api regenerates it from API.json and is only relevant if you're updating
the vendored API spec.)
Then run the desktop app:
bun run app:seed # optional: creates a "Slime World" demo project
bun run app:dev
Projects live under projects/ in dev, or the app's user-data directory when
packaged. Set PIXELLABRAT_PROJECTS_DIR to point the app and the MCP server at
the same folder.
If the app fails to start with
Cannot read properties of undefined (reading 'isPackaged'), your shell hasELECTRON_RUN_AS_NODE=1set (some IDE terminals do this). Start it withenv -u ELECTRON_RUN_AS_NODE bun run app:dev.
The embedded assistant
The chat panel (the ✨ Art-Director button) runs a Claude agent with tool access.
It can generate, review, manage the style contract, and check your balance — the
same things you'd do by hand — and it writes notes to the project's
STYLE_GUIDE.md so it stays more consistent over time.
Auth is picked automatically:
- Logged into Claude Code? Nothing to do. The app detects it and uses your Claude subscription.
- Otherwise, the "Connect Claude" button runs
claude setup-tokenand stores the token encrypted in your OS keychain (ElectronsafeStorage), so there's no.envediting. - API key: set
ANTHROPIC_API_KEYin.envfor pay-per-token use. It takes precedence if both are present.
The subscription path goes through the Claude Agent SDK and is meant for personal use — don't ship a multi-user app on a single subscription token.
Using it from Claude Code (MCP)
You can make art entirely from a Claude Code conversation — there's a full
walkthrough in docs/using-with-claude-code.md,
an art-brief template for bootstrapping a project,
and two skills under .claude/skills/: pixel-art (the
generation workflow) and pixel-cleanup (find and remove stray edge artifacts
from a sprite with ImageMagick). Copy them to ~/.claude/skills/ to use them from
any repo.
The repo ships a .mcp.json, so Claude Code picks up the pixellabrat server
automatically when started from the project directory. To register it manually:
claude mcp add pixellabrat -- bun run /abs/path/to/PixelLabRat/packages/mcp/src/server.ts
The server exposes the full project-aware toolset (28 tools) — anything the app or the in-app assistant can do, Claude Code can do too. A selection:
| Tool | What it does |
|---|---|
pixellab_balance |
subscription generations + USD credits |
pixellab_project_create / _list / _style |
manage projects and the style contract |
pixellab_project_generate / _generate_ui |
generate an image / UI element in the project style |
pixellab_project_create_character / _animate_character |
characters and per-direction animations |
pixellab_project_create_object / _select_object_frames |
objects, including the single-view candidate picker |
pixellab_project_create_tileset / _create_isometric_tile |
tilesets (top-down/sidescroller) and isometric tiles |
pixellab_project_edit_asset / _inpaint |
image edits and masked inpainting |
pixellab_project_review |
approve / reject / promote an asset |
Project layout
A Bun monorepo, TypeScript throughout. The PixelLab v2 client is generated from
API.json.
packages/
core/ HTTP client, auth, the typed PixelLab wrapper, async job polling
store/ the project store (folders + JSON), style contract, generation logic
mcp/ the MCP server
agent/ the embedded Claude agent (tools + system prompt)
app/ the Electron + Vue 3 desktop frontend
A note on credits
Everything bills against PixelLab subscription generations, Pro endpoints included, so you don't have to top up USD credits. As a rough guide, Pixflux is about one generation and style-matched generation about twenty; characters and tilesets are the expensive ones. While an async job is still processing the API returns a placeholder usage value, so the app reads the real cost from the completed response.
Development
bun run typecheck # core/store/mcp/agent
bun run store:check # headless store test, no API calls
bun run mcp:check # MCP round-trip, no API calls
bun run agent:check # agent tools + prompt (add --live for one real turn)
bun run smoke # show your balance (free); --generate runs a full transfer
bun run app:build # production build
The *:check scripts run offline so you can iterate without spending generations.
Contributing
Issues and pull requests are welcome. Please keep things typechecking
(bun run typecheck) and avoid spending real generations in tests.
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。