Skip to main content
Glama
gghammer

MCP J-Link Server

by gghammer

MCP J-Link Server

Python MCP License

透過 Model Context Protocol (MCP) 讓 AI 直接控制 SEGGER J-Link 嵌入式除錯探針。

讓 AI 自動讀取暫存器、分析記憶體、燒錄韌體、追蹤 RTT 日誌 — 用自然語言描述問題,AI 幫你除錯。

功能概覽

群組

工具

說明

探索

jlink_list_emulators jlink_get_status

列舉探針、查看連線狀態

連線

jlink_open jlink_connect jlink_close

開啟/連線/關閉探針

記憶體

jlink_memory_read jlink_memory_write

讀寫記憶體(8/16/32-bit)

燒錄

jlink_flash_file jlink_erase_chip

韌體燒錄、全片擦除

執行控制

jlink_reset jlink_halt jlink_go jlink_step

重置/暫停/繼續/單步

暫存器

jlink_register_read jlink_register_read_all jlink_register_write

讀寫 CPU 暫存器

RTT

rtt_start rtt_read rtt_write rtt_stop rtt_get_status

SEGGER RTT 即時通訊

21 個 MCP 工具,涵蓋嵌入式除錯的完整工作流程。

Related MCP server: jlink-mcp

前置需求

  • Python 3.10+

  • SEGGER J-Link Software下載安裝

  • J-Link 探針(USB 連接)

注意:Python 位元數必須與 J-Link DLL 匹配(64-bit Python 需要 JLink_x64.dll)。

安裝

git clone https://github.com/你的帳號/MCP_JLINK.git
cd MCP_JLINK
pip install -e .

驗證安裝:

python -m mcp_jlink

伺服器啟動後會透過 STDIO 等待 MCP 請求(按 Ctrl+C 結束)。

整合設定

Claude Code / Antigravity

將以下設定加入 MCP 設定檔:

{
  "mcpServers": {
    "jlink": {
      "command": "python",
      "args": ["-m", "mcp_jlink"],
      "cwd": "/path/to/MCP_JLINK"
    }
  }
}

Claude Desktop

claude_desktop_config.json 中加入相同設定。

使用範例

設定完成後,直接用自然語言與 AI 對話:

你:我的板子卡住了,幫我看一下停在哪裡
AI:(自動執行 jlink_open → jlink_connect → jlink_halt → 讀取 PC/LR 暫存器 → 分析)
    程式停在 0x0800_1A3C,位於 SysTick_Handler 中。
    LR = 0xFFFF_FFF9,表示從 Thread Mode 進入中斷。
    看起來是 SysTick 中斷處理函式內的無限迴圈...
你:幫我燒錄 firmware.hex 到 STM32F407VG
AI:(自動執行 jlink_open → jlink_connect("STM32F407VG") → jlink_flash_file → jlink_reset)
    韌體燒錄完成!已寫入 32,768 bytes,耗時 1.2 秒。目標已重置並開始執行。
你:開啟 RTT 日誌,讓我看看板子在印什麼
AI:(自動執行 rtt_start → rtt_read → 持續讀取)
    RTT Channel 0 輸出:
    [INFO] System boot OK
    [INFO] Sensor init: BME280 detected
    [WARN] WiFi connection timeout, retrying...

本專案不內含 J-Link SDK,DLL 搜尋優先順序:

  1. 環境變數 JLINK_SDK_PATH

  2. SEGGER 預設安裝路徑下的 JLink* 目錄(自動匹配帶版本號名稱如 JLink_V922

  3. pylink-square 內建搜尋

專案架構

src/mcp_jlink/
├── server.py        # FastMCP 伺服器 + 21 個 MCP tool 定義
├── connection.py    # JLinkManager 連線狀態機(單例)
├── errors.py        # 自訂例外 + 前置條件裝飾器
├── __main__.py      # python -m mcp_jlink 進入點
└── __init__.py

skills/               # AI 除錯情境指南(按需載入)
├── SKILL.md          # 主索引 + 情境路由表
├── crash-analysis.md
├── hardfault-diagnosis.md
├── peripheral-verification.md
├── flash-and-verify.md
├── rtt-logging.md
├── memory-leak-detection.md
├── variable-monitoring.md
├── interrupt-analysis.md
├── low-power-debug.md
└── batch-flashing.md

連線狀態機

DISCONNECTED ──open()──> PROBE_OPEN ──connect()──> TARGET_CONNECTED ──rtt_start()──> RTT_ACTIVE
     ^                      |                           |                              |
     └──────close()─────────┴──────────close()──────────┴──────────close()─────────────┘

每個工具透過裝飾器自動檢查前置條件,不需要手動管理連線狀態。

開發

# 安裝開發相依
pip install -e ".[dev]"

# 執行測試
pytest

License

MIT

Available Tools

21 tools
rtt_get_statusB

取得 RTT 緩衝區狀態資訊。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states what the tool does ('取得 RTT 緩衝區狀態資訊') without describing the behavior: whether it's read-only or has side effects, what the output contains (though an output schema exists), error conditions, or dependencies on other tools like 'rtt_start'. For a tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese: '取得 RTT 緩衝區狀態資訊.' It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a simple tool. Every word earns its place by specifying the action and target.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, output schema exists), the description is minimally adequate. However, it lacks context about RTT (Real-Time Transfer) or how this fits with sibling tools like 'rtt_start'/'rtt_stop'. With no annotations and many sibling tools, more guidance would help the agent understand the tool's role in the broader debugging workflow.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the input schema has 100% description coverage (though empty). The description doesn't need to explain parameters, and it correctly doesn't mention any. A baseline of 4 is appropriate for zero-parameter tools, as there's no parameter semantics to document.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool '取得 RTT 緩衝區狀態資訊' (gets RTT buffer status information), which provides a clear verb ('取得' - get) and resource ('RTT 緩衝區狀態資訊' - RTT buffer status information). However, it doesn't distinguish this from sibling tools like 'jlink_get_status' or 'rtt_start'/'rtt_stop', leaving ambiguity about when to use this specific RTT status tool versus other status-related tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether RTT must be started first), compare it to 'jlink_get_status', or specify scenarios where RTT buffer status is needed versus other operations. This leaves the agent without context for tool selection among the many sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rtt_readA

