Install GhidraMCP 2.0 and connect it to Claude Desktop
Switch Ghidra to 12.1.4 (with openjdk-21-jdk), the version the GhidraMCP 2.0 release is built for; Ghidra only loads extensions built for its exact version. From LaurieWired's GhidraMCP 2.0 release zip (SHA-256 checked): - unpack the Ghidra extension into /opt/ghidra/Ghidra/Extensions; the build fails if it doesn't target GHIDRA_VERSION. GhidraMCPPlugin is a RELEASED Developer plugin, so the CodeBrowser config loads it, and it serves its HTTP backend on 127.0.0.1:8080. - install the ghidra-mcp wheel into /opt/ghidra-mcp, with every dependency pinned to GhidraMCP's uv.lock at the release commit (ghidra/uvlock-to-constraints.py, honouring per-Python markers). claude-desktop/claude_desktop_config.json adds a stdio "ghidra" server running ghidra-mcp against http://127.0.0.1:8080/ and is copied into ~/.config/Claude. Verified with a test project: ghidra-mcp started from that config connected to Ghidra 12.1.4 in GUI mode and returned program info, segments and imports for the open program. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+51
-6
@@ -35,13 +35,15 @@ RUN apt-get update \
|
||||
|
||||
# Ghidra from the official GitHub release, checked against the SHA-256 in the
|
||||
# release notes: https://github.com/NationalSecurityAgency/ghidra/releases
|
||||
# Ghidra 12.2 needs JDK 25 (application.java.min=25). The full JDK, not the
|
||||
# 12.1.4 because that is the version the GhidraMCP release below is built
|
||||
# for; Ghidra only loads extensions built for its exact version.
|
||||
# Ghidra 12.1.4 needs JDK 21 (application.java.min=21). The full JDK, not the
|
||||
# headless one, because Ghidra's GUI needs the AWT/X11 libraries.
|
||||
ARG GHIDRA_VERSION=12.2
|
||||
ARG GHIDRA_BUILD_DATE=20261016
|
||||
ARG GHIDRA_SHA256=2c2cd776db3c1f6a097ba418922378ac3649cadd5e844a6f5f088ae628a7be67
|
||||
ARG GHIDRA_VERSION=12.1.4
|
||||
ARG GHIDRA_BUILD_DATE=20260921
|
||||
ARG GHIDRA_SHA256=ddac49f903da9d5bac833e5cc79395098b9c33cfd3279be5f31bd00387d2d4db
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openjdk-25-jdk unzip \
|
||||
&& apt-get install -y --no-install-recommends openjdk-21-jdk unzip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& curl -fsSLo /tmp/ghidra.zip \
|
||||
"https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${GHIDRA_VERSION}_build/ghidra_${GHIDRA_VERSION}_PUBLIC_${GHIDRA_BUILD_DATE}.zip" \
|
||||
@@ -70,6 +72,43 @@ RUN set -e; cd /tmp \
|
||||
&& jar uf "$jar_file" defaultTools/CodeBrowser.tool \
|
||||
&& rm -r /tmp/defaultTools /tmp/codebrowser-developer.xml
|
||||
|
||||
# GhidraMCP (https://github.com/LaurieWired/GhidraMCP), official release zip
|
||||
# checked against the SHA-256 GitHub lists for it. It holds:
|
||||
# - the Ghidra extension, unpacked into Ghidra's own Extensions directory so
|
||||
# it is installed for every user. Its GhidraMCPPlugin is a RELEASED plugin
|
||||
# in the Developer package, so the CodeBrowser config above loads it. It
|
||||
# serves an HTTP backend on 127.0.0.1:8080 while the CodeBrowser is open.
|
||||
# - the ghidra-mcp Python MCP server (wheel), installed into its own venv.
|
||||
# Claude Desktop starts it over stdio; it forwards calls to that backend.
|
||||
# The wheel only gives version ranges, so every dependency is pinned to
|
||||
# the version in GhidraMCP's uv.lock at the release commit.
|
||||
ARG GHIDRAMCP_VERSION=2.0
|
||||
ARG GHIDRAMCP_SHA256=ebf904fd6782e429e95a60a24fe0724b20c0acb2dedb304135a5281f6b5f2e72
|
||||
ARG GHIDRAMCP_COMMIT=1e980252087b2479a21b9ca6d82d5829538651a7
|
||||
ARG GHIDRAMCP_UVLOCK_SHA256=f80ffe8df8167535f253976a1dfb702a9a7f8836d884084017dd7c04e1444837
|
||||
COPY ghidra/uvlock-to-constraints.py /tmp/uvlock-to-constraints.py
|
||||
RUN set -e \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python3 python3-venv \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rel="GhidraMCP-release-$(echo "${GHIDRAMCP_VERSION}" | tr . -)" \
|
||||
&& curl -fsSLo /tmp/ghidramcp.zip \
|
||||
"https://github.com/LaurieWired/GhidraMCP/releases/download/${GHIDRAMCP_VERSION}/${rel}.zip" \
|
||||
&& echo "${GHIDRAMCP_SHA256} /tmp/ghidramcp.zip" | sha256sum -c - \
|
||||
&& unzip -q /tmp/ghidramcp.zip -d /tmp/ghidramcp \
|
||||
&& unzip -q /tmp/ghidramcp/${rel}/ghidra_${GHIDRA_VERSION}_PUBLIC_*_GhidraMCP.zip \
|
||||
-d /opt/ghidra/Ghidra/Extensions \
|
||||
&& grep -qx "version=${GHIDRA_VERSION}" /opt/ghidra/Ghidra/Extensions/GhidraMCP/extension.properties \
|
||||
&& curl -fsSLo /tmp/uv.lock \
|
||||
"https://raw.githubusercontent.com/LaurieWired/GhidraMCP/${GHIDRAMCP_COMMIT}/uv.lock" \
|
||||
&& echo "${GHIDRAMCP_UVLOCK_SHA256} /tmp/uv.lock" | sha256sum -c - \
|
||||
&& python3 -I /tmp/uvlock-to-constraints.py /tmp/uv.lock > /tmp/constraints.txt \
|
||||
&& python3 -m venv /opt/ghidra-mcp \
|
||||
&& /opt/ghidra-mcp/bin/pip install --no-cache-dir --disable-pip-version-check \
|
||||
--constraint /tmp/constraints.txt /tmp/ghidramcp/${rel}/ghidra_mcp-*-py3-none-any.whl \
|
||||
&& /opt/ghidra-mcp/bin/ghidra-mcp --help >/dev/null \
|
||||
&& rm -rf /tmp/ghidramcp /tmp/ghidramcp.zip /tmp/uv.lock /tmp/constraints.txt /tmp/uvlock-to-constraints.py
|
||||
|
||||
# Ubuntu 24.04 ships a default "ubuntu" user on UID 1000; replace it.
|
||||
RUN if id ubuntu >/dev/null 2>&1; then userdel -r ubuntu; fi \
|
||||
&& groupadd -g "${USER_GID}" "${USER_NAME}" \
|
||||
@@ -79,7 +118,8 @@ RUN if id ubuntu >/dev/null 2>&1; then userdel -r ubuntu; fi \
|
||||
&& install -d -o "${USER_UID}" -g "${USER_GID}" \
|
||||
"/home/${USER_NAME}/.config" \
|
||||
"/home/${USER_NAME}/.config/ghidra" \
|
||||
"/home/${USER_NAME}/.config/ghidra/ghidra_${GHIDRA_VERSION}_PUBLIC"
|
||||
"/home/${USER_NAME}/.config/ghidra/ghidra_${GHIDRA_VERSION}_PUBLIC" \
|
||||
"/home/${USER_NAME}/.config/Claude"
|
||||
|
||||
# Ghidra's project window has no default config to patch; it builds one in
|
||||
# code and saves it on exit. So a starting FrontEndTool.xml with the Developer
|
||||
@@ -89,6 +129,11 @@ RUN if id ubuntu >/dev/null 2>&1; then userdel -r ubuntu; fi \
|
||||
COPY --chown=${USER_UID}:${USER_GID} ghidra/FrontEndTool.xml ghidra/preferences \
|
||||
/home/${USER_NAME}/.config/ghidra/ghidra_${GHIDRA_VERSION}_PUBLIC/
|
||||
|
||||
# Claude Desktop's MCP servers. Only this file is put in ~/.config/Claude;
|
||||
# sign-in data is still created at runtime and discarded with the container.
|
||||
COPY --chown=${USER_UID}:${USER_GID} claude-desktop/claude_desktop_config.json \
|
||||
/home/${USER_NAME}/.config/Claude/claude_desktop_config.json
|
||||
|
||||
COPY --chmod=755 launch-apps.sh /usr/local/bin/launch-apps
|
||||
|
||||
USER ${USER_NAME}
|
||||
|
||||
Reference in New Issue
Block a user