Connect ToonLab to your AI coding agent
The ToonLab MCP server gives any MCP-compatible tool — Claude Code, Claude, Cursor, Codex, and others — direct access to asset search, AI generation, stored characters, and your cloud library. It keeps anime-game style, provenance, sourcing policy, and custom-gap decisions explicit instead of silently generating replacements. Included with Pro and Team plans.
https://toonlab.io/mcpSetup by client
Claude Code
claude mcp add --transport http toonlab https://toonlab.io/mcpThen run /mcp inside Claude Code to authenticate — your browser opens the ToonLab authorization screen once.
Claude (claude.ai and desktop)
- Open Settings → Connectors → Add custom connector.
- Enter
https://toonlab.io/mcpand confirm. - Sign in to ToonLab in the browser window and choose Authorize.
Cursor
Add the server to .cursor/mcp.json in your project (or the global ~/.cursor/mcp.json):
{
"mcpServers": {
"toonlab": {
"url": "https://toonlab.io/mcp"
}
}
}Everything else
Any client that supports remote MCP servers with OAuth works the same way: add https://toonlab.io/mcp as a remote server — most clients accept the JSON shape above — and approve access in the browser when prompted. Manage or revoke authorized clients any time in Settings → MCP.
{
"mcpServers": {
"toonlab-local": {
"command": "npx",
"args": ["-y", "@call-me-sensei/toonlab@latest", "--workspace", "/absolute/path/to/your-game/.toonlab"],
"env": { "TOONLAB_LEGACY_WORKSPACE": "1" }
}
}
}Tool reference
Anime style and sourcing policy
Load this contract before choosing shaders, models, textures, or custom work.
| Tool | What it does |
|---|---|
| get_anime_game_profile | Canonical Call Me Sensei v2 bundle, anime art direction, shader routes, discovery order, and strict tree/rock policy. |
| get_runtime_guide | Runtime entry points, shader/procedural separation rules, workflows, lab links, and runnable examples by topic. |
| validate_asset_candidate | Evaluate normalized source, provenance, license, and anime-fit metadata against strict, advisory, or open policy. |
| record_asset_gap | Create the JSON and Markdown entry required before custom models, textures, shaders, adapters, or generation. |
Live labs and features
Discover the complete authoring contract instead of asking a user to understand every configuration field.
| Tool | What it does |
|---|---|
| list_live_labs | Every public Beta Lab going live, its creation type, runtime package, management operations, and editable feature count. |
| get_lab_features | Complete field and document schemas, source/output capabilities, preview boundaries, and semantic operations for one live Lab. |
| create_lab_document | Create a valid starter for any Lab; a Rock template becomes the editable starting mesh for a template-based procedural project. |
Discover assets
Read-only. Search every ToonLab Pro collection before policy-permitted custom work.
| Tool | What it does |
|---|---|
| search_assets | Search indexed external CC0. Returns normalized source class, stable ID, provenance, license, anime-fit review status, and policy decision. |
| get_asset | Complete normalized metadata, source page, preview, and download URL for one indexed asset. |
| search_public_gallery | Unified search across community creations, all published first-party rock/tree assets, and indexed external open assets. First-party rock results include exact width/height/depth in meters, family/profile, and geological taxonomy so agents can shortlist without rendering. |
| get_toonlab_asset | Complete recipe, taxonomy, provenance, previews, artifact downloads, runtime guidance, and a source-GLB Lab starter for one first-party rock. |
Your library
Full CRUD for the signed-in user's creations. IDs never grant access to another user's work.
| Tool | What it does |
|---|---|
| list_my_creations | Search your saved presets and projects by text, exact tags, and type; paginate with nextOffset. |
| get_my_creation | Open one creation by id, including its portable JSON document. |
| save_creation | Save or update a portable preset/project document in your private library. |
| update_creation | Replace or merge-patch an owned portable document and edit its label, description, tags, or private/team visibility. |
| mutate_lab_creation | Apply a validated feature or structural Lab operation to an owned creation. |
| delete_creation | Delete an owned, unpublished creation with explicit confirmation. Published sources remain for the audit trail. |
| save_generated_asset | Save a ready generated 3D model or grouped PBR material into your library. |
Generate
Generation is custom work: policy approval and a recorded gap are required before credits can be spent. Fal Patina materials keep their preview, variants, maps, and manifest together as one asset. Choose Meshy or Tripo deliberately for 3D; their capabilities are not interchangeable.
| Tool | What it does |
|---|---|
| get_generation_capabilities | Plan, credit balance, enabled image/material/3D providers, supported kinds/resolutions, default credit costs, and Patina controls. Call this first. |
| generate_asset | Start images, one grouped Fal Patina PBR material, or 3D with an explicit model_provider. Meshy 7 accepts PNG/JPEG image or 2–4-image multiview input; Text + Meshy creates a concept through image_model first. Tripo supports direct text/image/multiview and model segmentation. |
| get_generation_job | Poll one job: progress, suggested polling interval, temporary download URL when ready. |
| get_generation_jobs | Poll up to 20 jobs in one call — preferred when tracking a batch. |
Characters
Stored character profiles keep generations consistent across sessions.
| Tool | What it does |
|---|---|
| list_characters | Your characters with tags and available option names (outfits, hairstyles, poses, …). Call before generating a character. |
| get_character | Full structured profile plus the reference-image inventory. |
| save_character | Create or update a character: identity, personality, appearance, art style, and option lists. |
| add_character_image | Attach a reference image (from a ready generation job or uploaded bytes) as identity, style, or per-option ground truth. |
Protocol and result envelope
The endpoint implements remote Streamable HTTP MCP and OAuth 2.1. Tool arguments are JSON objects. Successful calls return the value in structuredContent plus a compact JSON text fallback in content[0].text. Validation, authorization, policy, quota, and missing-target failures return a tool result with isError: true; malformed JSON-RPC requests use normal JSON-RPC errors. Responses containing account data are sent with Cache-Control: private, no-store.
Lab management API
Start with list_live_labs, then call get_lab_features for the chosen Lab. This is the contract an agent should use when it needs to author a creation without making the user translate dozens of controls by hand.
| Lab id | Creation type | Owns |
|---|---|---|
| shader | toon-preset | Toon shader settings |
| tree-shader | vegetation-shader-preset | Tree material profile |
| grass-shader | vegetation-shader-preset | Grass material profile |
| flower-shader | vegetation-shader-preset | Flower material profile |
| rock-shader | rock-shader-preset | Rock and geology material |
| terrain-shader | ground-shader-preset | Terrain and ground material |
| manufactured-material | manufactured-surface-profile | Manufactured surfaces |
| water | water-preset | Water and liquid |
| sky | sky-params | Sky-owned parameters |
| cloud-shader | sky-params | Cloud-owned parameters |
| sky-cloud | sky-params | Integrated sky and cloud |
| rock | rock-project | Procedural and source-GLB rock geometry |
| tree | tree-recipe | Procedural tree and shrub |
| grass | grass-preset | Grass and groundcover |
| texture | texture-recipe | Procedural material maps |
get_lab_features response
{
"lab": {
"id": "rock-shader",
"creationTypes": ["rock-shader-preset"],
"management": { "creationCrud": ["create", "read", "update", "delete"] }
},
"capabilities": {
"authoring": { "featureMutation": "set_feature", "structuralOperations": [] },
"outputs": ["portable-preset", "runtime-style-bundle"],
"preview": { "clientOwned": true, "persisted": false }
},
"featureCount": 68,
"schema": { "material": { "tint": { "type": "color" } } },
"documentContract": {
"creationType": "rock-shader-preset",
"discriminator": { "path": "schema", "value": "toonlab/rock-shader-preset" },
"schemaVersion": 1,
"versionPath": "version",
"idPath": "id",
"labelPath": "label",
"featureRoot": "settings",
"featureApplication": "direct",
"docKey": { "path": "id", "requiredSeparately": false },
"jsonSchema": {},
"starterDocument": {}
}
}The response includes every field descriptor, a structural JSON Schema, source/output capabilities, and a populated schema-valid starterDocument. Prefercreate_lab_document for new documents and mutate_lab_creation for validated edits. featureRoot identifies where direct settings live. Tree recipes report compiled-authoring-state because their UI controls compile into recipeoptions. Rock projects have no internal id, so their document key must be supplied separately.
Rock source-mesh edits use compact base64-f32le-v1 float32 storage, with a portable-project budget of 200 operations and 10,000 vertex deltas. The editor restores the normal editable arrays on load. Adaptive meadow grass, camera, lighting, and viewport state remain preview-only. First-party Rock details include a ready labStart document that retains the selected released GLB and its Call Me Sensei material.
Creation CRUD API
| Tool | Required | Optional / limits |
|---|---|---|
| list_my_creations | none | query, exact-AND tags, types, offset, limit 1–100; follow nextOffset. |
| get_my_creation | id UUID | Returns the complete owned row and portable document. |
| save_creation | type, doc_key, label, document | Optional description and up to 10 tags (32 characters each); document at most 256 KiB UTF-8. |
| update_creation | id UUID | Exactly one of replacement document or RFC 7396 patch; metadata may include label, description, up to 10 tags, and private/team visibility. |
| mutate_lab_creation | id UUID, lab, operation | Validated set_feature for all 15 Labs plus advertised structural operations. |
| delete_creation | id UUID, confirm: true | Idempotent. Published source creations are retained for their publication audit trail. |
doc_key is portable identity within a creation type. The returned creation UUID is the management identity for subsequent reads, edits, deletes, and Open in Lab. Supplying another account's UUID returns the same not-found result as an absent creation. Team visibility requires current team membership. A merge-patch null removes the addressed property; clients should preserve the discriminator and schema version.
The private Library is a first-class discovery source, not a list-only fallback. Human developers use the same name/type/tag filters on the Library page; coding agents uselist_my_creations. Tags are normalized lowercase slugs and persist across save, update, Lab sync, and later publication, where Gallery search uses them too.
{
"type": "rock-shader-preset",
"doc_key": "harbor-cliffs",
"label": "Harbor cliffs",
"description": "Reusable cliffs for the harbor district",
"tags": ["harbor", "cliff", "outdoor"],
"document": { "...": "copy and edit documentContract.starterDocument" }
}{
"id": "8a6e6bf7-693a-4a4d-9da5-a7c64bc3c842",
"patch": { "settings": { "material": { "tint": "#d9cba4" } } },
"label": "Warm quay rock",
"tags": ["harbor", "quay", "warm-stone"],
"visibility": "private"
}Hosted Lab synchronization
Every Lab in the table round-trips its named portable documents to the signed-in library. Browser drafts remain local and are not silently promoted into creations. Opening an owned, team-visible, unlisted, or public creation injects that exact document into its native Lab store before boot and selects it through the Lab's URL contract. Sky, Cloud, and Sky & Cloud intentionally share one sky-params library; their ownedPathsmetadata tells an agent which parameter groups each focused surface owns.
Validation, limits, and errors
- Creation documents are validated against their registered portable schema before save or replacement.
- The 256 KiB document limit is measured as UTF-8 bytes, so non-ASCII text consumes its actual encoded size.
- Deletion requires the literal boolean
confirm: true. - Generation requires policy approval, a recorded gap, sufficient entitlement/credits, and a UUID idempotency key.
- Use the pagination fields returned by search tools; do not assume the first page exhausts a catalog.
- Temporary generated-asset downloads expire. First-party public catalog artifact URLs are immutable.
How generation and credits work
A kind: "material" request uses Fal Patina. ToonLab stores and displays the generated preview, every variant, the requested base-color/normal/ roughness/metalness/height maps, and the JSON manifest as one material unit. Resolution presets run from 1K through 8K; custom map counts, variants, inference steps, prompt expansion, and upscaling determine the exact charged credits.
Provider selection is part of the contract. Pass model_provider: "meshy" for Meshy 7 or model_provider: "tripo" for Tripo. Meshy image-to-3D accepts PNG/JPEG input and multi-view accepts 2–4 images. A text request with Meshy first creates a concept image through the selected image_model, then returns a parent concept jobId and child model childJobId/jobIds to poll. Meshy does not support model segmentation; use Tripo for that operation. Ifmodel_provider is omitted, the current Pro compatibility default is Tripo, so agents that intend Meshy must never rely on omission.
- Discover and validate first. Search the project library, ToonLab gallery, and only then policy-permitted external sources. The gallery tool covers community work plus every published ToonLab rock and tree; use
source: "toonlab",catalog: "rock"or"tree", and the returnednextOffsetto exhaust a catalog. Rock results exposedimensionsMetersplus family, profile, and taxonomy for selection before download. A strict denial cannot be bypassed by generation. - Record the gap. Call
record_asset_gapand write its result to.toonlab/reports/style-asset-gaps.jsonandTOONLAB_ASSET_GAPS.md. - Check first.
get_generation_capabilitiesreturns your balance, enabled providers/models, supported operations, and the exact credit cost of every kind and resolution — agents should call it before spending. - Generate.
generate_assetrequires the approved policy, semantic domain, and recorded gap id, then spends exactly the quoted cost. Each call takes a freshidempotency_key(a UUID), so a retried request returns the original job instead of spending twice. - Chain to 3D. Pass
auto_chain: trueon an image kind and an explicitmodel_providerto queue image→3D after the image is ready. For Meshy text mode, also chooseimage_model; both stages are visible and pollable. Combined costs are reserved up front and each failed step refunds itself. - Poll and save.
get_generation_jobsreturns progress and a suggested polling interval; when ready, download from the temporary URL or persist withsave_generated_asset.
Shaders and procedural runtime
Call get_runtime_guide with shaders, procedural,rock, tree, texture, or style-bundles. The response names the public package entry points and gives runnable examples. The key contract is deliberate: generators own geometry, editable recipes, labels, baked channels, LOD, and collision; domain shaders own appearance. Labs are authoring examples rather than runtime dependencies.
Security
Access uses OAuth 2.1 with PKCE — your password is never shared with the client, tokens are scoped to the permissions shown on the authorization screen, and generation tools are flagged as consequential actions so well-behaved agents confirm before spending credits. Creation reads, edits, and deletes are ownership-scoped on the server; a creation UUID belonging to another account does not grant access. Revoke any client from Settings → MCP; revocation is immediate.
Next
The prompt cookbook shows how to put these tools to work — from the first "start a game" prompt to character-consistent art pipelines.