Token导航 LogoToken导航TokenDH.com
Ghidra Workflow MCP logo
开发工具stdio官方级别未说明来源级核验

Ghidra Workflow MCP

MCP Server

一个帮助LLMs编写正确Ghidra脚本的工具,通过从Ghidra源代码中提取API调用流程并提供给MCP查询。

工具数

6

提示词数

0

GitHub Stars

0

资源数

0
代码生成PythonClaude逆向工程Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Taardisaa

提供方

Taardisaa

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python3 -m venv .venv

详细介绍

ghidra api mcp

一个MCP工具,通过提供从Ghidra自己的源代码中提取的API调用流,帮助LLM编写正确的Ghidra脚本。

问题陈述

LLM经常使Ghidra API调用序列出错。分解函数不是一个单独的API调用;它需要构建一个 DecompInterface,呼叫 openProgram(),获得a Function,调用 decompileFunction(),检查 decompileCompleted(),并致电 dispose()。错过任何一步,脚本都会悄无声息地失败。

该工具自动从Ghidra自己的源代码中提取这些工作流模式,并通过以下方式对其进行索引 chromadb,并通过MCP为它们提供服务,因此任何代理都可以查询它们。

MCP工具

工具目的输入
initialize_index构建RAG数据库(首次使用前运行一次)本地Ghidra源的可选路径
get_index_info显示Ghidra版本、构建时间戳和记录计数--
clear_index删除索引(在彻底重建之前使用)--
get_workflows查找任务的API调用序列自然语言任务描述
get_api_doc查找类或方法(模糊匹配)类/方法名称或关键字
list_related_apis查找共存API类名

示例

initialize_index()                                    # first-time setup; clones Ghidra automatically
initialize_index("/path/to/ghidra")                   # or point at a local Ghidra source tree

get_workflows("decompile a function to C code")

退货:

Workflow: decompileFunction
Source: Ghidra/Features/Decompiler/src/test/...

1. new DecompInterface()
2. ifc.openProgram(...)       [uses ifc from step 1]
3. program.getListing().getFunctionAt(...)
4. ifc.decompileFunction(...) [uses func from step 3]
5. res.decompileCompleted()
6. res.getDecompiledFunction().getC()
7. ifc.dispose()

设置

快速入门(从PyPI开始)

1.将服务器添加到克劳德代码:

claude mcp add ghidra-api-mcp -- uvx ghidra-api-mcp

或者对于Claude Desktop,添加到您的配置文件中(~/.config/Claude/claude_desktop_config.json 在Linux上, ~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上, %APPDATA%\Claude\claude_desktop_config.json 在Windows上):

{
  "mcpServers": {
    "ghidra-api-mcp": {
      "command": "uvx",
      "args": ["ghidra-api-mcp"]
    }
  }
}

2.首次使用时建立索引:

呼叫 initialize_index 它将自动克隆Ghidra并构建RAG数据库(需要10-30分钟)。后续会话重用构建的索引。

来源

git clone https://github.com/Taardisaa/ghidra-api-mcp.git
cd ghidra-api-mcp
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"

添加到克劳德代码:

claude mcp add ghidra-api-mcp -- uv run --directory /path/to/ghidra-api-mcp ghidra-api-mcp

或者先离线构建索引(CLI):

# Auto-clone Ghidra
ghidra-api-mcp-admin build-index

# Or point at a local Ghidra source tree
ghidra-api-mcp-admin build-index --ghidra-path /path/to/ghidra

无MCP检查/测试:

ghidra-api-mcp-admin inspect info                               # get_index_info
ghidra-api-mcp-admin inspect workflows "decompile a function"   # get_workflows
ghidra-api-mcp-admin inspect api-doc DecompInterface            # get_api_doc
ghidra-api-mcp-admin inspect related DecompInterface            # list_related_apis

清除索引:

ghidra-api-mcp-admin clear-index

运作原理

[1. Collect]  Enumerate Java files from Ghidra source (tests, examples, main code)
      ↓
[2. Parse]    tree-sitter Java → AST
      ↓
[3. Extract]  Identify ghidra.* API calls per function
              Track variable assignments to build data-flow edges
              Build call-chain graphs: call_A --output_feeds--> call_B
      ↓
[4. Index]    Store call chains + source snippets in ChromaDB
              Embed with semantic vectors for natural-language search
      ↓
[5. Serve]    MCP server retrieves relevant workflows at query time

数据源按信任度排序:Ghidra自己的测试和示例首先出现,主源代码其次。

发展

# Run tests
.venv/bin/pytest -v

# Lint
.venv/bin/ruff check src/ tests/

备注

索引chromadb时的警告:索引过程中可能会出现以下错误:

[W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: "/sys/class/drm/card0/device/vendor"

这是意料之中的。如果GPU不可用,它将回退到CPU嵌入。

许可证

麻省理工学院

目录标签

目录标签

代码生成PythonClaude逆向工程API流程本地部署LLM辅助

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP