Skip to content

Route pylink-square-mcp through J-Link Remote Server backend #52

Closed

Description

@emrainey

The pylink-square MCP server crashes periodically. Root cause hypothesis: every tool call creates a fresh pylink.JLink(), opens USB, connects, and discards -> repeated DLL load/unload + USB churn in a long-lived process.

Goal:

  1. Make J-Link Remote Server on localhost (default port 19020) the default connection backend for all scripts in tools/pylink-square-mcp.
  2. mcp_server.py should launch JLinkRemoteServer (-Port, optional -USB <serial/nickname>) on startup if it is not already listening, then persist across MCP restarts.

Per SEGGER KB (https://kb.segger.com/J-Link_Remote_Server), JLinkRemoteServerCLExe takes -Port and -USB (S/N or nickname) options; device/speed stay client-side in pylink connect(). Client connects via jlink.open(ip_addr='127.0.0.1:').

Activity

  1. emrainey commented on Aug 11, 2026

    @emrainey
    OwnerAuthor

    Implemented on branch issue-52 → PR #53.

    • All 13 J-Link tools converted to connect via a persistent localhost J-Link Remote Server (port 19020) with direct-USB fallback.
    • mcp_server.py now launches JLinkRemoteServer -Port <port> [-USB <serial>] on startup if not listening and leaves it running across MCP restarts.
    • Added --device/--speed/--remote-port/--usb-serial CLI opts with JLINK_MCP_* env fallbacks.
    • Verified live on hardware through the tunnel (debug_target, run_for, rtt_read --continuous); host LLVM build + 18/18 unit tests pass. No C++ touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions