#!/usr/bin/env bash # # Ghidra Headless MCP launcher for the VT1200 project. # # OpenCode starts this over stdio (see opencode.json in the repo root). It drives # the vendored mrphrazer/ghidra-headless-mcp server against Ghidra 12.1.2 at # /opt/ghidra through PyGhidra. The custom tms34010 processor module is installed # system-wide, so the server can open this project's programs with no extra setup. # # Open the existing analysis (reuses the FixPtrConstants cross-references) with a # tool call such as: # # project.program.open_existing # project_location = /home/arti/code/k-space/vt1200/ghidra # project_name = vt1200 # program_name = vt1200_v22.bin # set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" venv="$here/ghidra-headless-mcp/.venv" # Ghidra 12.1.2 requires Java 21+ (application.java.min=21, no max). export GHIDRA_INSTALL_DIR="${GHIDRA_INSTALL_DIR:-/opt/ghidra}" # If the default JDK is ever rejected, point JAVA_HOME at a JDK 21 here: # export JAVA_HOME=/path/to/jdk-21 exec "$venv/bin/ghidra-headless-mcp" "$@"