* 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.6 KiB
description, argument-hint
| description | argument-hint | |
|---|---|---|
| Run the mcp-server test suite (auto-detects devices) and interpret the results |
|
/test — mcp-server test runner with interpretation
Run mcp-server/run-tests.sh and make sense of the output so the operator doesn't have to.
What to do
-
Invoke the wrapper. From the firmware repo root, run:
./mcp-server/run-tests.sh $ARGUMENTSThe wrapper auto-detects connected Meshtastic devices, maps each to its PlatformIO env, exports the required
MESHTASTIC_MCP_ENV_*env vars, and invokes pytest. If the user passed no arguments, the wrapper supplies a sensible default set (tests/ --html=tests/report.html --self-contained-html --junitxml=tests/junit.xml -v --tb=short). A--report-log=tests/reportlog.jsonlarg is always appended (unless the operator passed their own).--assume-bakedis deliberately NOT in the defaults —test_00_bake.pyhas its own skip-if-already-baked check and runs the ~8 s verification by default. Operators can opt into the fast path with--assume-baked, or force a reflash with--force-bake. -
Read the pre-flight header. First ~6 lines print the detected hub (role → port → env). If that line reads
detected hub : (none), the wrapper will narrow totests/unitonly — say so explicitly in your summary so the operator knows hardware tiers were skipped. -
On pass: one-line summary of the form
N passed, M skipped in <duration>. Don't enumerate the 52 test names — the user can read those. Do mention if any test was SKIPPED for a NON-placeholder reason (e.g. "role not present on hub" is worth flagging). -
On failure: for every FAILED test, open
mcp-server/tests/report.htmland extract theMeshtastic debugsection for that test. pytest-html embeds the firmware log stream + device state dump there; the 200-line firmware log tail is usually enough to explain the failure. Summarise: which test, one-line assertion message, the firmware log lines that matter (things likePKI_UNKNOWN_PUBKEY,Skip send NodeInfo,Error=,Guru Meditation,assertion failed). -
Classify the failure as one of:
- Transient/flake: LoRa collision, timing-sensitive assertion, first-attempt NAK + successful retry pattern. Propose
/repro <test_node_id>to confirm. - Environmental: device unreachable, port busy, CP2102 driver wedged. Suggest the specific recovery (replug USB,
touch_1200bps, checkgit status userPrefs.jsonc). - Regression: same assertion fails repeatedly, firmware log shows a new/unusual error. Surface the diff between expected and observed, identify the module likely responsible.
- Transient/flake: LoRa collision, timing-sensitive assertion, first-attempt NAK + successful retry pattern. Propose
-
Never run destructive recovery automatically. If a failure looks like it needs a reflash, factoryreset, or USB replug, _describe what to do — don't execute. The operator decides.
Arguments handling
- No args → wrapper's defaults (full suite).
$ARGUMENTSpassed verbatim to the wrapper, which passes them to pytest.- Common operator invocations:
/test tests/mesh,/test tests/mesh/test_direct_with_ack.py::test_direct_with_ack_roundtrip,/test --force-bake,/test -k telemetry.
Side-effects to mention in summary
- The session fixture snapshots
userPrefs.jsoncat session start and restores at teardown (plus onatexit). After a clean run,git status userPrefs.jsoncshould be empty. If the wrapper's pre-flight printed a warning about a stale sidecar, call that out — means a prior session crashed. mcp-server/tests/report.htmlandjunit.xmlare regenerated on every run; the HTML is self-contained (shareable).