百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pyghidra-mcp

> 编程语言
开源

Python 命令行 Ghidra MCP

392 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Python 命令行 Ghidra MCP

PyGhidra-MCP - Ghidra Model Context Protocol Server

Overview

pyghidra-mcp is a command-line Model Context Protocol (MCP) server that brings the full analytical power of Ghidra, a robust software reverse engineering (SRE) suite, into the world of intelligent agents and LLM-based tooling. It bridges Ghidra’s ProgramAPI and FlatProgramAPI to Python using pyghidra and jpype, then exposes that functionality via the Model Context Protocol.

MCP is a unified interface that allows language models, development tools (like VS Code), and autonomous agents to access structured context, invoke tooling, and collaborate intelligently. Think of MCP as the bridge between powerful analysis tools and the LLM ecosystem.

With pyghidra-mcp, Ghidra becomes an intelligent backend—ready to respond to context-rich queries, automate deep reverse engineering tasks, and integrate into AI-assisted workflows.

pyghidra-mcp now supports two operating modes:

  • headless mode for CLI-driven analysis and automation
  • --gui mode, which launches Ghidra through pyghidra-mcp and shares live program state with the running GUI

[!NOTE] This beta project is under active development. We would love your feedback, bug reports, feature requests, and code.

Yet another Ghidra MCP?

Yes, the original ghidra-mcp is fantastic. But pyghidra-mcp takes a different approach:

  • Headless-first, GUI-capable – Run entirely via CLI for streamlined automation, or launch Ghidra with --gui when you want live GUI navigation and edits.
  • Designed for automation – Ideal for integrating with LLMs, CI pipelines, and tooling that needs repeatable behavior.
  • ✅ CI/CD friendly – Built with robust unit and integration tests for both client and server sessions.
  • Quick startup – Asynchronous startup allows the server to start handling requests while binaries are still being analyzed in the background. Supports fast command-line launching with minimal setup.
  • Project-wide analysis – Enables concurrent reverse engineering of all binaries in a Ghidra project
  • Agent-ready – Built for intelligent agent-driven workflows and large-scale reverse engineering automation.
  • Semantic code search – Uses vector embeddings (via ChromaDB) to enable fast, fuzzy lookup across decompiled functions, comments, and symbols—perfect for pseudo-C exploration and agent-driven triage.

This project provides a Python-first experience optimized for local development, headless environments, and testable workflows.

Setup Diagrams

How the Pieces Connect

…

Choosing a Mode

mermaid
flowchart TD
    Start["What do you need?"]
    Start --> Headless["Agent or automation"]
    Start --> GuiNeed["Live Ghidra GUI control"]
    Start --> Terminal["Interactive terminal client"]

    Headless --> Http["pyghidra-mcp
--transport streamable-http"]
    GuiNeed --> GuiMode["pyghidra-mcp --gui
--transport streamable-http
--project-path project.gpr"]
    Terminal --> HttpServer["Start pyghidra-mcp
--transport streamable-http"]
    HttpServer --> CliMode["Run pyghidra-mcp-cli commands"]
  • Headless MCP: use streamable-http. It keeps Ghidra and its project alive as one long-running server and works with both MCP hosts and the CLI client.
  • GUI mode: pyghidra-mcp launches Ghidra, opens the project, and exposes extra tools that steer the CodeBrowser in the same JVM.
  • CLI client: pyghidra-mcp-cli is an HTTP client. Start a streamable-http server first, then issue terminal commands against that running server.
  • stdio: retain this only for MCP hosts that cannot connect to an HTTP endpoint.

Detailed architecture and tool surface

…

Contents

  • PyGhidra-MCP - Ghidra Model Context Protocol Server
    • Overview
    • Yet another Ghidra MCP?
    • Setup Diagrams
      • How the Pieces Connect
      • Choosing a Mode
    • Contents
    • Getting started
    • Optimized for Agents
    • CLI Client
      • Installation
      • Quick Start with CLI
    • Project Creation, Management, and Opening Existing Projects
      • Creating New Projects
        • Self-Contained Project Structure
        • Basic Project Creation
        • Custom Project Creation
        • Creating Multiple Related Projects
      • Opening Existing Ghidra Projects
        • Opening by .gpr File
      • GUI Mode
      • Startup Defaults and Large Projects
    • Development
      • Setup
      • Testing and Quality
    • API
      • Tools
        • Batch Operations
        • Read / Analysis Tools
        • Project Operations
        • Edit / Mutation Tools
        • GUI Control Tools (--gui only)
    • Usage
      • Mapping Binaries with Docker
      • Streamable HTTP
        • Python
        • Docker
      • Claude Code
      • Codex
      • Standard Input/Output (stdio)
        • Python
        • Docker
      • Using with OpenWeb-UI and MCPO
        • With uvx
        • With Docker
      • Server-sent events (SSE)
        • Python
        • Docker
    • Inspiration
    • Contributing, community, and running from source
      • Contributor workflow

Getting started

Start a persistent Streamable HTTP server using the Python package and uv:

bash
uvx pyghidra-mcp \
  --transport streamable-http \
  --project-path /absolute/path/to/ghidra-projects \
  /absolute/path/to/binary

The server is then available at http://127.0.0.1:8000/mcp. Leave it running and configure your MCP client to use that URL; the Claude Code and Codex examples below show the expected configuration.

To launch and control a live Ghidra GUI from MCP, use --gui with streamable-http:

bash
uvx pyghidra-mcp \
  --gui \
  --transport streamable-http \
  --host 127.0.0.1 \
  --port 8000 \
  --project-path /absolute/path/to/ghidra-projects \
  --project-name my_project

[!IMPORTANT] --gui launches Ghidra through pyghidra-mcp. It does not attach to an already-running external Ghidra instance.

Or, run as a Docker container:

bash
docker run --rm -p 8000:8000 ghcr.io/clearbluejar/pyghidra-mcp

Optimized for Agents

pyghidra-mcp keeps the MCP surface intentionally narrow so agent clients spend fewer tokens on tool discovery and argument selection.

  • Short tool descriptions: MCP tool docstrings are kept compact so FastMCP tool schemas stay small and cheap to send to models.
  • Context discipline: tools return focused structured data instead of dumping whole-program context by default. Decompilation, symbol search, and cross-reference results are shaped to support iterative analysis rather than one large response.
  • GUI tools only when relevant: GUI-only controls such as open_program_in_gui, list_open_programs, set_current_program, and goto are only exposed when the server is started with --gui.
  • CLI is optional: if MCP is not your preferred interface, pyghidra-mcp-cli provides a direct command-line client over HTTP with grouped commands for common edit and analysis workflows.

This keeps the default server usable for LLM agents, IDE integrations, and automation without exposing unnecessary tool surface or GUI-only controls in headless sessions.

CLI Client

For a more interactive command-line experience, you can use the separate pyghidra-mcp-cli package, which provides a user-friendly interface for interacting with a running pyghidra-mcp server.

Installation

Install the CLI client using uv (recommended):

bash
uvx pyghidra-mcp-cli

Or install with pip:

bash
pip install pyghidra-mcp-cli

Quick Start with CLI

  1. Start the server (in one terminal):
bash
pyghidra-mcp --transport streamable-http /bin/ls
  1. Use the CLI (in another terminal):
bash
# List available binaries
pyghidra-mcp-cli list binaries

# Decompile a function
pyghidra-mcp-cli decompile --binary ls main

# Decompile with callees, referenced strings, and cross-references
pyghidra-mcp-cli decompile --binary ls main --callees --strings --xrefs

# Search for symbols (supports regex patterns)
pyghidra-mcp-cli search symbols --binary ls printf -l 10

[!NOTE] The CLI connects to pyghidra-mcp via HTTP to avoid the 10-60 second startup overhead of spawning a new Ghidra process for each command. See the CLI README for complete documentation.

Project Creation, Management, and Opening Existing Projects

Creating New Projects

You can create new projects in several ways, depending on your workflow:

Self-Contained Project Structure

pyghidra-mcp creates a self-contained project structure where each project has its own Ghidra project and pyghidra-mcp artifacts. This ensures complete isolation and easy project management.

Basic Project Creation

bash
# Create a new project with default settings
pyghidra-mcp

# Creates: 
$ tree pyghidra_mcp_projects/
pyghidra_mcp_projects/
├── my_project.gpr
├── my_project-pyghidra-mcp
│   ├── chromadb
│   └── gzfs
└── my_project.rep

Custom Project Creation

bash
# Create project with custom name and location
pyghidra-mcp --project-path ~/analysis/malware_study --project-name malware_analysis

$ tree ~/analysis/ 
/home/vscode/analysis/
└── malware_study
    ├── malware_analysis.gpr
    ├── malware_analysis-pyghidra-mcp
    │   ├── chromadb
    │   └── gzfs
    └── malware_analysis.rep

Creating Multiple Related Projects

bash
# Create separate projects for different analysis focuses
mkdir ~/reverse_engineering_workspace

# Project for suspicious binaries
pyghidra-mcp --project-path ~/reverse_engineering_workspace/suspicious_binaries --project-name suspicious_analysis

# Project for packed malware  
pyghidra-mcp --project-path ~/reverse_engineering_workspace/packed_malware --project-name packed_analysis

Opening Existing Ghidra Projects

If you have existing Ghidra projects (.gpr files), you can open them directly with pyghidra-mcp:

Opening by .gpr File

bash
# Open existing Ghidra project (project name derived from filename)
pyghidra-mcp --project-path ~/existing/ghidra/my_research.gpr

# Result: ~/existing/ghidra/my_research-pyghidra-mcp/
# └── chromadb/, gzfs/ (pyghidra-mcp additions)

GUI Mode

Use GUI mode when you want MCP actions to operate against the same live program objects that Ghidra is displaying.

  • --gui requires --transport streamable-http (or --transport http as an alias)
  • --project-path can be a project directory plus `--

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言