AI-Assistant Development
Overview
MCP (Model Context Protocol) is an open standard protocol introduced by Anthropic that lets AI Agents securely connect to external tools, data sources, and workflows. Through MCP, AI Agents move beyond suggestions — they can directly perform actions.
Pro2 SDK Development MCP is a revise version of RealMCU SDK Development MCP, design direclty for AmebaPro2
Pro2 SDK Development MCP
The SDK Development MCP launches its MCP server as a local subprocess and communicates with the AI client over standard input/output, requiring no network connection or additional authentication. The AI can directly modify project configuration, build, flash, and read/write the serial port — driving an automated, closed-loop development workflow.
Important
Prerequisites — Building Environment must be set up first.
Before registering or using the SDK Development MCP, complete the following steps in order based on your OS environment (refer to Building Environment for full details):
Install the ARM toolchain (
asdk-10.3.0) and cmake, and add them to PATH.Windows: install msys2 first, then set up the toolchain and cmake inside msys2.
Linux / macOS: install the toolchain and cmake directly via your system package manager or by extracting the provided toolchain archive.
Run the environment initialization script from the SDK root to create the Python virtual environment (
.venv) and install MCP server dependencies:Windows:
env.batLinux / macOS / WSL2:
source env.sh
Environment Setup and Registration
Step 1: Initialize the environment and install dependencies
Run the environment initialization script from the SDK root. This creates the Python virtual
environment (.venv) and installs the MCP server dependencies. Choose the script matching
your OS:
Windows
cd <SDK_ROOT>
env.bat
Linux / macOS / WSL2
cd <SDK_ROOT>
source env.sh
Note
If env.sh is not executable, grant execute permission first:
chmod +x env.sh
Note
env.bat / env.sh only needs to be run once per SDK checkout. It creates the
.venv Python environment required by the MCP server. If .venv is missing, the
AI client will report a connection failure when trying to start the server.
Step 2: Register the MCP
Claude Code
Run the registration command from the SDK root (replace <SDK_ROOT> with the actual absolute path):
:: Windows
claude mcp add ameba-dev-pro2 -- <SDK_ROOT>\tools\ameba\ameba_dev_mcp\launcher.bat
# Linux / macOS / WSL2
claude mcp add ameba-dev-pro2 -- <SDK_ROOT>/tools/ameba/ameba_dev_mcp/launcher.sh
Note
On Linux / macOS, if launcher.sh is not executable, grant permission first:
chmod +x <SDK_ROOT>/tools/ameba/ameba_dev_mcp/launcher.sh
Verify the registration:
claude mcp list
# Expected output: ameba-dev-pro2: ✓ Connected
To uninstall:
claude mcp remove ameba-dev-pro2
Codex
Add via the Codex IDE interface:
Enter Settings -> Extensions -> MCP servers, click Add server.
Choose
STDIOmode and enter the following:Name: ameba-dev-pro2 Command to launch: <SDK_ROOT>/tools/ameba/ameba_dev_mcp/launcher.sh
On Windows, change the command to
<SDK_ROOT>\\tools\\ameba\\ameba_dev_mcp\\launcher.bat(backslashes must be escaped as\\in JSON).
Verify: After saving the configuration and returning, the MCP Servers section should display
an entry for ameba-dev-pro2 with a connected indicator.
To uninstall: Select Uninstall in the corresponding MCP Servers settings.
Board Configuration
Before first use, run the following slash command in the Claude Code chat:
/ameba-setup-boards
The AI will guide you through entering the board model, serial port, and other information, and automatically perform a read-only environment check — no manual JSON editing required.
After setup, two configuration files are generated in the SDK root:
File |
Description |
|---|---|
|
Board configuration: alias to SoC model + serial port + connection type. |
|
Flash layout: firmware files and address table per SoC, auto-populated after the first
|
Note
To add or remove boards or change ports later, re-run /ameba-setup-boards or edit
board_info.json5 directly.
Note
AmebaPro2 currently has no auto-download circuit. The board must be put into download mode manually before each flash operation:
AMB82 (standard): set the J27 jumper, then press RESET.
AMB82-MINI: press and hold UART_DOWNLOAD, then press RESET simultaneously, then release both buttons.
Typical Agent Workflow
Tell the AI your development goal in Claude Code, and it will sequentially call
build_firmware -> flash_firmware_tool -> serial_connect_tool -> serial_expect_tool ->
serial_disconnect_tool to complete one full verification cycle:
# Tell the AI in Claude Code:
Update the log print in main() to include the project version number.
Build and flash to RTL8735B_COM5, then show me the boot log once it comes up.
Example AI tool call sequence:
build_firmware(alias="RTL8735B_COM5", video_example=True, nn=False)
flash_firmware_tool(alias="RTL8735B_COM5")
serial_connect_tool(alias="RTL8735B_COM5", reset=False)
serial_expect_tool(alias="RTL8735B_COM5",
patterns=["START SCHEDULER", "Crash Dump"],
timeout=20.0)
serial_disconnect_tool(alias="RTL8735B_COM5")
The same workflow applies to video examples. Use /ameba-video-example to interactively
select and build a video or NN example, or drive the tools directly:
# Tell the AI in Claude Code:
Switch to the vipnn_facedet example, build and flash to RTL8735B_COM5,
then show me the serial output.
Example AI tool call sequence:
set_video_example_tool(example_id="vipnn_facedet")
build_firmware(alias="RTL8735B_COM5", video_example=True, nn=True)
flash_firmware_tool(alias="RTL8735B_COM5")
serial_connect_tool(alias="RTL8735B_COM5", reset=False)
serial_expect_tool(alias="RTL8735B_COM5",
patterns=["SCRFD FPS", "Crash Dump"],
timeout=30.0)
serial_disconnect_tool(alias="RTL8735B_COM5")
MCP Features — SDK Development
The SDK Development MCP exposes three categories of functionality to the AI Agent.
Tools
Tool |
Description |
|---|---|
|
Set the build target SoC; must be called before |
|
Build firmware using the CMake build system; supports normal example, video, and NN video
builds. Automatically syncs |
|
Flash firmware to the AmebaPro2 board via |
|
List available serial ports on the local machine; when an alias is given, confirms that the board’s configured port is currently visible. |
|
Atomically write or merge board entries into |
|
Read-only environment readiness check: validates config files, serial port visibility,
|
|
List all available video examples grouped by category, with the currently active example marked. |
|
Activate a specific video example by updating
|
|
Open the serial connection; pulses DTR/RTS and clears the buffer by default. Idempotent — reuses an existing session if already open. |
|
Close the serial connection and release the port. |
|
Send a command string and wait for a response; combines buffer drain + write + pattern match in one call. |
|
Block until one of the specified regex patterns matches on the serial buffer, or an idle/hard timeout fires. |
|
Non-blocking peek; returns whatever is currently in the receive buffer
(up to |
Prompts
Prompt |
Description |
|---|---|
|
Guided board configuration setup; collects board model and serial port, writes
|
|
Interactively select a video example, then build and flash it to the board. Guides through example selection, build flags (pristine / nn), flash, and optional serial monitor in one session. |
Resources
Resource URI |
Description |
|---|---|
|
List all configured board aliases with SoC and transport; read this first to discover which alias to pass to flash/serial tools. |
|
Resolved configuration for a single board (defaults applied, password masked). |
|
List AmebaPro2 device hardware information (RTL8735B flash tool details and PG tool availability). |
|
Hardware info for a specific device (e.g. |
|
Hardware info filtered by memory type ( |
|
Full |
|
Full |
|
Hardware-side troubleshooting reference: serial driver versions, download mode circuit, RTS/DTR timing, failure patterns, and error-code index. |
Troubleshooting
Press Ctrl+O in Claude Code to expand the detailed parameters and return values of MCP tool calls and inspect specific error codes.
Symptom / Error code |
Resolution |
|---|---|
|
Re-run |
|
Make sure the dev board is plugged in. |
Flash stalls / cannot enter download mode |
AMB82: set J27 jumper then press RESET. AMB82-MINI: hold UART_DOWNLOAD + press RESET simultaneously. |
|
The error message lists available aliases; retry with the correct one. |
|
Confirm the first build has been completed and |
Server fails to start (import error) |
Run |