Skip to content

Native MCP server, analysis helpers, and packaging - #20

Open
maci0 wants to merge 11 commits into
akiselev:masterfrom
maci0:feature/mcp-server-goal-items
Open

maci0 wants to merge 11 commits into
akiselev:masterfrom
maci0:feature/mcp-server-goal-items

Conversation

@maci0

@maci0 maci0 commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Native MCP server (stdio + streamable HTTP) with focused tools, stable envelopes, mutations, batch/script artifacts, and capability reporting. Also lands first versions of high-level triage (summarize), headless dual-program match (diff_programs), p-code, explicit transactions, packaging (Docker + Homebrew formula), doctor recovery hints, and an agent skill workflow.

What changed

  • MCP: ghidra mcp stdio / ghidra mcp http --listen … — shared tool registry, provenance + next_steps + recovery_suggestions + artifacts
  • Mutations: same bridge job queue/transactions as CLI; durability docs + gated rename test
  • script_run / batch: expect → envelope artifacts[]; batch per-command status
  • initialize / capabilities: CLI version, feature flags, schema version rule (docs/MCP.md)
  • Helpers: summarize/triage, pcode --max-ops, transaction begin|commit|abort, diff_programs (function name-set match + dual provenance)
  • Packaging: Dockerfile, Formula/ghidra-cli.rb, skills/triage-decomp-patch-export.md
  • CLI: --envelope for provenance on JSON; doctor recovery suggestions

Out of scope / honest gaps

  • Full interactive Ghidra Version Tracking UI (headless name-set match + diff_functions only)
  • SSE long-job streaming on HTTP
  • Multi-program firmware convenience layer
  • Publishing Docker image or submitting Homebrew upstream

Test plan

  • cargo test --bin ghidra mcp:: (no Ghidra) — envelopes, recovery, batch, HTTP equiv, artifacts, summarize confidence
  • cargo test --test daemon_tests test_mcp_ with Ghidra + non-dot GHIDRA_PROJECT_DIR — mutation durability, HTTP launch, stdio decompile context, summarize/pcode/transaction
  • ghidra pcode --help (no clap panic on --limit)
  • docker build -t ghidra-cli:local .
  • ghidra doctor with safe projects dir
  • CI green after push (unit-and-cli now runs MCP binary unit tests)

Notes for reviewers

  • Ghidra 12.1+ rejects project paths with a .-prefixed component; prefer GHIDRA_PROJECT_DIR / --projects-dir without hidden segments.
  • Prefer reviewing commit-by-commit (MCP core → bridge primitives → tests → packaging → skeptic fixes → PR prep).
  • Docs entrypoint: docs/MCP.md.

maci0 added 11 commits August 8, 2026 19:05
Ship MCP slices 1.4-1.7 on a shared tool registry used by stdio and HTTP.
Mutation tools route through the bridge job queue with recovery_suggestions
and full provenance; decompile always includes nearby_xrefs/callers/namespace;
script_run surfaces expect artifacts; batch runs command arrays with per-item
status; initialize reports schema version and feature flags. HTTP binds
ephemeral ports, defaults to loopback, optional bearer token.
Expose pcode and transaction_begin/commit/abort handlers so MCP and CLI
can request high-level undo boundaries and inspect decompiler p-code ops.
Align test project-dir resolution with the CLI, then cover rename
durability across a fresh MCP process and real HTTP tools/list+ping.
Provide an official Dockerfile, in-repo brew formula, triage-to-export skill
workflow, and refresh remaining-todo docs after MCP base completion.
MCP reuses a per-session bridge client across tools/call requests.
Rename pcode limit to --max-ops so clap no longer clashes with QueryOptions.
Implement headless dual-program function-name match for diff_programs with
dual provenance. Add unit tests for script_run artifact elevation and summarize
confidence tags, plus a gated live test for summarize, pcode, and transactions.
Document MCP and goal-item work under Unreleased, run binary-crate MCP unit
tests in CI, and mark review/remaining-todo process files as complete for PR.
…-program

HTTP MCP can stream progress frames then the same JSON-RPC envelope via
?stream=1. Headless dual-program transfer and explain complement name-set match.
Structure recovery, data-flow, and similarity helpers ship on CLI and MCP with
confidence tags. programs_foreach / firmware-summarize run sequentially on the
single program lane. Docs and gated tests cover the new surfaces.
Save program2 after transfer_analysis before release, create real XFER_*
labels and xfer_from comments (not no-op renames), and gate tests on two
imported programs with fresh-process re-read of a transferred address.
Multi-program summarize asserts ≥2 sequential results; docs use --include.
Align mutation tool schemas and payloads with the Java bridge (delete_function
address, return_type, var_name/type_name, type field/typedef/enum args with
aliases). Emit namespace from functionToJson; abort explicit transactions on
program switch; stream SSE frames without Content-Length; drop CORS *; preserve
firmware_summarize command identity. Add offline parity tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant