ghidra-fleet
A headless Ghidra MCP server for batch-analyzing many binaries and querying or annotating them through MCP.
Batch import and parallel analysis of files/directories with background jobs and progress polling.
List analyzed binaries and cross-search all samples for shared function names or strings.
Query per-binary functions, methods, function metadata, imports, exports, segments, and strings.
Decompile functions to C pseudocode and disassemble functions.
Inspect cross-references: references to/from addresses and function callers.
Annotate results by renaming functions, data, and variables; setting function prototypes, local variable types, and comments.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ghidra-fleet Analyze all binaries in C:\samples and find shared functions and strings"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ghidra-fleet
一个 MCP 服务器,同时分析任意多个二进制文件,零端口占用。
解决传统 GhidraMCP 的痛点:"1 个二进制 = 1 个 GUI 实例 = 1 个端口 = 1 份 MCP 配置"。 ghidra-fleet 完全无 GUI 运行(headless),AI 配置一次即可批量导入、并行分析、 跨样本交叉查询,分析结果落在标准 Ghidra 项目里,随时可以打开 GUI 人工复核。
MCP 客户端 ──stdio── ghidra-fleet (fastmcp)
├─ core/runtime.py PyGhidra 内嵌 JVM + 共享 .gpr 项目
│ + 程序句柄懒加载 / LRU 逐出(控内存)
├─ core/analyzer.py 批量分析:线程池并行、sha256 去重复用、
│ 后台作业 + 轮询(不受 MCP 30s 超时影响)
└─ core/queries.py 反编译/交叉引用/列表/重命名/跨样本搜索安装
前置:已安装 Ghidra + Python 3.10+。
实测环境:Windows 11 + Ghidra 12.1 + Python 3.14。Linux/macOS 提供了对应的 安装脚本与跨平台测试(测试样本自动按平台选取),但未在 CI 上持续验证。
:: Windows
scripts\setup_env.bat <你的 Ghidra 安装目录># Linux / macOS
GHIDRA_INSTALL_DIR=/path/to/ghidra scripts/setup_env.sh脚本会创建 .venv 并安装:fastmcp(PyPI)+ pyghidra(Ghidra 安装目录自带的
wheel,版本严格匹配)。若自带 jpype1 wheel 不覆盖你的 Python 版本,会自动
改用 PyPI 的兼容版 jpype1。
Related MCP server: Ghidra MCP Server
配置到 MCP 客户端
以 ZCode 为例,~/.zcode/cli/config.json 的 mcp.servers 里加(用户级),
路径换成你自己的:
"ghidra-fleet": {
"type": "stdio",
"command": "<repo>\\.venv\\Scripts\\python.exe",
"args": ["-m", "ghidra_fleet"],
"cwd": "<repo>",
"env": {
"GHIDRA_INSTALL_DIR": "<你的 Ghidra 安装目录>"
},
"timeoutMs": 120000
}Linux/macOS 下 command 用 <repo>/.venv/bin/python。
timeoutMs 建议保留:首次调用要启动 JVM + Ghidra(约 10~30 秒),之后都是毫秒级。
旧的单文件 GUI 版 MCP 无需删除,两者共存。
工具一览(23 个)
所有查询/改名工具的第一个参数都是 binary,接受:
完整 program_name(ab12cd34__sample.exe)/ 原始路径 / 唯一文件名 / sha256 前 8 位。
用 list_binaries 随时查看全部。
类别 | 工具 | 说明 |
舰队 |
| 批量导入+并行分析(目录也可,单批上限 1000 个文件),立即返回 job_id |
| 轮询作业进度(含每个文件的分析百分比/阶段,已完成的可立刻查询) | |
| 所有二进制 + 架构/大小/哈希/状态(missing = 幽灵记录) | |
| 删除一个二进制(项目文件 + manifest;也能清理幽灵记录) | |
| 跨全部样本搜同名函数/同字符串(找共享代码/家族特征,最多扫 200 个) | |
查询 |
| 函数列表/搜索 |
| 反编译 C(单个 / 批量最多 50 个,错误内联) | |
| 反汇编 | |
| 签名、参数、调用约定等 | |
| 交叉引用 | |
| 导入导出/内存段/字符串 | |
修改 |
| 重命名(即时保存) |
| 签名/变量类型 | |
| 注释(plate/pre/eol/post/repeatable) |
典型工作流
用户: 把 C:\samples\ 下的 20 个样本都分析了,找出它们的共同特征
AI: 1. analyze_binaries(["C:\\samples"], recursive=true) → job_id
2. analysis_status(job_id) → 轮询到完成(旧样本秒级跳过)
3. list_binaries() → 拿到全部 program_name
4. find_in_all_binaries("string", "http://") → 跨样本特征
find_in_all_binaries("function", "encrypt") → 共享函数
5. decompile_function("ab12cd34__x.exe", "FUN_00401000")
rename_function("ab12cd34__x.exe", "FUN_00401000", "c2_beacon_decode")改名/注释/类型修改即时保存进项目;用 Ghidra GUI 打开
<项目目录>/fleet.gpr(File → Open Project)即可看到 AI 的全部标注。
环境变量
变量 | 默认 | 说明 |
| (必填) | Ghidra 安装目录 |
|
| Ghidra 项目目录 |
|
| 项目名 |
|
| 并行分析线程数;遇到分析器并发问题时设 |
|
| 同时保持打开的程序数(LRU 逐出) |
|
| JVM 堆上限;设空串用 Ghidra 默认 |
|
| 日志级别 |
测试
GHIDRA_INSTALL_DIR=<Ghidra 安装目录> .venv/bin/python tests/smoke_test.py [样本1 样本2 ...]
GHIDRA_INSTALL_DIR=<Ghidra 安装目录> .venv/bin/python tests/stdio_test.py不传样本时自动挑选 PATH 上的系统小工具(Windows 用 where/robocopy 等, Linux/macOS 用 ls/true 等)。覆盖:并行分析、二次提交缓存跳过、重复内容去重、 各类查询、改名/签名/类型后逐出重开的持久性、跨样本搜索、stdio 协议层。
已知边界
同一项目目录同一时间只允许一个 server 实例(Ghidra 项目锁):开多个 MCP 会话时, 第一个实例占用项目,其余实例会收到明确的锁冲突提示。多会话请错开使用, 或给不同会话配置不同的
GHIDRA_FLEET_PROJECT_DIR。关闭占用方后即可恢复。不要把 server 的启动脚本放在名为
ghidra的目录下运行(也不要让 sys.path[0] 指向这种目录):Python 会把它当成ghidra命名空间包,与 pyghidra 的 Java 包 导入钩子冲突(递归爆栈)。用python -m ghidra_fleet从任意 cwd 启动是安全的。进程内并行分析在极少数格式上可能触发 Ghidra 分析器并发问题:把
GHIDRA_FLEET_MAX_WORKERS设为1即退化为顺序分析,接口不变。分析进度按文件粒度上报百分比;部分 Ghidra 分析阶段本身不提供总量, 此时只显示阶段名(progress_pct 为 null)。
Available Tools
23 toolsanalysis_statusAnalysis StatusA
查询分析作业进度。不传 job_id 时返回最近的所有作业。
Inputs: job_id. Returns: object
analyze_binariesAnalyze BinariesA
批量导入并分析二进制文件(后台并行执行,立即返回 job_id)。
paths: 单个路径或路径列表;目录会展开为其中的文件(recursive=true 时递归展开)。 已分析过(相同 sha256)的文件会自动跳过并标记 cached。 返回后用 analysis_status(job_id) 轮询进度;已完成的二进制可以立刻查询。
Inputs: paths (required), recursive. Returns: object
decompile_functionDecompile FunctionB
反编译函数为 C 伪代码。function 接受函数名(支持唯一子串)或入口地址。
Inputs: binary (required), function (required), max_chars. Returns: result
disassemble_functionDisassemble FunctionC
反汇编函数(汇编指令列表)。function 接受函数名或入口地址。
Inputs: binary (required), function (required), max_lines. Returns: result
find_in_all_binariesFind In All BinariesB
跨所有已分析的二进制搜索(旧的单文件 MCP 做不到的核心能力)。
kind: "string" 或 "function"。query 为子串(不区分大小写)。 典型用途:在一批样本中找共同的函数名/字符串特征。最多扫描最近分析的 200 个二进制。
Inputs: kind (required), query (required), limit_per_binary.
function_infoFunction InfoB
查看函数详情:签名、入口地址、参数、返回类型、大小、调用约定。function 接受函数名或入口地址。
Inputs: binary (required), function (required). Returns: object
get_function_xrefsGet Function XrefsC
查看函数的调用者(谁调用了这个函数)。
Inputs: binary (required), function (required).
get_xrefs_fromGet Xrefs FromC
查看指定地址向外的所有引用(它引用了谁)。
Inputs: binary (required), address (required).
get_xrefs_toGet Xrefs ToC
查看引用到指定地址的所有交叉引用(谁引用了它)。
Inputs: binary (required), address (required).
list_binariesList BinariesA
列出项目中所有已分析的二进制及其元数据(program_name、架构、大小、sha256、状态)。
Inputs: no named parameters. Returns: object
list_exportsList ExportsC
列出导出符号。
Inputs: binary (required), limit, offset.
list_functionsList FunctionsB
列出二进制中的所有函数(分页)。filter 为函数名子串过滤(不区分大小写)。
Inputs: binary (required), limit, filter, offset.
list_importsList ImportsC
列出导入符号(库!名称)。
Inputs: binary (required), limit, offset.
list_methodsList MethodsD
list_functions 的别名(兼容旧工具名习惯)。
Inputs: binary (required), limit, filter, offset.
list_segmentsList SegmentsB
列出内存段(名称、范围、读写执行权限、大小)。
Inputs: binary (required).
list_stringsList StringsC
列出程序中的字符串(分页,filter 子串过滤)。
Inputs: binary (required), limit, filter, offset.
rename_dataRename DataC
在指定地址设置/重命名数据标签。
Inputs: binary (required), address (required), new_name (required). Returns: result
rename_functionRename FunctionB
重命名函数(立即保存到项目,GUI 打开同一项目可见)。
Inputs: binary (required), new_name (required), old_name (required). Returns: result
rename_variableRename VariableC
重命名函数内的局部变量/参数。
Inputs: binary (required), function (required), new_name (required), old_name (required). Returns: result
search_functions_by_nameSearch Functions By NameC
按名称子串搜索函数(不区分大小写)。
Inputs: query (required), binary (required), limit.
set_commentSet CommentC
在指定地址设置注释。kind: plate/pre/eol/post/repeatable(默认 eol)。
Inputs: binary (required), address (required), comment (required), kind. Returns: result
set_function_prototypeSet Function PrototypeC
设置函数原型/签名,例如 'int func(char *buf, int len)'。
Inputs: binary (required), function (required), prototype (required). Returns: result
set_local_variable_typeSet Local Variable TypeC
设置函数局部变量/参数的类型,例如 'char *'、'unsigned int'、'struct MY_STRUCT *'。
Inputs: binary (required), function (required), new_type (required), variable_name (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Several tools overlap: list_methods is an explicit alias of list_functions, search_functions_by_name overlaps with filtered list_functions, and get_function_xrefs overlaps with get_xrefs_to on function entries. find_in_all_binaries is also adjacent to single-binary search tools. Descriptions help clarify intent, but an agent may still hesitate between similar query paths.
Most names follow a consistent snake_case verb_noun style such as analyze_binaries, list_functions, decompile_function, and rename_variable. Minor deviations like analysis_status and function_info are noun-first, and list_methods introduces an alternate noun for the same concept, but the overall convention is predictable.
At 23 tools, the surface is at the heavy end for a single MCP server, though the Ghidra reverse-engineering domain is broad. The explicit list_methods alias adds redundancy, and some list/search/xref tools could potentially be consolidated. It is usable but borderline heavy.
The surface covers batch analysis, status polling, binary listing, cross-binary search, function listing/search, decompilation, disassembly, xrefs, imports/exports, segments, strings, and several mutation operations. Minor gaps remain around deletion/project lifecycle and listing variables or data beyond rename operations, but core workflows are well covered.
Maintenance
Related MCP Connectors
Project management shared by people and AI agents, with persistent project state through MCP.
Durable, shareable and governed project memory with smart triage and explicit project composition.
Project memory, documentation and controlled secret access for AI coding agents.
Build, test and cache insights for Xcode, Gradle and Bazel projects, for coding agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to autonomously reverse engineer binaries using Ghidra's capabilities including decompilation, function analysis, automatic renaming, and BSim integration for function similarity matching.1AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceExposes Ghidra headless binary analysis capabilities via the Model Context Protocol, enabling AI assistants to decompile, analyze, and emulate binaries with 32 tools and multi-binary support.2MIT
- AlicenseNot gradedqualityBmaintenanceEnables importing and auto-analyzing binaries with Ghidra's headless analyzer, then listing, decompiling, disassembling, cross-referencing, searching, and annotating them — individually or across a whole project — without requiring a running GUI or bridge plugin.Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to import, disassemble, and debug binaries directly so they can perform cross-reference reasoning, rename stripped functions, and recover structure layouts during native reverse-engineering workflows. It integrates with offline ELF reconnaissance output to support symbol and struct recovery without opening the Ghidra GUI.-