Skip to main content
Glama
microbit-makecode-mcp

microbit-makecode-mcp

microbit-makecode-mcp

MCP server that lets Claude (Claude Code / Claude Desktop) and other MCP clients program the BBC micro:bit in Microsoft MakeCode (makecode.microbit.org): write the program, see it as blocks, fix compile errors, try it in the simulator, add extensions, save .hex files and flash the board over USB.

It works in the browser you already have open (Chrome or Edge): it attaches to it, uses its MakeCode tab (opening one if needed) and drives the editor the way its own buttons do. It never launches a browser of its own, so your MakeCode projects, settings and paired micro:bit stay where they are. It needs no firmware on the board and no private API.

How it differs from other micro:bit MCP servers: those talk to a board over USB serial (show text on the LEDs, read sensors) or build C++ CODAL firmware. This one is for writing MakeCode programs, the blocks and JavaScript that students and teachers use.

Install

No install step is needed: MCP clients run it with npx microbit-makecode-mcp (Node.js 18+). To work on the code instead:

git clone https://github.com/nguyenquocan0101/microbit-makecode-mcp
cd microbit-makecode-mcp
npm install
npm run build

Related MCP server: byob

Allow the connection (once per browser)

Requires Chrome 144+ (or a recent Edge).

  1. In your browser open chrome://inspect/#remote-debugging (Edge: edge://inspect/#remote-debugging).

  2. Turn on Allow remote debugging for this browser instance.

  3. The first time the server attaches, the browser asks whether to allow it: click Allow.

The server finds the browser through the DevToolsActivePort file the browser writes into its profile folder (Chrome, Chrome Beta/Canary, Edge, Brave, Cốc Cốc, Chromium), then tries port 9222. If nothing is reachable, every tool says which case it is: no browser open, or remote debugging still off.

Register with Claude

Claude Code

claude mcp add microbit -- npx -y microbit-makecode-mcp

Claude Desktop: add to claude_desktop_config.json (%APPDATA%\Claude\ on Windows)

{
  "mcpServers": {
    "microbit": { "command": "npx", "args": ["-y", "microbit-makecode-mcp"] }
  }
}

Then ask, for example: "Make a micro:bit program: button A shows a heart, button B shows the temperature. Test it in the simulator, then flash it."

Tools

Tool

What it does

status

Attaches to your browser, opens MakeCode if needed; reports project, view, extensions, simulator, micro:bit connection, open dialogs

screenshot

Screenshot of the MakeCode window

list_blocks

Block APIs as TypeScript signatures with their block text. No argument: namespaces. With namespace (basic, input, led, radio, neopixel...): its functions

get_code

Reads the open program as MakeCode TypeScript

set_code

Replaces the program, shows it as blocks (or JavaScript when it has no block form) and returns compile errors

new_project

Creates a new project, optionally with code (your other projects are kept)

add_extension

Adds an extension: built-in (servo, bluetooth, datalogger...), GitHub owner/repo, or a search term (maqueen, cutebot...)

run_simulator / stop_simulator

Starts / stops the on-screen micro:bit simulator

save_hex

Compiles and saves a .hex file (copy it to the MICROBIT drive to flash; it also contains the source)

open_file

Opens a .hex, .mkcd, .ts or .py file as a project

connect_device

Connects the micro:bit over WebUSB through MakeCode's pairing dialog

flash

Compiles and flashes the connected micro:bit (connects first if needed); returns compile errors instead when there are any

Programs are MakeCode TypeScript, which MakeCode shows as blocks:

input.onButtonPressed(Button.A, function () {
    basic.showIcon(IconNames.Heart)
})
basic.forever(function () {
    led.toggle(2, 2)
    basic.pause(500)
})

set_code replaces the whole program of the open project. Claude is told to read it first with get_code or to start with new_project when it may hold your work; MakeCode's own undo and project history still apply.

USB and the first connect

WebUSB lets a page open a device only after a person picks it. The first connect_device (or flash) clicks through MakeCode's pairing dialog and the browser then shows its device chooser under the address bar: select the micro:bit and click Connect. Later connects reuse that permission. If the chooser is left unanswered, the tool reports it and closes the pairing dialog.

Environment variables

Variable

Purpose

MAKECODE_CDP_URL

Attach to this DevTools endpoint instead of discovering one (e.g. http://127.0.0.1:9222)

MAKECODE_URL

Editor URL (default https://makecode.microbit.org/; e.g. the beta editor)

MAKECODE_BROWSER_DATA_DIRS

Browser profile folders to look in for DevToolsActivePort (path-list separated)

Development

npm run smoke runs every tool through the MCP protocol against a throwaway browser:

chrome --headless=new --remote-debugging-port=9333 --user-data-dir=$env:TEMP\mkmcp-profile
$env:MAKECODE_CDP_URL = "http://127.0.0.1:9333"; npm run smoke

Limits

  • MakeCode has no public API for a top-level page, so the server uses the editor's internal methods. If a MakeCode update changes them, tools fail with a clear "MakeCode internals changed" error instead of doing something wrong.

  • Programs are read and written as TypeScript; Python projects can be opened but not edited as Python.

  • The flash path has been checked up to the WebUSB device chooser; flashing a real board has not been tested yet.

License

MIT

Available Tools

13 tools
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.

Inputs: name (required).

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.

Inputs: timeoutSeconds.

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.

Inputs: no named parameters.

get_codeA

Read the open project's program as MakeCode TypeScript (blocks are stored as this code).

Inputs: no named parameters.

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.

Inputs: namespace.

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.

Inputs: name (required), code, view.

open_fileA

Open a MakeCode project file from this computer as a new project: .hex (made by MakeCode), .mkcd, .ts or .py.

Inputs: path (required).

run_simulatorA

Start MakeCode's on-screen micro:bit simulator with the current program (use screenshot to see it).

Inputs: no named parameters.

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).

Inputs: path (required).

screenshotB

Screenshot of the MakeCode window (blocks, simulator, dialogs).

Inputs: no named parameters.

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.

Inputs: code (required), view.

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.

Inputs: no named parameters.

stop_simulatorB

Stop the on-screen simulator.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 13 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Lets any MCP-speaking AI agent drive your everyday Chrome browser, opening pages, reading them, clicking, typing, taking screenshots, and inspecting DevTools console, network, storage and performance data with your existing sign-ins. Risky actions like submitting or paying require your explicit approval, and agents are confined to their own tab group with secrets hidden.
      Apache 2.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI coding tools directly control the user's already-open, logged-in Chrome to read pages, navigate, click, type, screenshot, inspect network/storage, and automate browser tasks through local MCP tools.
      1 npm
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI coding tools drive the real Chrome browser you already have open and logged into — navigating, reading pages, clicking, filling forms, capturing screenshots, and inspecting network, console, and storage state. It works through a Chrome extension rather than a remote-debugging port, so no extra debugging prompt appears and nothing else on the machine can hijack your logged-in browser.
      1 npm
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding tools to control your real, already-logged-in Chrome browser through local MCP tools for navigation, reading, screenshots, form filling, cookies, tabs, network inspection, and more. It works via a Chrome extension rather than a remote-debugging port, keeping all communication on your machine.
      1 npm
      ISC