J-Link RTT Viewer MCP
This server enables AI assistants to control STM32 and other embedded MCUs via a J-Link debugger using natural language. Key capabilities include:
Connect/Disconnect: Establish or terminate a connection to a J-Link debugger and target MCU (e.g., STM32F103C8, nRF52840) via SWD or JTAG with configurable speed and retry attempts.
Read RTT Data: Read Real-Time Transfer (RTT) log data from the MCU across one or multiple channels (0–15).
Write RTT Data: Send commands or data to the MCU via RTT channels, supporting plain text and hexadecimal formats.
Set Default RTT Channel: Configure the default RTT channel (0–15) for subsequent operations.
Reset MCU: Reset the target in various modes — normal, auto-reconnect, or halt (pause CPU at reset state).
Flash Firmware: Program
.hexor.binfirmware files directly onto the MCU.Get Device Info: Retrieve detailed information about the connected J-Link debugger and target MCU.
Read/Write Memory: Read or write raw data at arbitrary memory addresses on the MCU (hex or plain string formats).
Start/Stop Log Recording: Begin or stop recording RTT output to a local log file.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@J-Link RTT Viewer MCP Connect to my STM32F103C8 board"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
J-Link RTT Viewer MCP Server
English
An MCP server that wraps J-Link RTT Viewer, enabling AI assistants to control STM32 development boards via natural language.
Quick Start (3 steps)
# 1. Clone and install
git clone https://github.com/MisakaMikoto128/J-Link-RTT-Viewer-MCP.git
cd J-Link-RTT-Viewer-MCP
python -m venv .venv && .venv\Scripts\activate # Windows
pip install -r requirements.txt
# 2. Configure Claude Desktop
# Add to %APPDATA%\Claude\claude_desktop_config.json:
# { "mcpServers": { "jlink-rtt": { "command": "python", "args": ["-m", "src.server"], "cwd": "C:\\path\\to\\J-Link-RTT-Viewer-MCP" } } }
# 3. Restart Claude Desktop and use natural language!Tool Reference
Tool | Parameters | Description |
|
| Connect to MCU. Target example: |
| (none) | Disconnect from J-Link |
|
| Read RTT log data from MCU |
|
| Send command to MCU via RTT |
|
| Reset MCU. Modes: normal, auto_reconnect, halt |
|
| Flash .hex or .bin file to MCU |
| (none) | Get connected device details |
|
| Read MCU memory (hex address like 0x08000000) |
|
| Write data to MCU memory |
|
| Record RTT output to file |
| (none) | Stop recording |
|
| Set default RTT channel (0-15) |
Common Commands (for write_rtt)
freq 200 - Set LED blink interval to 200ms
freq 1000 - Set LED blink interval to 1s
mode on - Turn LED on
mode off - Turn LED off
mode blink - Set LED to blink mode
status - Get current settings
ping - Test connection (returns "pong")
reset - Reset MCU softwareExample: Control LED
User: Connect to my STM32F103C8 board
AI: [connect] Connected to STM32F103C8
User: What's in the RTT logs?
AI: [read_rtt] STM32F103C8T6 LED Control ===\r\nCommands: freq, mode, status...
User: Make the LED blink faster
AI: [write_rtt, data="freq 200"] Done! LED now blinks every 200ms
User: Turn the LED on
AI: [write_rtt, data="mode on"] LED is now on
User: Flash new firmware
AI: [flash_firmware, firmware_path="path/to/firmware.hex"] Flash complete!Supported Hardware
Debugger: SEGGER J-Link (V7-V10)
MCU: STM32F1xx, STM32F4xx, nRF52xxx, etc.
Interface: SWD, JTAG
Test with MCP Inspector
npx @modelcontextprotocol/inspector -- python -m src.serverRelated MCP server: MCP Server for Segger RTT via J-Link
中文
封装 J-Link RTT Viewer 的 MCP 服务器,使 AI 助手能通过自然语言控制 STM32 开发板。
快速开始(3 步)
# 1. 克隆并安装
git clone https://github.com/MisakaMikoto128/J-Link-RTT-Viewer-MCP.git
cd J-Link-RTT-Viewer-MCP
python -m venv .venv && .venv\Scripts\activate # Windows
pip install -r requirements.txt
# 2. 配置 Claude Desktop
# 添加到 %APPDATA%\Claude\claude_desktop_config.json:
# { "mcpServers": { "jlink-rtt": { "command": "python", "args": ["-m", "src.server"], "cwd": "C:\\path\\to\\J-Link-RTT-Viewer-MCP" } } }
# 3. 重启 Claude Desktop,用自然语言对话!工具参考
工具 | 参数 | 说明 |
|
| 连接 MCU。示例: |
| (无) | 断开 J-Link |
|
| 读取 MCU 的 RTT 日志 |
|
| 通过 RTT 发送命令到 MCU |
|
| 重置 MCU。模式: normal, auto_reconnect, halt |
|
| 烧录 .hex 或 .bin 文件 |
| (无) | 获取设备详细信息 |
|
| 读取 MCU 内存 |
|
| 写入 MCU 内存 |
|
| 录制 RTT 输出到文件 |
| (无) | 停止录制 |
|
| 设置默认 RTT 通道 (0-15) |
常用命令(用于 write_rtt)
freq 200 - 设置 LED 闪烁间隔为 200ms
freq 1000 - 设置 LED 闪烁间隔为 1s
mode on - 打开 LED
mode off - 关闭 LED
mode blink - 设置 LED 闪烁模式
status - 获取当前设置
ping - 测试连接(返回 "pong")
reset - 软件重置 MCU示例:控制 LED
用户: 连接到我的 STM32F103C8 开发板
AI: [connect] 已连接到 STM32F103C8
用户: RTT 日志里有什么?
AI: [read_rtt] STM32F103C8T6 LED Control ===\r\nCommands: freq, mode, status...
用户: 让 LED 闪快一点
AI: [write_rtt, data="freq 200"] 完成!LED 现在每 200ms 闪烁一次
用户: 打开 LED
AI: [write_rtt, data="mode on"] LED 已打开
用户: 烧录新固件
AI: [flash_firmware, firmware_path="path/to/firmware.hex"] 烧录完成!支持的硬件
调试器: SEGGER J-Link (V7-V10)
MCU: STM32F1xx, STM32F4xx, nRF52xxx 等
接口: SWD, JTAG
使用 MCP Inspector 测试
npx @modelcontextprotocol/inspector -- python -m src.serverAvailable Tools
12 toolsconnectA
连接到 J-Link 调试器和目标 MCU
Args: target: 目标设备型号 (如 STM32F103C8, STM32F407VG, nRF52840) interface: 调试接口 (SWD 或 JTAG),默认 SWD speed: 连接速度 (kHz),默认 4000 channel: RTT 通道号,默认 0 retry_attempts: 重试次数,默认 3
Returns: 连接状态和设备信息的 JSON 字符串
Inputs: target (required), interface, speed, channel, +1 more. Returns: result
disconnectA
断开 J-Link 连接
安全地断开与 J-Link 调试器的连接,清理所有资源。
Returns: 断开状态的 JSON 字符串
Inputs: no named parameters. Returns: result
flash_firmwareA
烧录固件到 MCU
将固件文件烧录到连接的目标 MCU。
Args: firmware_path: 固件文件路径 (.hex, .bin)
Returns: 烧录结果的 JSON 字符串
Inputs: firmware_path (required). Returns: result
get_device_infoA
获取当前连接设备的信息
返回 J-Link 调试器和目标 MCU 的详细信息。
Returns: 设备信息的 JSON 字符串
Inputs: no named parameters. Returns: result
read_memoryA
读取 MCU 内存
从目标 MCU 的指定地址读取内存数据。
Args: address: 起始地址 (如 0x08000000) size: 读取字节数 (1-1048576)
Returns: 内存数据的 JSON 字符串(十六进制格式)
Inputs: address (required), size (required). Returns: result
read_rttB
读取 RTT 日志数据
从目标 MCU 读取 RTT (Real-Time Transfer) 日志数据。 默认读取所有通道 (0-15),返回结构化的日志数据。
Args: channels: 要读取的通道列表,None 表示所有通道 (默认) max_size: 最大读取字节数,默认 4096
Returns: RTT 数据的 JSON 字符串,包含时间戳、通道、内容和元数据
Inputs: channels, max_size. Returns: result
resetA
重置目标 MCU
重置连接的目标 MCU。支持多种重置模式。
Args: mode: 重置模式 - "normal": 标准重置,保留连接会话 (默认) - "auto_reconnect": 重置后自动断开重连 - "halt": 重置后暂停 CPU(停在复位状态) wait_time: 重置后等待时间(秒),默认 0.3
Returns: 重置结果的 JSON 字符串
Inputs: mode, wait_time. Returns: result
set_rtt_channelB
设置默认 RTT 通道
设置后续 RTT 操作使用的默认通道。
Args: channel: 通道号 (0-15)
Returns: 设置结果的 JSON 字符串
Inputs: channel (required). Returns: result
start_log_recordingC
开始日志记录
开始将 RTT 数据记录到文件。
Args: log_dir: 日志目录,默认 "logs"
Returns: 记录状态的 JSON 字符串
Inputs: log_dir. Returns: result
stop_log_recordingB
停止日志记录
停止将 RTT 数据记录到文件。
Returns: 停止状态的 JSON 字符串
Inputs: no named parameters. Returns: result
write_memoryB
写入 MCU 内存
向目标 MCU 的指定地址写入数据。
Args: address: 起始地址 (如 0x08000000) data: 要写入的数据(十六进制字符串或普通字符串) is_hex: 是否为十六进制数据,默认 True
Returns: 写入结果的 JSON 字符串
Inputs: address (required), data (required), is_hex. Returns: result
write_rttA
向 RTT 通道写入数据
向目标 MCU 的 RTT 通道发送数据。
Args: data: 要写入的数据 channel: 通道号,None 使用默认通道 is_hex: 是否为十六进制数据,默认 False
Returns: 写入结果的 JSON 字符串
Inputs: data (required), channel, is_hex. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct operation (connect, disconnect, flash, memory read/write, RTT read/write, logging, reset, device info) with no overlapping purposes.
All tools use consistent verb_noun snake_case naming (e.g., read_memory, write_rtt) with no deviations or mixed conventions.
12 tools is well-scoped for a J-Link/RTT debugger, covering essential operations without being excessive or minimal.
Core operations (connect, flash, memory R/W, RTT R/W, logging, reset) are covered, but minor gaps like erase or verify exist.
Maintenance
Related MCP Connectors
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants like Claude to directly debug microcontrollers via JLink, supporting breakpoints, single-step, memory/register access, variable inspection, RTT logging, and firmware flashing.257MIT
- AlicenseAqualityDmaintenanceEnables LLMs to interact with embedded devices by reading and writing Segger RTT data through a J-Link debugger.91MIT
- AlicenseBqualityBmaintenanceEnables AI assistants to debug embedded devices via SEGGER J-Link probes, including reading memory, flashing firmware, streaming RTT logs, and diagnosing crashes.48181 npm43MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to flash firmware, program memory, modify option bytes, erase chips, reset boards, and capture SWO printf traces for STM32 microcontrollers via STM32CubeCLT.12MIT