Virtual Mock Testing
You don’t need a physical ESP32 or Arduino to start building AI agents with MCP-U. The client includes a built-in MockTransport that simulates an MCU connection.
This is extremely useful for CI/CD pipelines, automated testing, or just exploring the MCP protocol locally.
Starting the Mock Device
Section titled “Starting the Mock Device”Instead of providing a serial port or TCP address, you can use the mock transport type in your DEVICES environment variable:
DEVICES=mock-mcu:mock npm startWhat the Mock Device Provides
Section titled “What the Mock Device Provides”When the client boots in mock mode, it acts exactly like a real MCU. It will respond to discovery requests (get_info, list_tools) and expose the following virtual capabilities:
1. Virtual Pins & Buffers
Section titled “1. Virtual Pins & Buffers”It exposes a virtual ADC pin named voltage_feedback.
- It advertises buffer capabilities (
buffer_size: 50,interval_ms: 100). - When the client’s Buffer Drain Poller calls
get_pin_buffer, the mock transport generates a simulated, noisy sine wave. - This data automatically flows into your local SQLite memory store, providing rich synthetic data for the AI to query.
2. Virtual Tools
Section titled “2. Virtual Tools”It exposes a set_led tool that accepts a boolean state.
- Calling this tool via the MCP protocol will return a successful simulation of the action.
Testing with an AI Agent
Section titled “Testing with an AI Agent”You can hook this up to Claude Desktop or Gemini CLI just like a real device.
For example, start an AI session and ask:
“Query the
sql_readonly_querytool and plot the recent values fromvoltage_feedback. What shape does the data resemble?”
The AI will query the SQLite database, retrieve the synthetic sine wave data generated by the mock transport, and analyze it — entirely in software!