STM32 J-Link MCP
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., "@STM32 J-Link MCPStart a debug session and read the PC register on the STM32H7S3."
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.
STM32 J-Link MCP
AI-native hardware debugging and firmware-engineering interface for STM32H7S3 using SEGGER J-Link.
This project is deliberately more than a thin wrapper around JLinkExe. It provides a stateful semantic layer for AI agents such as Claude Code, Codex, and Hermes while keeping SEGGER's J-Link tools as the low-level hardware backend.
Design goals
Stateful debug session: J-Link and GDB ownership are coordinated instead of being independent subprocesses.
Semantic tools: expose target, memory, flash, GDB, Cortex-M fault, SVD, XSPI, and workflow operations.
AI-friendly output: return compact structured evidence and stable error codes instead of terminal transcripts where possible.
STM32H7S3 specialization: encode verified memory-map facts and Cortex-M diagnostics without pretending that a board-specific external NOR configuration is universal.
Safety: read-only mode, bounded writes, explicit confirmation for destructive operations, and raw-command escape hatch disabled by default.
Extensibility: J-Link, GDB, target profiles, SVD, and diagnostics are separate layers so additional STM32 families or probe backends can be added later.
Related MCP server: dbgprobe-mcp-server
Current hardware profile
The checked-in example configuration is tailored to the current custom target:
MCU: STM32H7S3I8T6, LQFP176
SEGGER J-Link device name:
STM32H7S3I8External memory: XSPI1
NOR: assumed Macronix
MX25UW51245GXDI00, 512 Mbit / 64 MiBMemory-mapped base:
0x90000000Expected RDID:
C2 81 3A
This is a board profile, not a claim that the external NOR is currently initialized. See docs/BOARD_STM32H7S3I8T6_XSPI1.md before enabling any programming workflow.
Architecture
AI Agent (Claude / Codex / Hermes)
|
| MCP / stdio
v
+---------------------+
| Semantic MCP tools |
+----------+----------+
|
v
+---------------------+
| DebugSessionManager |
| state / ownership |
| safety / locking |
+----+-----------+----+
| |
v v
+-----------+ +-----------+
| J-Link | | GDB |
| backend | | session |
+-----+-----+ +-----+-----+
| |
v v
JLinkExe JLinkGDBServer
| |
+-------+-------+
|
J-Link
|
SWD
|
STM32H7S3
/ | \
Flash SRAM XSPI
|
External NORImportant ownership rule
Do not concurrently use JLinkExe and GDB to control the same target. The session manager treats GDB as an owner of the live debug connection while a GDB session is active. Low-level one-shot J-Link operations should be used before/after the GDB session, or only when the session explicitly permits them.
STM32H7S3 memory-map facts
The STM32H7Rx/7Sx reference manual places the following windows in the Cortex-M7 address space:
User flash:
0x08000000upward.System flash:
0x1FF00000to0x1FF1FFFF.DTCM RAM:
0x20000000to0x2002FFFF.AXI SRAM starts at
0x24000000.SRAM1/SRAM2 are in the
0x30000000region.XSPI1 window:
0x90000000to0x9FFFFFFF.XSPI2 window:
0x70000000to0x7FFFFFFF.
The address window does not prove that an external memory is fitted, initialized, or memory-mapped on your board. The board schematic and firmware configuration must determine the actual external NOR connection.
External NOR policy
External NOR is intentionally not treated as a generic internal-flash equivalent.
There are three different operations:
Read a memory-mapped NOR — requires the MCU's XSPI controller and pins to already be configured.
Program/erase NOR — requires a valid J-Link flash loader or a target-side programming mechanism for the exact flash/controller/board.
Probe/identify NOR — may require executing controller-specific commands or firmware; a CPU memory read alone is not sufficient.
external_flash_program and external_flash_erase are disabled unless explicitly enabled in configuration. Do not enable them merely because the CPU window is 0x70000000 or 0x90000000.
SEGGER documents an important distinction: VerifyBin performs a memory read/compare and does not initialize an external QSPI/XSPI interface; LoadFile can use a flash download/loader mechanism. Therefore this project does not claim that verifybin can independently access an uninitialized external NOR.
Hardware-profile sources
The checked-in STM32H7S3I8T6/XSPI1 values are based on the ST STM32H7S3I8 product/datasheet and RM0477 memory map, SEGGER's supported-device database, ST's NUCLEO-H7S3L8 documentation identifying the 256-Mbit NOR family, and Macronix documentation for the 512-Mbit density equivalent. The exact custom-board BOM and schematic remain the authoritative source for the assembled hardware.
Requirements
Python 3.10+
SEGGER J-Link Software and Documentation Pack
J-Link probe
ARM GDB (
arm-none-eabi-gdborgdb-multiarch)Optional firmware ELF with debug information
Optional CMSIS-SVD file for peripheral/register semantics
SEGGER supports J-Link Commander and J-Link GDB Server on Linux and macOS.
Install
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
pip install -e ".[dev]"
cp config.example.yaml config.yamlEdit config.yaml, then:
stm32-jlink-mcpConfiguration path can be overridden with:
export STM32_JLINK_MCP_CONFIG=/absolute/path/config.yamlDirect hardware smoke test
Before involving MCP, validate J-Link itself:
JLinkExe
Device STM32H7S3I8
SI SWD
Speed 4000
Connect
Halt
Regs
Mem8 0x08000000, 0x40SEGGER recommends specifying the target device explicitly because device-specific handling may be required during connect/reset.
MCP tool groups
Probe / target
probe_listjlink_connectjlink_disconnectjlink_statustarget_identifytarget_statustarget_resettarget_halttarget_runtarget_step
Memory / registers
memory_readmemory_writeregisters_readregister_readregister_write
Internal flash
flash_programflash_verifyflash_erase
GDB / source debugging
debug_startdebug_stopdebug_continuedebug_pausedebug_stepdebug_breakpoint_setdebug_breakpoint_cleardebug_watchpoint_setdebug_watchpoint_cleardebug_stop_reasondebug_backtraceread_variable
ELF / SVD
load_symbolsresolve_addressresolve_symbolsvd_infoperipheral_inforegister_inforegister_read
STM32 diagnostics
stm32_fault_infostm32_snapshotstm32_reset_reasonboot_diagnose
XSPI / external memory
external_flash_infoexternal_flash_readexternal_flash_testexternal_flash_programexternal_flash_erase
Workflows / expert escape hatches
flash_and_verifydiagnose_crashjlink_command(disabled by default)
Safety model
Configuration supports:
safety:
mode: read_onlyIn read-only mode, target inspection and diagnostics remain available while writes/program/erase are denied.
Destructive or target-modifying operations can require exact confirmation tokens. The MCP server does not interpret a natural-language phrase such as "yes" as authorization.
Testing
Fast tests do not require J-Link hardware:
pytest
ruff check .Hardware tests are marked separately:
pytest -m hardwareThey are intentionally not part of normal CI unless a self-hosted runner with the required hardware is configured.
Project status
This is an engineering-focused v0.2 foundation. The core architecture is intended to be production-oriented, but board-specific external NOR programming still requires validation against the actual schematic, NOR part number, XSPI instance/configuration, and programming method.
Do not use this repository as a substitute for SEGGER documentation, the STM32 reference manual/datasheet, or your board's schematic.
RTT and deployment sequence
J-Link RTT is supported as a first-class diagnostic transport. The preferred board workflow is:
erase -> program -> verify -> RTT connect -> NRST pulse -> capture boot logsAvailable MCP tools:
rtt_connectrtt_readrtt_writertt_disconnectnrst_assertnrst_releasenrst_pulseprogram_verify_rtt_nrst
RTT uses SEGGER's local RTT TELNET transport and channel 0. When no GDB session is already active, the MCP starts a persistent J-Link GDB Server solely to maintain the J-Link connection required by RTT. If GDB is already active, RTT attaches to its configured RTT TELNET port.
See docs/RTT_AND_PROGRAMMING_SEQUENCE.md for ownership, reset, and RTT control-block guidance.
Option bytes
STM32H7S3 option-byte inspection is exposed separately from ordinary memory/register access.
Planned/guarded operations:
option_bytes_readoption_bytes_writeoption_bytes_mass_erase
Option-byte writes and mass erase are disabled by default in configuration because
they are persistent device configuration changes. The implementation must use the
STM32H7S3-specific FLASH option-byte sequence; it must not guess a generic
J-Link Commander command or treat option bytes as ordinary RAM/register writes.
See docs/OPTION_BYTES.md.
This server cannot be deployed
Maintenance
Related MCP Connectors
Flash and run real firmware on physical embedded dev boards from an AI agent, over MCP.
Protocol-native energy infrastructure orchestration for AI data centers. Provides 46 MCP tools across 8 grid protocols (IEC-61850, DNP3, Modbus, OCPP, OpenADR, IEEE 2030.5, IEC 60870-5-104, ICCP) with 5 core API primitives: connect, dispatch, settle, comply, and intel. Enables AI agents to programmatically interact with substations, grid interfaces, and energy assets for real-time workload-grid coordination.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Shared debugging memory for AI coding agents
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI to directly control SEGGER J-Link embedded debug probes via the Model Context Protocol for debugging and firmware management. Users can perform tasks like reading registers, analyzing memory, flashing firmware, and tracking RTT logs using natural language commands.211MIT
- AlicenseAqualityCmaintenanceStateful MCP server for driving debug probes (J-Link) to flash, debug, and inspect embedded targets. Enables AI agents to perform flash, memory, breakpoint, and ELF/SVD-aware operations conversationally.4110MIT
- 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.255MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with STM32 development boards via J-Link debugger using RTT communication, supporting connection, logging, memory operations, and firmware flashing through natural language.121MIT