PetOS BLE Gateway
MCP server for controlling an ESP32-C3 PetOS watch over BLE. Enables scanning, connecting, sending pet actions, and showing frames through MCP tools.
README
PetOS BLE Gateway
PetOS BLE Gateway is a local Node.js bridge for controlling an ESP32-C3 PetOS watch over BLE.
It exposes three control surfaces over the same BLE connection:
- A browser dashboard for scanning, connecting, and sending pet commands.
- An HTTP API for scripts and local tools.
- A stdio MCP server for Codex, Claude, and other MCP clients.
Web UI / HTTP API / MCP tool
|
v
Node.js gateway
|
v
BLE JSON write
|
v
PetOS-C3 watch
Hardware/Firmware Assumptions
The current firmware advertises as PetOS-C3 and accepts JSON writes on:
- Service UUID:
7f2a0001-4f6d-45f6-b805-2b0a7a0f9c01 - Write characteristic UUID:
7f2a0002-4f6d-45f6-b805-2b0a7a0f9c01
The tested target is an ESP32-C3 round watch board with a 240x240 GC9A01 display.
Requirements
- macOS with Bluetooth enabled
- Node.js 20+
- A PetOS watch firmware advertising as
PetOS-C3
This project uses @abandonware/noble for BLE access. On macOS, the terminal or app running Node may need Bluetooth permission in System Settings.
Install
npm install
Run The Web Gateway
npm start
Open:
http://127.0.0.1:8787
The page lets you scan, connect, send named actions, send a fixed frame, update the watch text page, or write raw JSON.
CLI Smoke Tests
Scan:
npm run scan -- 7000
Send an action:
npm run send -- '{"cmd":"pet.action","value":"review"}'
Show a fixed frame:
npm run send -- '{"cmd":"pet.frame","value":12}'
BLE JSON Protocol
Play an action:
{"cmd":"pet.action","value":"idle"}
{"cmd":"pet.action","value":"review"}
Show one fixed frame:
{"cmd":"pet.frame","value":12}
Show multiline text on the second watch page:
{"cmd":"watch.text","title":"Market","text":"#22c55e CPO +2.3%#\n#f97316 NVDA +1.1%#"}
The watch firmware supports LVGL label recolor syntax for simple rich text:
#22c55e green text# #f97316 orange text#
This is not HTML or Markdown. It supports multiline text and color spans, but not mixed font sizes, bold text, or embedded images.
Supported actions in the current firmware:
idlewavingjumpingfailedwaitingrunningreview
HTTP API
Status:
curl http://127.0.0.1:8787/api/status
Scan:
curl -X POST http://127.0.0.1:8787/api/scan \
-H 'content-type: application/json' \
-d '{"timeoutMs":7000}'
Connect:
curl -X POST http://127.0.0.1:8787/api/connect \
-H 'content-type: application/json' \
-d '{}'
Play an action:
curl -X POST http://127.0.0.1:8787/api/action/review \
-H 'content-type: application/json' \
-d '{}'
Send raw JSON:
curl -X POST http://127.0.0.1:8787/api/send \
-H 'content-type: application/json' \
-d '{"cmd":"pet.frame","value":12}'
Update the second watch page text:
curl -X POST http://127.0.0.1:8787/api/watch/text \
-H 'content-type: application/json' \
-d '{"title":"Market","text":"#22c55e CPO +2.3%#\n#f97316 NVDA +1.1%#"}'
MCP Server
Start the gateway first:
npm start
Then run the MCP server:
npm run mcp
For an MCP client, use this command:
node /absolute/path/to/petos-ble-gateway/src/mcp-server.js
Available MCP tools:
petos_statuspetos_scanpetos_connectpetos_send_jsonpetos_play_actionpetos_show_framepetos_show_text
The MCP server calls the local gateway at http://127.0.0.1:8787 by default. Override with:
PETOS_GATEWAY_URL=http://127.0.0.1:8787 npm run mcp
Troubleshooting
If the device does not appear in macOS Bluetooth settings, use this gateway or a BLE scanner such as nRF Connect/LightBlue. Ordinary BLE GATT devices often do not appear like keyboards or headphones.
If scanning hangs or returns no devices:
- Make sure the watch firmware is advertising
PetOS-C3. - Make sure the Node process has Bluetooth permission.
- Try
npm run scan -- 10000. - Restart the gateway after toggling Bluetooth permissions.
If action buttons appear to do nothing, check the log panel. A successful send looks like:
sent {"cmd":"pet.action","value":"review"}
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.