從 RTT 上行緩衝區讀取資料(裝置→主機方向)。

讀取的資料會從緩衝區中移除。若無資料則回傳空結果。

Args: buffer_index: RTT 上行緩衝區索引,預設 0(通常是 Terminal) num_bytes: 最大讀取位元組數,預設 1024

ParametersJSON Schema
NameRequiredDescriptionDefault
buffer_indexNo
num_bytesNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: '讀取的資料會從緩衝區中移除' (read data is removed from buffer) indicates destructive consumption, and '若無資料則回傳空結果' (returns empty result if no data) clarifies the empty case behavior. However, it doesn't mention potential rate limits, error conditions, or authentication needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement first, followed by behavioral notes, then parameter explanations. Every sentence adds value with no wasted words, and the bilingual presentation (Chinese with English parameter names) is practical for the context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values), no annotations, and good parameter coverage in the description, the description is quite complete. It covers purpose, key behavior, and parameter semantics. The main gap is lack of explicit usage guidelines compared to sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining both parameters: buffer_index specifies 'RTT 上行緩衝區索引,預設 0(通常是 Terminal)' (RTT upstream buffer index, default 0, usually Terminal), and num_bytes specifies '最大讀取位元組數,預設 1024' (maximum bytes to read, default 1024). This adds meaningful context beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('從 RTT 上行緩衝區讀取資料' - read data from RTT upstream buffer) and resource ('裝置→主機方向' - device to host direction). It distinguishes from sibling tools like rtt_write (which writes data) and other J-Link tools that perform different operations on the debugger/emulator.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing to read data from the RTT upstream buffer, but doesn't explicitly state when to use this vs alternatives like rtt_get_status (which provides status rather than data) or other buffer operations. No explicit exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rtt_startA

啟動 RTT(Real-Time Transfer)通訊。

目標韌體必須已整合 SEGGER RTT 函式庫。 啟動後可使用 rtt_read / rtt_write 進行雙向通訊。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the prerequisite (firmware must integrate SEGGER RTT library) and the post-start capabilities (using rtt_read/rtt_write), which adds useful context. However, it doesn't describe what the tool actually does behaviorally (e.g., initializes communication channels, returns status), potential side effects, error conditions, or what the output contains. The description is adequate but lacks depth for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured: two sentences in Chinese that efficiently convey the purpose, prerequisite, and follow-up actions. Every sentence earns its place with no wasted words, and it's front-loaded with the main action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has 0 parameters, 100% schema coverage, no annotations, but has an output schema (which means the description doesn't need to explain return values), the description is reasonably complete. It covers the purpose, prerequisite, and post-execution context. However, for a tool with no annotations, it could benefit from more behavioral details about what 'starting RTT communication' entails operationally.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage. The description doesn't need to explain parameters, and it appropriately doesn't mention any. The baseline for 0 parameters is 4, as there's nothing to document and the description doesn't incorrectly reference parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '啟動 RTT(Real-Time Transfer)通訊' (Start RTT communication). It specifies the verb ('啟動' - start) and resource ('RTT通訊' - RTT communication). However, it doesn't explicitly differentiate from sibling tools like 'rtt_stop' or 'rtt_get_status' beyond mentioning that after starting, 'rtt_read' and 'rtt_write' can be used.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage context: '目標韌體必須已整合 SEGGER RTT 函式庫' (Target firmware must already integrate SEGGER RTT library) and mentions that after starting, 'rtt_read' and 'rtt_write' can be used. However, it doesn't explicitly state when to use this tool versus alternatives like 'rtt_stop' or 'rtt_get_status', nor does it provide clear exclusions or prerequisites beyond the library requirement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rtt_stopB

停止 RTT 通訊。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action ('stop') but doesn't disclose behavioral traits such as whether this is a safe operation, if it requires specific permissions, what happens to ongoing communications, or error conditions. This is inadequate for a tool with potential side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded and efficiently conveys the core action, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters and an output schema exists (which handles return values), the description's minimalism is somewhat acceptable. However, for a tool that likely interacts with hardware/communication systems, more context on behavior and usage is needed, especially with no annotations provided.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly implies no parameters are required, aligning with the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('停止' meaning 'stop') and target ('RTT 通訊' meaning 'RTT communication'), providing a basic purpose. However, it's vague about what RTT communication entails and doesn't distinguish from sibling tools like 'rtt_start' or 'rtt_get_status' beyond the opposite action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., that RTT must be started first using 'rtt_start'), exclusions, or relationships with sibling tools like 'rtt_get_status' for checking status.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rtt_writeB

