Scratch MCP Server
Builds and edits real Scratch 3 projects, including sprites, costumes, backdrops, sounds, speech, block scripts, and export as .sb3 files.
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., "@Scratch MCP Server make a classroom scene with two students talking to each other"
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.
Scratch MCP Server
An MCP server that builds real Scratch 3 projects from a prompt.
Ask for a scene in plain language — "put two characters on a classroom background and make them take
turns talking" — and the assistant drives this server to produce a .sb3 file that opens in the Scratch
editor with proper sprites, costumes, backdrops, sounds and block scripts.
Nothing is faked: the output is the same project format Scratch saves, so every script is editable in the Scratch editor afterwards.
What it can do
Backdrops — nine built-in stage backgrounds (sky, hills, night, space, room, underwater, grid, blank, any flat colour), or your own image file.
Sprites — built-in vector shapes, or your own art.
Character import — hand it a jpg/png of a character on a flat background; it keys the background out, trims the margins, scales it to the stage and can build talk frames so a still picture reads as talking when the costumes alternate.
Scripts — a compact JSON action DSL covering motion, looks, sound, events, control, sensing, variables, lists and the pen extension. It compiles to genuine Scratch blocks, hat blocks included.
Sounds — seven synthesised built-ins, or your own
.wav.Speech —
add_speechturns a line of text into a spoken sound using the machine's own offline text-to-speech engine, and reports the clip length plus the exact mouth-loop count needed to lip-sync a talking animation to it.Preview — serves the project to TurboWarp over loopback so you can watch it run before saving.
GIF export — an animated-GIF encoder, so a finished scene can be sent to someone who does not have Scratch.
Related MCP server: scratch-mcp
Install
npm install
npm run buildThen register it with your MCP client. For Claude Code:
claude mcp add scratch -- node "C:/path/to/Scratch-MCP-Server/dist/index.js"Or in a client config file (Claude Desktop, VS Code, …):
{
"mcpServers": {
"scratch": {
"command": "node",
"args": ["C:/path/to/Scratch-MCP-Server/dist/index.js"],
"env": { "SCRATCH_MCP_OUT_DIR": "C:/Users/you/Desktop" }
}
}
}SCRATCH_MCP_OUT_DIR sets where save_project writes when no path is given; it defaults to
./scratch-projects under the working directory.
Tools
Tool | What it does |
| Starts a project and sets the backdrop |
| Adds another stage backdrop, built-in or from a file |
| Adds a sprite from a built-in costume |
| Turns character art into a sprite: background removed, talk frames built |
| Adds another costume to a sprite |
| Adds a built-in or |
| Synthesizes a spoken line offline and attaches it as a sound |
| Lists the speech voices installed on this machine |
| Compiles an action list into blocks under a hat block |
| Removes every block from a target |
| Declares a variable and its starting value |
| Deletes a sprite |
| Lists everything in the open project |
| Writes the |
| Serves it and returns a link that runs it in the browser |
| The full DSL: hats, actions, expressions, built-in assets |
The script DSL
A script is a target, a hat block, and a list of actions. Every action is an object with exactly one key; an action that takes no argument can be written as a bare string.
{
"target": "Cat",
"when": "flag",
"do": [
{ "say": ["Hello!", 2] },
{ "forever": [ { "move": 4 }, "bounce_on_edge", "next_costume", { "wait": 0.1 } ] }
]
}Values can be expressions instead of literals, using the same one-key rule:
{ "if": { "test": { ">": [ { "var": "score" }, 10 ] },
"do": [ { "say": ["You win!", 2] }, { "stop": "all" } ] } }Call dsl_reference for the complete list — it is written to be read by the assistant, so in practice
you just describe what you want and it writes the scripts.
Making a still character talk
Scratch animates by swapping costumes. import_character builds two extra costumes that are subtly
squashed and stretched, so alternating them gives the bob of someone speaking — no speech bubbles
needed:
{ "target": "Girl", "when": { "broadcast": "girl talks" },
"do": [ { "repeat": { "times": 9, "do": [
{ "switch_costume": "Girl-talk-a" }, { "wait": 0.11 },
{ "switch_costume": "Girl-talk-b" }, { "wait": 0.13 } ] } },
{ "switch_costume": "Girl" },
{ "broadcast": "boy talks" } ] }Two characters passing broadcasts back and forth reads as a conversation, and it loops forever.
examples/students-talking.mjs builds exactly that scene:
node examples/students-talking.mjs "C:/path/to/art-folder" out/students-talking.sb3Speech and lip-sync
add_speech uses whatever offline engine the host already has — Windows SAPI and the WinRT speech API,
macOS say, or espeak-ng on Linux. No network, no API key, no audio file to manage.
Which voices exist differs per machine, so ask list_voices first. Request a voice by gender or by part
of its name; a voice that is not installed is an error rather than a silent substitution:
{ "target": "Boy", "text": "Almost. I still need to draw the diagram.", "voice": "male" }On Windows this matters more than it looks. System.Speech only sees the old SAPI5 voice store, which
on many machines contains female voices only; the male voices often live in the OneCore store and are
reachable only through the WinRT API. Both paths are implemented, and each voice is tagged with the
engine that can actually speak it.
The timing trap is worth stating plainly: play_sound_until_done blocks, so a mouth loop written after
it animates after the audio has finished. Use the non-blocking play_sound, then the loop —
add_speech returns the repeat count to use:
{ "target": "Boy", "when": { "broadcast": "boy talks" }, "do": [
{ "play_sound": "boy-line-1" },
{ "repeat": { "times": 13, "do": [
{ "switch_costume": "Boy-talk-a" }, { "wait": 0.11 },
{ "switch_costume": "Boy-talk-b" }, { "wait": 0.13 } ] } },
{ "switch_costume": "Boy" },
{ "broadcast": "girl talks" } ] }examples/students-talking-voice.mjs builds the full voiced conversation:
node examples/students-talking-voice.mjs "C:/path/to/art-folder" out/students-talking-voice.sb3Opening the result
Scratch 3: File ▸ Load from your computer ▸ pick the
.sb3.TurboWarp: drag the file onto the page, or use
preview_projectfor a link that loads it straight from localhost.
Tests
npm testnpm test runs two suites.
test/smoke.mjs drives the built server over stdio exactly like an MCP client: it builds a project that
exercises motion, looks, sound, speech, variables, conditionals and key/click hats, checks that bad
input comes back as a readable error rather than a crash, and — when the sample art is present — builds
the two-character talking scene.
test/gif-roundtrip.mjs encodes synthetic frames and decodes them again with an independent decoder
written for the test, comparing pixels. This matters more than it sounds: a browser's <img> tag will
happily display a GIF whose LZW stream is subtly malformed, so a strict decode is the only check that
proves the encoder is correct.
Notes and limits
Sounds import from
.wavonly. The built-in sounds and all generated speech are produced locally, so the server never needs the network.Speech quality is whatever the OS ships. The voices are serviceable rather than lifelike; this trades realism for working offline with no key and no upload.
Images import from
svg,pngandjpg. Background removal flood-fills inward from the border, so white clothing in the middle of a character survives; it expects a reasonably flat background.Custom blocks ("My Blocks") and the music/video/translate extensions are not implemented yet. The pen extension is.
The server holds one project in memory at a time;
create_projectreplaces it.
Licence
MIT — see LICENSE.
Available Tools
16 toolsadd_backdropAdd a backdrop to the stageA
Adds a stage backdrop, either a built-in (blank, solid, sky, hills, night, space, grid, room, underwater) or an image file from disk. The newly added backdrop becomes the one shown.
Inputs: file, name, backdrop.
add_costumeAdd a costume to a spriteA
Adds another costume to an existing sprite, from a built-in shape or an image file.
Inputs: target (required), file, name, costume.
add_scriptAttach a script to a sprite or the stageA
Compiles a JSON action list into real Scratch blocks and attaches it under a hat block. Example: {"target":"Cat","when":"flag","do":[{"say":["Hi!",2]},{"forever":[{"move":4},"bounce_on_edge"]}]}. Call dsl_reference for every available action, expression and hat.
Inputs: do (required), target (required), when.
add_soundAdd a soundB
Adds a sound to a sprite or the stage. Built-in sounds: pop, beep, boing, zap, click, chime, whoosh. Files must be .wav.
Inputs: file, name, sound, target.
add_speechGenerate a spoken line and add it as a soundA
Synthesizes speech with the machine's offline text-to-speech engine and attaches it to a sprite as a Scratch sound — no network, no file needed. Returns the sound's duration and a ready-made mouth-loop repeat count, so the talking animation can be timed to the audio. Use {"play_sound": name} (not play_sound_until_done) before the mouth loop so the animation runs while the audio plays.
Inputs: text (required), target (required), name, rate, +3 more.
add_spriteAdd a spriteA
Adds a sprite using a built-in costume (ball, square, triangle, star, heart, arrow, dot, line, buddy), optionally tinted like "ball:red". To use character art from a file, use import_character instead.
Inputs: name (required), x, y, file, +5 more.
clear_scriptsRemove every script from a targetA
Deletes all blocks on a sprite or the stage, leaving costumes and sounds alone.
Inputs: target (required).
create_projectCreate a new Scratch projectA
Starts a fresh project in memory and sets its backdrop. Replaces any project currently open. Built-in backdrops: blank, solid, sky, hills, night, space, grid, room, underwater (use "solid:#223344" for a flat colour).
Inputs: name (required), backdrop.
dsl_referenceScratch action DSL referenceA
Returns the full list of hat blocks, actions, expressions and built-in assets understood by add_script. Read this before writing scripts.
Inputs: topic.
import_characterImport character art as a spriteA
Turns a jpg/png character picture into a sprite: cuts away the flat background so it sits properly on the backdrop, trims empty margins, scales it to fit the stage, and optionally builds talk frames — extra costumes that, alternated in a loop, make a still character look like it is talking.
Inputs: file (required), name (required), x, y, +6 more.
list_voicesList the speech voices installed on this machineA
Shows every offline text-to-speech voice available here, with its gender, locale and engine. Voice availability differs per machine, so check this before asking add_speech for a particular voice.
Inputs: no named parameters.
preview_projectPreview the project in a browserA
Serves the project from localhost and returns a TurboWarp link that runs it immediately, without saving a file first.
Inputs: open, editor.
project_infoDescribe the open projectA
Lists sprites, costumes, sounds, scripts, variables and broadcasts in the open project.
Inputs: no named parameters.
remove_spriteRemove a spriteA
Deletes a sprite and everything on it.
Inputs: name (required).
save_projectSave the project as .sb3A
Writes the project to a .sb3 file that opens in Scratch 3 (File > Load from your computer) or TurboWarp.
Inputs: path.
set_variableCreate a variable or set its starting valueB
Declares a project-wide variable with a starting value. Variables are also created automatically the first time a script mentions them.
Inputs: name (required), value.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool targets a distinct resource and action: sprites (add/import/remove), costumes, sounds, speech, backdrops, scripts, variables, and project-level operations. The only potential overlap (add_sprite vs import_character) is explicitly disambiguated in the descriptions, as is add_sound vs add_speech. No tool appears to duplicate another.
The majority of tools follow a consistent verb_noun pattern (add_*, list_*, create_*, save_*, preview_*, remove_*, clear_*, set_*, import_*). However, two tools (project_info, dsl_reference) use a noun-first naming convention, breaking the pattern slightly. This deviation is minor but noticeable.
With 16 tools, the server covers a broad but focused scope: project creation, sprite management, costumes, sounds, speech, backdrops, scripts, variables, and output (save/preview). Each tool serves a distinct purpose in the workflow, and the count is appropriate for the feature set offered.
The tool surface covers the full lifecycle of creating a Scratch project: create, populate (sprites, costumes, sounds, backdrops, scripts, variables), inspect, and export. Missing operations like editing individual costumes/sounds or renaming sprites are minor gaps that can be worked around (e.g., by removing and re-adding), and the included features are sufficient for most project-building tasks.
Maintenance
Related MCP Connectors
Create and edit PlayableMaker playable ads from chat and download them as projects.
Generate game-ready 3D models, textures, and audio from natural language, over MCP.
Build, version, review, and export websites, web apps, and games from a conversation.
Turn prompts into production-ready game assets: animated characters, textures, terrain, VFX, HUD.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to programmatically edit Scratch .sb3 projects and preview changes live in TurboWarp Desktop via MCP tools and a live-reload bridge.2Mozilla Public 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, compile, and run Scratch projects by editing plain text and using a live editor loop.30 npm1Mozilla Public 2.0
- AlicenseAqualityDmaintenanceEnables AI assistants to create and edit GameMaker projects, including scripts, objects, rooms, sprites, and sounds, with support for project validation and compilation.452MIT
- FlicenseAqualityCmaintenanceEnables AI agents to build and edit MIT App Inventor projects as .aia files, supporting screens, components, properties, blocks, assets, and project merging.10-