mirror of
https://github.com/siemens-mobile-hacks/GhidraMCP.git
synced 2026-11-25 23:57:13 +00:00
The plugin now is the MCP server (Streamable HTTP at /mcp); the Python bridge and the plain-text HTTP API it used are removed. - One shared server per Ghidra process: started from the project window (GhidraMCPServerPlugin), any CodeBrowser, or headless via StartGhidraMcpServer.java. Programs resolve across all windows and programs opened in the background. - Project and program lifecycle: list/import/open/close/save programs, manage project files, open/close/create projects. - Auto-analysis control, function details and variables, symbols, comments, data, struct/enum editing, call graphs, decompiler data-flow slices, scalar and memory search, memory writes, scripts, MCP prompts and resources. - Decompiler process reused per program with a cache keyed to the program modification number (previously one leaked process per call). - Original tools split into domain classes; duplicate tools removed. - Fix false "Failed" results for nested transactions, a GUI deadlock and a modal-dialog hang when closing projects with several CodeBrowsers. - JUnit 4 (tests run in build.sh again), install.sh, and an end-to-end suite (tests/e2e) that exercises every tool against a live Ghidra.
34 lines
1.5 KiB
Bash
Executable file
34 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Installs the built GhidraMCP extension into the user's Ghidra settings
|
|
# directory (the same place "File -> Install Extensions" uses).
|
|
# Restart Ghidra afterwards. Usage: ./install.sh [path/to/GhidraMCP-*.zip]
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
GHIDRA_HOME="${GHIDRA_HOME:-/opt/ghidra}"
|
|
PROPS="${GHIDRA_HOME}/Ghidra/application.properties"
|
|
ZIP="${1:-${ROOT_DIR}/target/GhidraMCP-1.0-SNAPSHOT.zip}"
|
|
|
|
[[ -f "${PROPS}" ]] || { echo "Ghidra not found: ${PROPS} (set GHIDRA_HOME)" >&2; exit 1; }
|
|
[[ -f "${ZIP}" ]] || { echo "Extension zip not found: ${ZIP} (run ./build.sh)" >&2; exit 1; }
|
|
|
|
VERSION="$(sed -n 's/^application\.version=//p' "${PROPS}")"
|
|
RELEASE="$(sed -n 's/^application\.release\.name=//p' "${PROPS}")"
|
|
SETTINGS="${XDG_CONFIG_HOME:-${HOME}/.config}/ghidra/ghidra_${VERSION}_${RELEASE}"
|
|
EXT_DIR="${SETTINGS}/Extensions"
|
|
|
|
mkdir -p -- "${EXT_DIR}"
|
|
if [[ -d "${EXT_DIR}/GhidraMCP" ]]; then
|
|
BACKUP_DIR="${SETTINGS}/ExtensionBackups"
|
|
mkdir -p -- "${BACKUP_DIR}"
|
|
BACKUP="${BACKUP_DIR}/GhidraMCP-$(date +%Y%m%d-%H%M%S)"
|
|
mv -- "${EXT_DIR}/GhidraMCP" "${BACKUP}"
|
|
echo "Previous version moved to ${BACKUP}"
|
|
# Keep only the three most recent GhidraMCP backups.
|
|
ls -1d "${BACKUP_DIR}"/GhidraMCP-* 2>/dev/null | sort | head -n -3 | while read -r old; do
|
|
rm -rf -- "${old}"
|
|
done
|
|
fi
|
|
unzip -q -- "${ZIP}" -d "${EXT_DIR}"
|
|
echo "Installed GhidraMCP into ${EXT_DIR}/GhidraMCP (Ghidra ${VERSION} ${RELEASE}). Restart Ghidra."
|