microbit-makecode-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MAKECODE_URL | No | Editor URL (default https://makecode.microbit.org/; e.g. the beta editor) | https://makecode.microbit.org/ |
| MAKECODE_CDP_URL | No | Attach to this DevTools endpoint instead of discovering one (e.g. http://127.0.0.1:9222) | |
| MAKECODE_BROWSER_DATA_DIRS | No | Browser profile folders to look in for DevToolsActivePort (path-list separated) |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Controls Microsoft MakeCode for the BBC micro:bit (makecode.microbit.org) inside the browser the user already has open (it never launches its own). If a tool reports that no browser is reachable, relay the steps it gives to the user. Programs are MakeCode TypeScript (the "JavaScript" view), e.g.: input.onButtonPressed(Button.A, function () { basic.showIcon(IconNames.Heart) }) basic.forever(function () { led.toggle(2, 2); basic.pause(500) }) MakeCode converts block-friendly code to blocks. Use list_blocks to see the block APIs (core and loaded extensions) with their signatures. Workflow: status -> new_project (fresh project) or get_code (read the open one) -> set_code (returns compile errors; fix and retry until errors is empty) -> run_simulator to try it on screen -> flash to put it on the board (asks the user to pick the micro:bit in the browser the first time) or save_hex for a .hex file. set_code replaces the whole program of the open project: read it with get_code first if it may hold the user's work, or start with new_project. Hardware kits (robots, NeoPixel strips, sensors...) need their extension: add_extension, then list_blocks with its namespace.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| statusA | Attach to the user's open browser (Chrome/Edge with remote debugging allowed), open the MakeCode micro:bit tab if needed, and report its state: project name, editor view, extensions, simulator, micro:bit connection, open dialogs. |
| screenshotB | Screenshot of the MakeCode window (blocks, simulator, dialogs). |
| list_blocksA | Block APIs available in the open project (core plus added extensions) as TypeScript signatures with their block text. Without namespace: namespaces and block counts. With namespace (e.g. basic, input, led, music, radio, pins, or an extension's namespace): its functions. |
| get_codeA | Read the open project's program as MakeCode TypeScript (blocks are stored as this code). |
| set_codeA | Replace the open project's whole program with MakeCode TypeScript, show it as blocks, and compile it. Returns compile errors (fix and call again until errors is empty) and whether it converted to blocks. Overwrites the program: call get_code first if it may hold the user's work, or use new_project. |
| new_projectB | Create a new MakeCode project (the user's other projects are kept in MakeCode's list), optionally with a program. Returns compile errors when code is given. |
| add_extensionA | Add a MakeCode extension to the open project: a built-in one (servo, bluetooth, devices, datalogger...), a GitHub repo (owner/repo, e.g. microsoft/pxt-neopixel), or a search term (e.g. maqueen, cutebot). Then use list_blocks with its namespace. |
| run_simulatorA | Start MakeCode's on-screen micro:bit simulator with the current program (use screenshot to see it). |
| stop_simulatorB | Stop the on-screen simulator. |
| save_hexA | Compile the program and save the .hex file on this computer. The file can be copied to the MICROBIT drive to flash it, and opened again with open_file (it contains the source). |
| open_fileA | Open a MakeCode project file from this computer as a new project: .hex (made by MakeCode), .mkcd, .ts or .py. |
| connect_deviceB | Connect a micro:bit over USB (WebUSB) through MakeCode's pairing dialog. The first time, the user must select the micro:bit in the browser's chooser; later connects reuse it. |
| flashA | Compile the program and flash it onto the connected micro:bit (replaces the program on the board). Connects first if needed (see connect_device). Returns compile errors instead of flashing when there are any. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 13 tools
Most tools target a distinct resource+action pair (get_code/set_code, run_simulator/stop_simulator, save_hex/flash, connect_device). The few overlaps — set_code vs new_project both injecting a program, and flash vs connect_device (flash connects implicitly) — are explicitly clarified in the descriptions. An agent can select correctly, though it must read carefully for the code-writing and device-flashing pairs.
The dominant pattern is verb_noun (list_blocks, get_code, set_code, new_project, add_extension, run_simulator, save_hex, open_file, connect_device), which is predictable and readable. A handful of deviations — bare nouns 'status' and 'screenshot', and the bare verb 'flash' — are natural terms but break the pattern slightly.
13 tools is squarely in the well-scoped range and each one maps to a real workflow step: attach, inspect, read/write code, extensions, simulate, save, open, connect, flash. There is no filler or redundant tool in the set.
The core lifecycle — attach, read code, replace code, new project, add extensions, list blocks, simulate, save .hex, open files, pair and flash a device — is fully covered with no dead ends. Minor gaps exist: no way to remove an extension, no listing/switching among MakeCode's existing projects, and no serial/console output reading during simulation or flashing.