GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
58
Forks
0
Issues
0
MCP for Raspberry Pi Pico W
LED Control via JSON-RPC
The firmware exposes JSON-RPC tools that can be invoked using the tools/call method. Use tools/list to discover available tools:set_location, set_switch_id, and set_switch.
These allow you to configure the target switch and toggle the onboard LED.
Example requests:
{ "jsonrpc": "2.0", "method": "tools/call",
"params": { "name": "set_location", "arguments": { "location": "office" } },
"id": 1 }
{ "jsonrpc": "2.0", "method": "tools/call",
"params": { "name": "set_switch_id", "arguments": { "switch_id": "led" } },
"id": 2 }
{ "jsonrpc": "2.0", "method": "tools/call",
"params": { "name": "set_switch", "arguments": { "state": "on" } },
"id": 3 }
Call set_switch with "state": "on" or "off". The LED changes only when the
request's location or switch_id matches the previously set values or when
both fields are omitted.
How it works
Use the agent mode of Github copilot Chat in Visual Studio Code.
https://github.com/user-attachments/assets/7c040786-b527-4f8a-829e-545591232b0f
Installing the pico-sdk
The following is an excerpt from a previous setup guide.
Create a working directory
mkdir -p ~/.pico-sdk/sdkDownload the latest release (2.1.1) from the official Raspberry Pi repository
cd ~/.pico-sdk/sdk git clone -b 2.1.1 https://github.com/raspberrypi/pico-sdk.git 2.1.1 cd 2.1.1 git submodule update --initSet the
PICO_SDK_PATHenvironment variableexport PICO_SDK_PATH=$HOME/.pico-sdk/sdk/2.1.1
After verifying that the repository was cloned and its submodules were checked out,
the pico-sdk will be available under ~/.pico-sdk/sdk/2.1.1.
Build Instructions
The commands below automatically fetch the Pico SDK and build the project.
mkdir build
cd build
cmake -E env PICO_SDK_FETCH_FROM_GIT=1 cmake ..
make -j$(nproc)
When the build succeeds, artifacts such as pico_mcp.uf2 are generated in thebuild directory.
The MCP will read a list of programs (with arguments) to run from a file, start up and run the programs as processes, and then schedule the processes to run concurrently in a time-sliced manner. In addition, the MCP will monitor the processes, keeping track of how the processes are using system resources. This is written in C