About Mecha Ghidra
Mecha Ghidra is an MCP server in the Browser category: ghidraMCP for headless.
Install
git clone https://github.com/ghidra-user-jp/mecha_ghidraThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Tools (76)
add_bookmarkAdd bookmark
Parameters not published.
add_project_program_to_version_controlAdd private program to shared version control
Parameters not published.
add_struct_membersAdd struct members
Parameters not published.
analyze_programRun analysis when the program is marked unanalyzed; `force=true` runs it again
Parameters not published.
bsim_add_executable_categoryAdd an executable metadata category
Parameters not published.
bsim_apply_matchesRename default-named functions after their best match in one transaction (`dry_run` available)
Parameters not published.
bsim_delete_executableRemove an executable and its function records (`confirm` must repeat the md5 or name)
Parameters not published.
bsim_load_matched_executableOpen the executable behind a match as a new target; `ghidra://` matches need `--bsim-remote-cache-dir`
Parameters not published.
bsim_register_targetGenerate signatures for the loaded program and insert them (optional `categories`)
Parameters not published.
bsim_update_executable_metadataChange categories on an existing record
Parameters not published.
Show all 76 tools
bsim_update_target_signaturesPush the loaded program's current function names back to its records
Parameters not published.
checkout_project_programCheckout program; `exclusive` omitted follows `--shared-sync-exclusive-checkout`
Parameters not published.
close_sessionClose a target session
Parameters not published.
close_session_and_remove_programClose a session and remove the program from the project
Parameters not published.
commit_project_programCheck in checked-out changes; on a stale checkout `on_conflict="keep"` parks the local edits in a `.keep` copy and `on_conflict="discard"` drops them
Parameters not published.
create_functionCreate a function at an address
Parameters not published.
create_labelCreate a label at an address that has no symbol yet
Parameters not published.
create_projectCreate an empty local Ghidra project
Parameters not published.
create_sessionAdd a target by opening an existing project program
Parameters not published.
create_structCreate struct
Parameters not published.
decompile_functionGet C-like pseudocode by function name or address (`address` wins if both are set)
Parameters not published.
delete_bookmarkDelete a bookmark by ID or by address/type/category
Parameters not published.
delete_data_typeDelete a data type (struct, union, enum, typedef, ...)
Parameters not published.
delete_functionDelete a function by address
Parameters not published.
delete_shared_project_fileDelete an unloaded file after `confirm` matches `domain_path`; versioned files additionally require `expected_latest_version` and explicit `allow_non_atomic_versioned_delete=true`
Parameters not published.
disassemble_functionGet disassembly for a function
Parameters not published.
disassemble_rangeGet disassembly for an address range
Parameters not published.
export_programWrite the program as a `.gzf` archive or raw bytes (restrict with `--allowed-export-root`)
Parameters not published.
get_bsim_database_statusDatabase metadata, executable count, configured categories and function tags
Parameters not published.
get_bytesRead bytes at an address
Parameters not published.
get_calleeList the functions called from the function at an address as `{name, entry, is_external}`
Parameters not published.
get_commentsRead every comment slot at an address
Parameters not published.
get_data_by_labelGet data by label name
Parameters not published.
get_enumGet enum definition
Parameters not published.
get_functionGet a function's signature, parameters, locals, body range, thunk target, and namespace by name or address (`address` wins if both are set)
Parameters not published.
get_function_xrefsList the callers of a function (by address or name) with the calling function's name
Parameters not published.
get_program_infoLanguage, compiler, image base, md5/sha256, entry points, analysis flag, unsaved changes, undo availability
Parameters not published.
get_project_sync_statusGet sync state against shared project
Parameters not published.
get_structGet struct definition
Parameters not published.
get_version_diffGet summarized differences between two versions (count/type/address range); `include_details=true` adds Ghidra's Diff description per range
Parameters not published.
get_version_historyGet version history (version/user/comment/time)
Parameters not published.
get_xrefs_fromGet cross-references from an address, including the referenced function
Parameters not published.
get_xrefs_toGet cross-references to an address, including the referencing function
Parameters not published.
import_programImport a binary or `.gzf` into the project
Parameters not published.
list_bookmarksList bookmarks
Parameters not published.
list_data_itemsList data items with label, length, and value
Parameters not published.
list_data_typesList program data types
Parameters not published.
list_exportsList exported symbols with address
Parameters not published.
list_functionsList functions with size and thunk flag; `filter` narrows by name, `only_default_names=true` lists the still-unnamed `FUN_` functions
Parameters not published.
list_importsList imported symbols with library and address
Parameters not published.
list_namespacesList namespaces as `{name, is_class}` (paginated); `classes_only=true` for classes
Parameters not published.
list_project_programsList programs in the target's opened project
Parameters not published.
list_segmentsGet memory segment/layout info
Parameters not published.
list_stringsList strings (case-insensitive `filter`)
Parameters not published.
list_targetsList registered targets and associated project metadata
Parameters not published.
load_project_programLoad an existing program by `domain_path`; loading the program the target already holds reloads it in place, and `version=N` opens a past shared-project version read-only
Parameters not published.
parse_c_declarationsParse C structs, unions, enums, typedefs, and prototypes into the program's types
Parameters not published.
pull_project_programPull latest state (with optional discard/follow behavior)
Parameters not published.
read_resultRead a slice of a stored large tool result (page with `offset_chars` / `limit_chars` until `has_more` is false; `limit_chars` defaults to a third of the compaction threshold)
Parameters not published.
register_targetRegister project metadata to a target without opening a program
Parameters not published.
remove_struct_membersRemove selected struct members, or every member when `members` is omitted
Parameters not published.
rename_dataRename a data label
Parameters not published.
rename_data_typeRename a data type
Parameters not published.
rename_functionRename a function by old name or address (`address` wins if both are set)
Parameters not published.
rename_variableRename a local variable or argument (function by `function_address` or `function_name`)
Parameters not published.
save_project_programPersist the currently loaded program after edits
Parameters not published.
search_bytesSearch byte patterns; `??` is a wildcard byte
Parameters not published.
search_resultRegex-search a stored large tool result; returns at most 100 snippets with up to 2,000 context characters per side, plus match offsets usable as `read_result` offsets. `max_matches=0` counts up to the 10,000-match scan cap without snippets; check `scan_truncated` before treating `match_count` as complete
Parameters not published.
search_symbolsSearch all symbols by name (globs allowed), optionally by symbol type
Parameters not published.
set_bytesWrite bytes into memory
Parameters not published.
set_commentSet a `pre` (decompiler), `eol` (listing), `post`, `plate` (function header), or `repeatable` comment
Parameters not published.
set_function_prototypeSet function prototype (function by `function_address` or `function_name`)
Parameters not published.
set_global_data_typeSet global data type (`clear_mode` optional)
Parameters not published.
set_local_variable_typeSet type for local variable/argument (function by `function_address` or `function_name`)
Parameters not published.
terminate_project_program_checkoutForce-close an existing checkout by checkout ID
Parameters not published.
undo_checkout_project_programUndo checkout (optional local change discard)
Parameters not published.
Ask AI
Ask AI about Mecha Ghidra
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
Mecha Ghidra - Headless Ghidra MCP for Ghidra Server
Mecha Ghidra is a Python package that exposes Ghidra as a headless MCP server with PyGhidra and FastMCP. It supports analysis and editing in Ghidra projects, multi-target session management, import/load switching, and tag-based shared-project sync workflows for collaborative AI-assisted reverse engineering.
Documentation
- Usage Guide | 日本語: setup, shared-project operations, multi-target workflows, and Codex/Claude/Kilocode integration
- Development Guide | 日本語: development flow and testing
Quick Start
- Sync dependencies
uv sync - Set the Ghidra path
export GHIDRA_INSTALL_DIR=/path/to/ghidra - Start the server (Streamable HTTP)
uv run ghidra-mcp \ --project-location /Users/samsepi0l/ghidra_project.gpr \ --transport http \
For operational patterns and shared-project authentication details, see the Usage Guide.
Docker Quick Start
If you want a Ghidra-bundled setup, use the included Dockerfile and docker-compose.yml.
- Create a directory for analysis targets
mkdir -p samples - Build the image (recommended)
./build_docker_image.sh - Start the MCP server
docker compose up -d - Point your MCP client to
http://127.0.0.1:8081/mcp
docker compose buildis still supported. The bundled compose file defaults toDOCKER_PLATFORM=linux/amd64, which is required for the bundled Linux decompiler.- When you switch to
linux/arm64, Docker now auto-selects the bundled mecha_ghidra patched Ghidra distribution. If you force the upstream official ZIP on ARM64, the build fails early with a clear error instead of failing later insidedecompile_function. - You can still override the bundle by setting both
GHIDRA_DIST_URLandGHIDRA_DIST_SHA256. ./samplesis shared into the container as/samplesin read-only mode. Use/samples/<filename>withimport_program.- Ghidra project data is persisted in the named volume
ghidra-projects, and the default project path is/data/projects/default.gpr. Create that project once before first use, or mount an existing Ghidra project there. - The server starts with project metadata only and no program loaded. Run
import_program(target="default", binary_path="/samples/<filename>"), then pass the returneddomain_pathtoload_project_program. - The recommended sharing model is
input bind mount (read-only) + Ghidra project named volume (read-write).import_programcopies the input into the project, so the source file does not need write access, and the.reptree tends to behave more reliably on a volume than a bind mount.
Linux ARM64 Decompiler Artifacts
The repository now ships a dedicated build path for Linux ARM64 Ghidra decompiler binaries.
./scripts/build_linux_arm64_decompiler.shbuildslinux_arm_64nativedecompileandsleigh.- The release workflow publishes two artifacts:
ghidra_*_linux_arm_64_decompiler_overlay.tar.gzghidra_*_linux_arm_64_decompiler.zip
- The overlay archive preserves the exact path
Ghidra/Features/Decompiler/os/linux_arm_64/{decompile,sleigh}so it can be unpacked directly into an existing Ghidra install. - The patched ZIP is intended for ARM Linux Docker builds and direct ARM Linux installs.
- GitHub releases also publish
mecha_ghidra_docker_arm64_*.zip/*.tar.gzassets whose names explicitly indicate they are for Apple Silicon / Linux ARM64 Docker or overlay use. - For the normal repository snapshot, use GitHub's built-in
Source code (zip)/Source code (tar.gz)links.
Example ARM64 Docker build:
DOCKER_PLATFORM=linux/arm64 docker compose build
DOCKER_PLATFORM=linux/arm64 docker compose up -d
Override example:
DOCKER_PLATFORM=linux/arm64 \
GHIDRA_DIST_URL=https://github.com/ghidra-user-jp/mecha_ghidra/releases/download/<release-tag>/ghidra_12.0.4_PUBLIC_20260303_linux_arm_64_decompiler.zip \
GHIDRA_DIST_SHA256=<release-asset-sha256> \
docker compose build
If ARM Linux starts without the patched binaries, Mecha Ghidra now returns a clear startup/decompiler error explaining that linux_arm_64 natives are missing.
Key Features
- Function and symbol operations: list functions, decompile, rename, retrieve xrefs, and more.
- Data-type editing: create/update/delete structs, enums, and class-like data types.
- Memory access: read/search/write bytes and apply global data types.
- Comments: set disassembly/decompiler comments.
- PyGhidra-based runtime: calls Ghidra APIs directly from CPython (not Jython).
- Multi-target management: hold multiple sessions in one process and switch by target name.
- Project operations: list project programs with
list_project_programs, import new binaries withimport_program, and switch loaded programs withload_project_program.
FastMCP tools are grouped under ghidra_headless.handlers.core and exposed to MCP clients through ghidra_mcp.cli. For full CLI options, run uv run ghidra-mcp --help.
Available Tools
Core Operations
list_targets- List registered targets and associated project metadatacreate_session- Add a target by opening an existing project programregister_target- Register project metadata to a target without opening a programclose_session- Close a target sessionclose_session_and_remove_program- Close a session and remove the program from the projectlist_project_programs- List programs in the target's opened projectimport_program- Import a binary or.gzfinto the projectload_project_program- Load an existing program bydomain_pathsave_project_program- Persist the currently loaded program after edits
Function Analysis
list_methods- List methods (with pagination)list_functions- List functionslist_classes- List classeslist_namespaces- List namespaces (with pagination)search_functions_by_name- Partial-match search by function namedecompile_function- Get C-like pseudocode by function namedecompile_function_by_address- Get C-like pseudocode by addressdisassemble_function- Get disassembly for a functionget_function_by_address- Get function metadata by addressget_function_xrefs- Get incoming/outgoing references from a function nameget_callee- Get callee function at a specific address
Memory and Data
list_segments- Get memory segment/layout infolist_imports- List imported symbolslist_exports- List exported symbolslist_data_items- List data itemslist_strings- List strings (filterable)get_xrefs_to- Get cross-references to an addressget_xrefs_from- Get cross-references from an addressget_data_by_label- Get data by label nameget_bytes- Read bytes at an addresssearch_bytes- Search byte patterns
Symbol and Comment Editing
rename_function- Rename a function (by old name)rename_function_by_address- Rename a function (by address)rename_variable- Rename a local variable or argumentrename_data- Rename a data labelset_function_prototype- Set function prototypeset_local_variable_type- Set type for local variable/argumentset_global_data_type- Set global data type (clear_modeoptional)set_bytes- Write bytes into memoryset_decompiler_comment- Set decompiler commentset_disassembly_comment- Set disassembly commentadd_bookmark- Add bookmark
After mutating tools such as rename_function_by_address, call save_project_program(target="default") to persist edits into the Ghidra project. If the same program is already open in the Ghidra GUI, reopen or reload it there to see the saved state.
Data Type Operations
create_struct- Create structadd_struct_members- Add struct membersclear_struct- Remove all struct membersremove_struct_members- Remove selected struct membersget_struct- Get struct definitioncreate_enum- Create enumadd_enum_values- Add enum valuesremove_enum_values- Remove enum valuesget_enum- Get enum definitioncreate_class- Create GhidraClass namespace and backing structadd_class_members- Add members to class-like data typeremove_class_members- Remove members from class-like data type
Shared Project Sync (shared_sync category)
get_project_sync_status / get_version_history / get_version_diff / checkout / add_to_version_control / commit / pull / undo_checkout / terminate_checkout / delete_shared_project_file / reload support optional domain_path where documented (if omitted, the currently loaded program is used; deletion always requires an explicit domain_path).
get_project_sync_status- Get sync state against shared projectget_version_history- Get version history (version/user/comment/time)get_version_diff- Get summarized differences between two versions (count/type/address range)checkout_project_program- Checkout program (exclusive optional)add_project_program_to_version_control- Add private program to shared version controlcommit_project_program- Check in checked-out changes (on_conflict="discard"is required to drop a conflicted checkout)pull_project_program- Pull latest state (with optional discard/follow behavior)undo_checkout_project_program- Undo checkout (optional local change discard)terminate_project_program_checkout- Force-close an existing checkout by checkout IDdelete_shared_project_file- Delete an unloaded shared-project file afterconfirmmatchesdomain_pathreload_project_program- Reload currently opened program
See the Usage Guide for detailed workflows and constraints.
Tool Exposure Controls
Every tool now carries three tags:
category:core,function_analysis,memory_data,symbol_comment_edit,datatype_ops,shared_syncsafety:read_only,write,destructive_writeoperation_level:basic,standard,advanced
Profiles:
default: existing-compatible default. Categories =core,function_analysis,memory_data,symbol_comment_edit,datatype_opsreadonly:defaultcategories +read_onlyonlyfull: every category, includingshared_sync
Rules:
- No tool flags means the same result as
--tool-profile default shared_syncis now a normalcategoryshared_syncis not included by default--enable-shared-project-synchas been removed- Repeating the same allow flag is OR
- Different allow flag types combine with AND
--allow-categoryreplaces the current category set--add-categoryadds categories on top of the current set--enable-tooladds tools after tag/profile filtering--disable-toolremoves tools last and always wins
Examples:
Existing-compatible startup:
uv run ghidra-mcp --project-location /path/to/project.gpr --domain-path /main
Readonly profile:
uv run ghidra-mcp \
--project-location /path/to/project.gpr \
--domain-path /main \
--tool-profile readonly
Full profile:
uv run ghidra-mcp \
--project-location /path/to/project.gpr \
--domain-path /main \
--tool-profile full
Default profile plus shared-project sync:
uv run ghidra-mcp \
--project-location /path/to/project.gpr \
--domain-path /main \
--tool-profile default \
--add-category shared_sync
Full profile narrowed to readonly tools only:
uv run ghidra-mcp \
--project-location /path/to/project.gpr \
--domain-path /main \
--tool-profile full \
--allow-safety read_only
Individual enable/disable overrides:
uv run ghidra-mcp \
--project-location /path/to/project.gpr \
--domain-path /main \
--tool-profile readonly \
--enable-tool rename_function \
--disable-tool set_bytes
License
See the bundled LICENSE file for project licensing.
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.