* Start of MCP server and test suite * Add MCP server for interacting with meshtastic devices and testing framework / TUI * Update mcp-server/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix mcp-server review feedback from thread Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/91dc128a-ed50-4d07-8bb2-3dc6623a05f7 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Enhance StreamAPI and PhoneAPI for improved log record handling and concurrency control * Semgrep fixes * Trunk and semgrep fixes * optimize pio streaming tee file writes Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/04e26c6b-6a2b-45be-bbeb-79ae4d0be633 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * chore: remove redundant log handle assignment Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/04e26c6b-6a2b-45be-bbeb-79ae4d0be633 Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Consolidate type imports and remove placeholder test files * Add tests for config persistence and more exchange messages * Refactor position test to validate on-demand request/reply behavior * Remove position request/reply test and update README for telemetry behavior * Fix transmit history file to get removed on factory reset --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
3.4 KiB
mode, description
| mode | description |
|---|---|
| agent | Device health report via the meshtastic MCP tools (Copilot equivalent of the Claude Code /diagnose slash command) |
/mcp-diagnose — device health report
Equivalent of .claude/commands/diagnose.md. Use when the operator asks to "check the devices", "what's the mesh looking like", "is nrf52 alive", etc.
This prompt assumes the meshtastic MCP server is registered with your VS Code Copilot agent. If it isn't, fall back to running ./mcp-server/run-tests.sh tests/unit plus a short device_info script via the terminal.
What to do
-
Enumerate hardware via the
list_devicesMCP tool (withinclude_unknown=True). For each entry wherelikely_meshtastic=True, captureport,vid,pid,description. -
Apply the operator's filter (if any):
- No filter → every likely-meshtastic device.
nrf52→vid == 0x239aesp32s3→vid == 0x303aorvid == 0x10c4- A
/dev/cu.*path → only that port. - Anything else → substring match on port.
-
For each selected device, in sequence (don't parallelize — SerialInterface holds an exclusive port lock):
device_info(port=<p>)→my_node_num,long_name,short_name,firmware_version,hw_model,region,num_nodes,primary_channellist_nodes(port=<p>)→ peer count, which peers havepublicKey, SNR/RSSI distributionget_config(section="lora", port=<p>)→ region, preset, channel_num, tx_power, hop_limit- If anything looks off (can't connect,
num_nodeswrong, missingfirmware_version), open a short firmware-log window:serial_open(port=<p>, env=<inferred>), wait 3 seconds,serial_read(session_id, max_lines=100),serial_close(session_id). Infer env from VID (0x239a →rak4631, 0x303a/0x10c4 →heltec-v3) unless anMESHTASTIC_MCP_ENV_<ROLE>env var overrides it.
-
Render per-device report as a compact block:
[nrf52 @ /dev/cu.usbmodem1101] fw=2.7.23.bce2825, hw=RAK4631 owner : Meshtastic 40eb / 40eb region/band : US, channel 88, LONG_FAST tx_power : 30 dBm, hop_limit=3 peers : 1 (esp32s3 0x433c2428, pubkey ✓, SNR 6.0 / RSSI -24 dBm) primary ch : McpTest firmware : no panics in last 3sFlag abnormalities inline with
⚠︎ <short reason>— missing pubkey on a known peer, region UNSET, mismatched channel name, etc. -
Cross-device correlation (when >1 device selected):
- Do both see each other in
nodesByNum? - Do
region,channel_num,modem_presetmatch across devices? - Do the primary channel names match? (Different name → different PSK → no decode.)
- Do both see each other in
-
Suggest next steps only for recognizable failure modes, never speculatively:
- Stale PKI one-way → "
/mcp-test tests/mesh/test_direct_with_ack.py— the test's retry+nodeinfo-ping heals this." - Region mismatch → "re-bake one side via
./mcp-server/run-tests.sh --force-bake." - Device unreachable → refer operator to the touch_1200bps + CP2102-wedged-driver notes in
run-tests.sh.
- Stale PKI one-way → "
Hard constraints
- Read-only. No
set_config, noreboot, nofactory_reset, noflash. If the operator wants mutation, they'll escalate explicitly. - Open/query/close per device. Never hold multiple SerialInterfaces to the same port. The port lock is exclusive.
- Don't infer env beyond the VID map — if the operator has an unusual board, ask them which env to use rather than guessing.