寫入資料到 RTT 下行緩衝區(主機→裝置方向)。

Args: text: 要傳送的文字內容 buffer_index: RTT 下行緩衝區索引,預設 0

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes
buffer_indexNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states this is a write operation but doesn't disclose important behavioral aspects: whether this is synchronous/asynchronous, error conditions, buffer overflow behavior, or what happens if RTT isn't active. The description is minimal beyond the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise with zero wasted words. The description is front-loaded with the core purpose, followed by clear parameter explanations. Every sentence serves a distinct purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the basic operation and parameters adequately. However, for a write operation with no annotations and complex sibling tools, it should ideally mention prerequisites (RTT must be started) and behavioral expectations. The existence of an output schema helps but doesn't fully compensate for the lack of operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining both parameters: 'text' as the content to send and 'buffer_index' as the RTT downlink buffer index with default value 0. This adds meaningful context beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('寫入資料' - write data) and target ('RTT 下行緩衝區' - RTT downlink buffer) with direction specified ('主機→裝置方向' - host→device direction). It distinguishes from sibling rtt_read but doesn't explicitly contrast with other RTT tools like rtt_start/stop.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. While it's clear this is for writing to RTT buffers, there's no mention of prerequisites (e.g., whether RTT must be started first using rtt_start) or when to choose this over other communication methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 21 tool updatesv0.1.0
    • First observedjlink_close
    • First observedjlink_connect
    • First observedjlink_erase_chip
    • First observedjlink_flash_file
    • First observedjlink_get_status
    • First observedjlink_go
    • First observedjlink_halt
    • First observedjlink_list_emulators
    • First observedjlink_memory_read
    • First observedjlink_memory_write
    • First observedjlink_open
    • First observedjlink_register_read
    • First observedjlink_register_read_all
    • First observedjlink_register_write
    • First observedjlink_reset
    • First observedjlink_step
    • First observedrtt_get_status
    • First observedrtt_read
    • First observedrtt_start
    • First observedrtt_stop
    • First observedrtt_write

TDQS

A3.8/5.0
Disambiguation5/5

Every tool has a clearly distinct purpose with no ambiguity. Tools are well-organized into categories: core J-Link operations (connect, open, close, reset, go, halt, step), memory operations (read/write), register operations (read/write), flash operations (erase, flash), emulator management (list), status queries (get_status), and RTT operations (start, stop, read, write, get_status). Even similar-sounding tools like jlink_memory_read and jlink_register_read target different resources (memory vs CPU registers).

Naming Consistency5/5

Perfectly consistent snake_case naming throughout. All tools follow a clear prefix pattern: 'jlink_' for core debugger operations and 'rtt_' for RTT-specific operations, followed by descriptive verb_noun combinations (e.g., jlink_connect, jlink_memory_write, rtt_start). This creates a predictable and readable naming convention across all 21 tools.

Tool Count4/5

21 tools is slightly high but reasonable for a comprehensive embedded debugging server. The server covers multiple aspects: probe management, target control, memory/register access, flashing, and RTT communication. While some consolidation might be possible (e.g., register read/write could be one tool with a mode parameter), each tool earns its place by providing distinct functionality needed for embedded development workflows.

Completeness5/5

The tool surface provides complete coverage for J-Link debugging operations. It includes all essential CRUD/lifecycle operations: connection management (open/close/connect), target control (reset/halt/go/step), memory access (read/write), register access (read/write), flash programming (erase/flash), status monitoring, and RTT communication (start/stop/read/write). No obvious gaps exist for typical embedded debugging scenarios.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Stateful 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.
    41
    10
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants like Claude to directly debug microcontrollers via JLink, supporting breakpoints, single-step, memory/register access, variable inspection, RTT logging, and firmware flashing.
    25
    5
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI tools to perform full-featured embedded microcontroller debugging via pyOCD and CMSIS-DAP probes, including probe management, flashing, breakpoints, register/memory access, fault analysis, and RTT communication.
    58
    1
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gghammer/MCP_JLINK'

If you have feedback or need assistance with the MCP directory API, please join our Discord server