feat(mcp): add RTT transport for flashed devices and fix stale docs#65
Merged
Conversation
telepath-mcp-server previously only supported --transport loopback, which runs an in-process TelepathServer against the binary's own linkme registry. This is structurally identical to the pre-#51 telepath-shell bug where commands were hardcoded instead of queried from the device. Add --transport rtt so the MCP server can discover and expose the real #[command] functions on a flashed nRF52840-DK (or any RTT-capable target). The RTT transport is a verbatim copy of the one in telepath-shell; the duplication is intentional and temporary — it will be removed when the two tools are merged into a single binary (see issue #63 for the unification plan). Changes: - Cargo.toml: introduce `loopback` and `rtt` features; gate telepath-server and probe-rs as optional deps accordingly - src/rtt_transport.rs: copy of tools/telepath-shell/src/rtt_transport.rs with TODO(#63) header - src/lib.rs: expose rtt_transport behind `#[cfg(feature = "rtt")]` - src/main.rs: Transport enum (Loopback/Rtt); clap args --chip, --rtt-control-block-addr, --no-reset; loopback scaffold moved into `#[cfg(feature = "loopback")] mod loopback`; RTT branch using RttTransport with drain_debug_logs→stderr, 10 s read deadline - Justfile: add mcp-run-rtt recipe - AGENTS.md: document RTT run command Closes #62 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an RTT-based transport option to telepath-mcp-server so it can attach to a flashed nRF52840-DK via probe-rs, run discovery against real firmware, and expose the discovered Telepath commands as MCP tools (while keeping loopback available and feature-gated).
Changes:
- Introduces
--transport rtt(plus RTT-specific CLI flags) and routes MCP server startup through an RTT-backedTelepathClient. - Feature-gates transport backends (
loopback/rtt) and makestelepath-server/probe-rsoptional deps accordingly. - Adds a Just recipe and updates
AGENTS.mdwith the RTT run command.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/telepath-mcp-server/Cargo.toml | Adds loopback/rtt features; makes telepath-server and probe-rs optional; enables clap env. |
| tools/telepath-mcp-server/src/rtt_transport.rs | Adds RTT transport implementation (copied from telepath-shell) implementing Read+Write with deadlines and log drain. |
| tools/telepath-mcp-server/src/lib.rs | Exposes rtt_transport module behind the rtt feature. |
| tools/telepath-mcp-server/src/main.rs | Adds Transport enum + RTT CLI args, feature-gated loopback module, and RTT startup branch using probe-rs. |
| Justfile | Adds mcp-run-rtt helper recipe. |
| AGENTS.md | Documents running the MCP server in RTT mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove stale Limitations items that have since been implemented: - RTT transport is now built-in; only serialport remains pending (#36) - Named-argument mapping (#38) was implemented in commit 478e703 - telepath-shell arbitrary command dispatch was implemented; "only ping" claim was incorrect Add RTT mode registration example to mcp-server README including the --rtt-control-block-addr / --no-reset flag table. Clarify that both features ship in the default build (no extra cargo flags needed). Update shell REPL example to reflect discovery-driven help output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--transport rtttotelepath-mcp-serverso it can connect to a flashed nRF52840-DK and expose real firmware commands as MCP toolsloopback/rttCargo features (both enabled by default)telepath-shellLimitationsentries and add RTT registration instructions for Claude CodeBackground
telepath-mcp-serverpreviously only supported--transport loopback, which ran an in-processTelepathServerusing the binary's ownlinkmeregistry. CDP frames genuinely crossed the mpsc pair, but the "device" was always the host binary — never flashed firmware. This is structurally identical to the pre-#51telepath-shellbug where commands were hardcoded rather than queried from the device.Changes
tools/telepath-mcp-server/Cargo.tomlloopback/rttfeatures;telepath-serverandprobe-rsbecome optionaltools/telepath-mcp-server/src/rtt_transport.rstools/telepath-shell/src/rtt_transport.rswithTODO(#63)noting the temporary duplicationtools/telepath-mcp-server/src/lib.rsrtt_transportbehind#[cfg(feature = "rtt")]tools/telepath-mcp-server/src/main.rsTransportenum (clapValueEnum); RTT args (--chip,--rtt-control-block-addr,--no-reset); loopback scaffold moved into#[cfg(feature = "loopback")] mod loopback; RTT branchJustfilemcp-run-rttrecipeAGENTS.mdtools/telepath-mcp-server/README.mdclaude mcp addexample with flag table; replacecargo buildwithcargo build --release; remove stale loopback-only Limitationsdocs/mcp-integration.mdtools/telepath-shell/README.mdRTT mode notes
drain_debug_logswrites to stderr only — stdout is reserved for MCP JSON-RPCset_read_deadline(10s)is set beforebuild()and not cleared: RPC calls also time out after 10 s so the MCP client cannot hang indefinitely--no-resetdisables the auto-reset-and-retry that fires when the RTT control block is not found on first attachBuild matrix verified
Test plan
just cipasses (CI will verify)cargo run -- --transport loopbackanswers MCPtools/listwithping(loopback regression)just firmware-flash→just mcp-run-rtt→ drive MCP via stdin:tools/listreturns discovered commands,tools/call pingreturns0xDEADBEEFNo debug probes found.RttTransport::newretries once then exits with error on stderr, stdout remains clean MCP JSONRelated
🤖 Generated with Claude Code