GUIDE
How do you generate game assets with a coding agent?
You do not ask the agent to draw. You generate art in PX-Art, where it lands in a structured game project, then connect the agent over a read-only MCP endpoint so it can list your games, search assets, preview candidates, pull short-lived download links and write the loading code itself. The agent never paints pixels and never spends credits — it reads structure and writes integration code.
Why the naive version fails
The obvious approach — telling a coding agent "make me a walk cycle" — fails for a mundane reason: the agent has no image model in the loop, no memory of what your other assets look like, and no place to put the result. Even when a picture appears, nothing records that it belongs to the same character as yesterday's idle animation, at the same scale, in the same palette.
The split that does work assigns each side the thing it is good at:
PX-Art generates and remembers
Generation runs inside a game project with fixed modules — characters, actions, effects, UI design, cards & icons, map. Output keeps its type, its animation relationships, its origin and its tags. The game holds the style; consistency mechanisms hold the character.
The agent reads and integrates
Over read-only MCP the agent sees games, structure, characters, asset families, individual assets with frame and component parameters, scene layout, and verifiable scene bundles. Then it writes the code that loads them.
The MCP surface is read-only by design. There is no generate tool, no write tool, no delete tool. An agent cannot spend your credits, cannot modify a scene, and cannot reach another user's data.
The workflow, step by step
- Create the game and settle the styleThe game-level style key and tags decide how everything in that project looks. Do this before bulk generation, not after.
- Generate what the build needsCharacter bases, then actions per facing; effects as looping or one-shot; UI kits; tilesets in the perspective you actually use (top-down, orthographic 45 degrees, side-view, or isometric — these are independent dimensions, not variants of one thing).
- Arrange scenes if the game has maps or full-screen UIThe Arrange workspace stores canvas size, layers, coordinates, asset references and map cells — which is exactly what an agent later needs to reproduce the screen in code.
- Unlock and issue a read-only tokenAny subscription payment or top-up purchase permanently unlocks read-only MCP; there is no separate MCP fee. The token is shown once, is scoped to your own games, and can be revoked at any time. Regenerating it invalidates the old one immediately.
- Point the agent at the endpointStreamable HTTP,
POST https://px-art.com/api/mcp, headerAuthorization: Bearer pxr_..., protocol version2025-11-25(2025-06-18is also accepted at handshake). - Let the agent orient itself before it asks for filesThe tool order is the recommended flow:
list_gamesto pick a project and read its design language,list_game_structureto resolve page and tag IDs,list_charactersto keep one logical character's views and actions together,list_asset_familiesto see what each set can cover,search_assetsto shortlist,preview_assetsto look, and only thenget_asset_downloads. - Have it write files and code in the same passDownloads are short-lived, so the agent should fetch immediately into the repo and generate the loader in the same turn rather than storing URLs.
A real exchange
Check the connection first — this is the whole verification:
curl -X POST https://px-art.com/api/mcp \
-H "Authorization: Bearer pxr_YOUR_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Then a shortlist request. search_assets takes notebookId plus optional query, kind, familyId, role and limit:
{"jsonrpc":"2.0","id":2,"method":"tools/call",
"params":{"name":"search_assets",
"arguments":{"notebookId":12,"familyId":"kit-wood","role":"button"}}}
Each returned asset is directly readable and carries the parameters an engine needs:
{"assetId": 88, "uri": "asset://88@1752...", "name": "wood panel 01",
"kind": "ui", "w": 96, "h": 96, "frames": 1,
"role": "panel",
"family": {"id": "kit-wood", "from": "kit"},
"component": {"type": "panel9", "slice": {"l":8,"r":8,"t":8,"b":8}}}
Note what the agent gets for free here: role says what the asset is for, family says which generated set it belongs to (so style consistency is checkable rather than guessed), and component.slice says this panel must be nine-sliced instead of stretched. An agent that ignores slice ships a panel with smeared corners.
search_assets returns {assets, truncated}. When truncated is true there is more behind the filter — raise limit or narrow with kind, familyId or role.
Delivering a whole screen at once
When the agent needs an entire arranged scene rather than loose assets, get_scene_bundle returns one contract with everything, including content hashes:
{
"contractVersion": 1,
"sceneId": 42,
"revision": 7,
"root": "scene-42-r7",
"files": [
{"path":"scene.json","mimeType":"application/json","size":2310,"sha256":"..."},
{"path":"map.tmj","mimeType":"application/json","size":980,"sha256":"..."},
{"path":"assets/88-grass.png","mimeType":"image/png","size":4096,
"sha256":"...","assetId":88,"downloadUrl":"https://img.px-art.com/v1/image?...",
"expiresAt":1784000000}
]
}
The rule for the agent is short enough to put in a prompt: create the root directory, write files that carry content verbatim, download files that carry a downloadUrl, then verify size and the returned hash. Paths inside scene.json and map.tmj already point at assets/{assetId}-{filename}, so no rewriting is needed. Non-map scenes simply have no map.tmj.
A scene bundle packs at most 50 dependent assets; past that the tool returns a clear error rather than a truncated bundle.
Reading coordinates without guessing
Scene compositions declare their own coordinate convention, so the agent never has to infer it:
{"unit":"pixel","origin":"top-left","xAxis":"right","yAxis":"down",
"transform":"absolute-rect","ordering":"layer-order-then-draw-order"}
Nodes are flat rectangles — no parent-child transforms, no rotation, no anchors — so a node's rect is the final world-space result with scale already folded in. z is a global draw order across layers, and revision is a version number: the same scene at the same revision returns byte-identical output, which makes caching and diffing safe.
Limits and caveats
- The agent cannot generate. Nothing in the MCP surface writes, generates or deletes. Art creation happens in the app, by you.
- MCP is a paid-account feature. Any subscription payment or top-up purchase unlocks it permanently. Paid status is re-checked when the token is issued and on every call, so it cannot be bypassed by calling the API directly. Formal checkout is still under review and not open yet.
- One valid token per person. Regenerating it revokes the previous one instantly, and any client still holding the old token breaks at that moment.
- Reads are audited. Every request logs time, method, what was read, success, the client's self-reported name and source IP — visible only to you, and only through the web login. Responses and the token itself are not logged.
- Download URLs expire. Fetch immediately into the project. Never commit a token or a download URL to a repository.
- Rate limits exist. A normal browsing cadence will not hit them; a parallel bulk pull will. On
429, back off usingRetry-After. - No scene screenshot. Per-asset thumbnails exist; a rendered picture of the whole scene does not. The agent has to render it in your engine to see it.
- Generation is probabilistic and assets need your review before production use. Commercial use is allowed for legitimately generated assets, but third-party rights, local law and AI provider terms remain your responsibility.
Details of the agent-facing surface live on AI game assets for coding agents and MCP game assets; the in-app panel is described on Agent / MCP.
FAQ
Can a coding agent create the artwork itself through PX-Art?
No. The MCP surface is strictly read-only: there is no generation, write or delete tool. You generate assets in the PX-Art app, and the agent reads what exists. This also means an agent cannot spend your credits.
Which coding agents can connect?
Any MCP client that speaks Streamable HTTP, which includes Cursor, Claude Code and Codex. The connection is a POST endpoint at https://px-art.com/api/mcp with an Authorization: Bearer header; the protocol version negotiated at handshake is 2025-11-25 or 2025-06-18, and both expose the same capabilities.
What should the agent call first?
list_games. A freshly connected agent knows nothing about your projects, and list_games returns the game IDs, names, asset-kind counts and the design language (style key, tags, standard tile size). From there, list_game_structure and list_characters explain the IDs that appear in every other result.
How does the agent avoid mixing incompatible art styles?
Two signals. list_games exposes the game's design language including its style key, and list_asset_families exposes each family's own style key plus its original generation description. Comparing the two shows whether a family matches the current project, which matters for older families generated under a different style.
Does using MCP consume credits?
No. All MCP tools are read-only and free to call. Credits are consumed only by generation inside the app: 5 for a static image, 10 for a frame-based action, 18 for a video-based action, 10 for a spell, 15 for an effect, 25 for a UI kit and 2 per local edit.
How does the agent get the actual image files?
Through get_asset_downloads for up to 50 assets at a time, or through get_scene_bundle for a full scene. Both return short-lived download URLs plus file names, sizes and content hashes. Images are delivered straight from edge storage, not proxied through the backend, and download URLs must be used immediately rather than stored.
Related
Let your agent read your art project
Generate assets in a structured game project, then hand your coding agent a read-only token scoped to your own games.
Create a free accountSee pricingNew accounts start with 20 credits. Formal checkout is still under review and not open yet.