Creating Scratch 2.0 Extensions

Scratch 2.0 can be extended to control external devices (e.g. robotics kits, musical instruments) and to access data from external sensor hardware (e.g. sensor boards). A Scratch 2.0 extension extends Scratch with a collection of command and reporter blocks that can be used to interact with a particular device. When an extension is enabled, its blocks appear in the “More Blocks” palette.
Due to browser security restrictions, Scratch 2.0 cannot interact with hardware devices directly.

Instead, hardware extensions come with a helper app, a separate application that the user must install and run on their computer. Scratch communicates with the helper app via HTTP requests, and the helper app talks to the hardware. In the future, some extensions may package their helper apps as browser plugins, but that mechanism is not described here.

Fonte e mais detalhes aqui.