
# MCP-Ghidra5








## ๐ฏ **Advanced GPT-5 Powered Ghidra Reverse Engineering MCP Server**
**MCP-Ghidra5** is a cutting-edge **Model Context Protocol (MCP) server** that seamlessly integrates **Ghidra's powerful reverse engineering capabilities** with **advanced multi-model AI technology**. Supporting **7 major AI providers** including OpenAI GPT-5, Anthropic Claude, Google Gemini, xAI Grok, and local LLMs via Ollama, this professional-grade tool transforms binary analysis from a manual, time-intensive process into an **automated, intelligent workflow** with **cost optimization** and **automatic fallback systems**.
---
## ๐ **Key Features**
### **๐ค Multi-Model AI Suite**
- **๐ง 7 AI Provider Support** - OpenAI GPT-5, Claude 3.5, Gemini, Grok, DeepSeek, Perplexity, Ollama
- **๐ Intelligent Fallback** - Automatic provider switching for 99.9% uptime reliability
- **๐ฐ Cost Optimization** - Smart model selection saving 30-50% on AI costs
- **๐ Usage Analytics** - Comprehensive tracking of API calls, costs, and performance
- **๐ Local LLM Support** - Ollama integration for 100% private offline analysis
- **โก Model Testing** - Built-in tools to test and validate AI provider configurations
- **๐ฏ Provider Management** - Dynamic switching between models mid-session
### **๐ฌ Advanced Analysis Tools**
- **๐ Binary Analysis** - Comprehensive executable analysis with multi-AI interpretation
- **๐ Function Decompilation** - Intelligent function analysis with contextual explanations
- **๐ก๏ธ Malware Detection** - AI-powered behavioral and structural malware analysis
- **โก Exploit Development** - Automated PoC generation with vulnerability insights
- **๐ง Firmware Analysis** - IoT and embedded systems reverse engineering
- **๐ฏ Pattern Recognition** - Vulnerability detection across multiple architectures
### **๐๏ธ Professional Integration**
- **๐ MCP Client Integration** - Seamless MCP server deployment
- **๐ Multi-Architecture Support** - x86, x64, ARM, MIPS, RISC-V compatibility
- **โ๏ธ Automated Installation** - One-command setup with dependency management
- **๐ API Key Management** - Secure OpenAI API key configuration
- **๐ Project Management** - Organized analysis workspace with logging
---
## ๐ฆ **Installation**
### **Prerequisites**
- **Python 3.8+** with pip/pipx
- **Linux Environment** (Kali Linux, Ubuntu, RHEL, etc.)
- **OpenAI API Key** for GPT-5/GPT-4o access
- **Ghidra** (REQUIRED - core functionality depends on this)
### **Quick Install**
```bash
# 1. Install Ghidra (REQUIRED)
# Download from: https://github.com/NationalSecurityAgency/ghidra/releases
# Extract to /opt/ghidra/ (recommended)
sudo mkdir -p /opt/ghidra
sudo tar -xzf ghidra_*.zip -C /opt/ && sudo mv /opt/ghidra_* /opt/ghidra
# 2. Download MCP-Ghidra5
wget https://github.com/TheStingR/MCP-Ghidra5/archive/main.zip
unzip main.zip && cd MCP-Ghidra5-main
# 3. Navigate to the MCP-Ghidra5 directory and run installer
cd MCP-Ghidra5
./install_mcp_ghidra5.sh
# Follow prompts: Accept terms โ Enter API key โ Done!
# 4. Test installation
./test_ghidra_gpt5.py
# 5. Add to MCP Client (use generated config)
# Configure your MCP-compatible client with the generated settings
```
### **Manual Setup**
```bash
# 1. INSTALL GHIDRA FIRST (MANDATORY)
# Download: https://github.com/NationalSecurityAgency/ghidra/releases
# Extract to /opt/ghidra/
# 2. Install Python dependencies
pip3 install --user mcp aiohttp
# 3. Configure environment
export OPENAI_API_KEY="your-api-key-here"
export GHIDRA_HEADLESS_PATH="/opt/ghidra/support/analyzeHeadless"
# 4. Verify Ghidra installation
$GHIDRA_HEADLESS_PATH -help || echo "ERROR: Ghidra not found!"
# 5. Navigate to MCP-Ghidra5 directory and run server
cd MCP-Ghidra5
python3 ghidra_gpt5_mcp.py
```
---
## ๐ ๏ธ **Usage Examples**
### **Binary Analysis**
```python
call_mcp_tool("ghidra_binary_analysis", {
"binary_path": "/path/to/executable",
"analysis_depth": "deep"
})
```
### **Function Analysis**
```python
call_mcp_tool("ghidra_function_analysis", {
"binary_path": "/path/to/binary",
"function_name": "main",
"include_decompilation": true
})
```
### **Exploit Development**
```python
call_mcp_tool("ghidra_exploit_development", {
"binary_path": "/path/to/vulnerable_app",
"vulnerability_type": "buffer_overflow"
})
```
### **Multi-Model AI Queries**
```python
call_mcp_tool("gpt5_reverse_engineering_query", {
"query": "How to bypass ASLR in modern Linux systems?",
"preferred_model": "claude-3-5-sonnet"
})
```
### **AI Model Management**
```python
# Check available AI providers
call_mcp_tool("ai_model_status", {"action": "status"})
# Test specific model
call_mcp_tool("ai_model_status", {
"action": "test_model",
"model_name": "grok-beta"
})
```
### **Tier 1 Binary Analysis Tools** ๐ **v1.2.0**
```python
# Strings extraction with AI analysis
call_mcp_tool("binary_strings_analysis", {
"binary_path": "/path/to/binary",
"min_length": 6,
"encoding": "all",
"output_format": "json",
"ai_analysis": True
})
# File information and metadata
call_mcp_tool("binary_file_info", {
"binary_path": "/path/to/binary",
"detailed": True
})
# Objdump disassembly analysis
call_mcp_tool("binary_objdump_analysis", {
"binary_path": "/path/to/binary",
"analysis_type": "all",
"ai_analysis": True
})
# ELF binary analysis with readelf
call_mcp_tool("binary_readelf_analysis", {
"binary_path": "/path/to/elf_binary",
"analysis_type": "all"
})
# Hex dump with pattern recognition
call_mcp_tool("binary_hexdump_analysis", {
"binary_path": "/path/to/binary",
"offset": 0,
"length": 1024,
"format": "canonical"
})
```
### **Phase 2 Binary Diffing Tools** ๐ **v1.3.0**
```python
# Comprehensive binary file comparison
call_mcp_tool("binary_diff_file", {
"file1_path": "/path/to/original.bin",
"file2_path": "/path/to/modified.bin",
"ai_analysis": True
})
# String-based binary comparison
call_mcp_tool("binary_diff_strings", {
"file1_path": "/path/to/binary1",
"file2_path": "/path/to/binary2",
"min_length": 4
})
# Function-level comparison
call_mcp_tool("binary_diff_functions", {
"file1_path": "/path/to/v1.exe",
"file2_path": "/path/to/v2.exe"
})
# Metadata comparison
call_mcp_tool("binary_diff_metadata", {
"file1_path": "/path/to/elf1",
"file2_path": "/path/to/elf2"
})
```
---
## ๐ฏ **17 Advanced Analysis Tools** ๐
### **๐๏ธ Core Ghidra Integration**
| Tool | Description | Use Case |
|------|-------------|----------|
| **๐ฌ Binary Analysis** | Comprehensive Ghidra + Multi-AI analysis | Full executable examination |
| **๐ฏ Function Analysis** | Specific function decompilation | Targeted code analysis |
| **๐ฅ Exploit Development** | PoC generation with AI selection | Vulnerability research |
| **๐ฆ Malware Analysis** | Behavioral and structural analysis | Threat intelligence |
| **๐ก Firmware Analysis** | IoT and embedded systems | Hardware security |
| **๐ Pattern Search** | Vulnerability detection | Code auditing |
### **โก Tier 1 Binary Tools** ๐ **v1.2.0**
| Tool | Description | Features |
|------|-------------|----------|
| **๐ Strings Analysis** | Multi-encoding string extraction | AI pattern recognition, crypto detection |
| **๐ File Information** | Comprehensive file metadata | Type detection, security assessment |
| **๐ง Objdump Analysis** | Disassembly and symbol analysis | Cross-architecture, AI interpretation |
| **โ๏ธ Readelf Analysis** | ELF binary structure analysis | Security features, dependency analysis |
| **๐ Hexdump Analysis** | Raw binary inspection | Pattern recognition, magic signatures |
### **๐ Phase 2 Binary Diffing Tools** ๐ **v1.3.0**
| Tool | Description | Features |
|------|-------------|----------|
| **๐ Binary File Diff** | Comprehensive binary comparison | AI-powered security analysis, metadata comparison |
| **๐ Strings Diff** | String-based binary comparison | Multi-encoding support, pattern analysis |
| **๐ง Functions Diff** | Function-level comparison analysis | Decompilation diff with AI insights |
| **๐ Metadata Diff** | Binary metadata comparison | ELF headers, sections, symbols analysis |
### **๐ค AI & Management**
| Tool | Description | Use Case |
|------|-------------|----------|
| **๐ค Multi-Model Queries** | Expert assistance with 7 AI providers | Knowledge base |
| **๐ง AI Model Status** | Provider management and testing | System monitoring |
---
## ๐ **Binary Diffing Capabilities** ๐ **v1.3.0**
**Phase 2** introduces advanced binary comparison and diffing tools with AI-powered security analysis:
### **๐ฏ Core Diffing Features**
- **๐ File-Level Comparison** - Complete binary diff with security impact analysis
- **๐ String Diffing** - Multi-encoding string comparison with pattern detection
- **๐ง Function Analysis** - Decompilation-based function comparison
- **๐ Metadata Diffing** - ELF headers, sections, and symbol analysis
### **๐ค AI-Enhanced Analysis**
- **๐ก๏ธ Security Impact Assessment** - Automated vulnerability risk analysis
- **๐ Pattern Recognition** - Intelligent change detection and categorization
- **โก Async Processing** - High-performance concurrent analysis
- **๐พ Smart Caching** - Intelligent caching with automatic cleanup
### **๐๏ธ Technical Specifications**
- **โก Performance**: 5-30 seconds for typical binary pairs
- **๐ฐ Cost Efficient**: $0.02-0.10 per comparison with AI analysis
- **๐ Secure Processing**: Local analysis with optional AI enhancement
- **๐ Structured Output**: JSON format for programmatic consumption
---
## ๐ **Performance Specifications**
- **โก Quick Analysis**: 30-60 seconds
- **๐ Deep Analysis**: 120-240 seconds
- **๐ฐ Cost Efficient**: $0.05-0.80 per analysis
- **๐ฏ Multi-Platform**: Linux distributions supported
- **๐ Secure**: No data retention, API key protection
---
## ๐ **Documentation**
- **๐ [Deployment Guide](GHIDRA_GPT5_DEPLOYMENT_GUIDE.md)** - Complete setup instructions
- **๐ง [Project Summary](GHIDRA_GPT5_PROJECT_SUMMARY.md)** - Technical specifications
- **โ
[Installation Verification](verify_setup.sh)** - Test your setup
- **๐ข [Copyright Information](COPYRIGHT.txt)** - Legal terms and licensing
---
## ๐ฏ **Target Audience**
- **๐ Cybersecurity Professionals** - Advanced threat analysis
- **๐ฎ CTF Competitors** - Rapid binary reverse engineering
- **๐ก๏ธ Penetration Testers** - Exploit development and analysis
- **๐ฆ Malware Analysts** - Threat intelligence and research
- **๐ญ Security Researchers** - Vulnerability discovery
- **๐ Educators & Students** - Learning reverse engineering
---
## ๐ง **System Requirements**
| Component | Requirement |
|-----------|-------------|
| **OS** | Linux (Kali, Ubuntu, RHEL, CentOS, etc.) |
| **Python** | 3.8+ with pip |
| **Memory** | 4GB+ RAM recommended |
| **Storage** | 2GB+ free space |
| **Network** | Internet access for API calls |
|| **Ghidra** | REQUIRED - Download from NSA GitHub |
---
## ๐ก๏ธ **Security & Legal**
### **โ๏ธ Legal Notice**
- **๐ข Property**: TechSquad Inc. proprietary software
- **โ Not For Resale**: Commercial distribution prohibited
- **โ
Legal Use Only**: Authorized for legitimate security research
- **๐ Disclaimer**: Neither TechSquad Inc. nor TheStingR is responsible for improper use
### **๐ Security Features**
- **๐ API Key Protection** - Secure credential management
- **๐๏ธ No Data Retention** - Analysis results not stored remotely
- **๐ Local Processing** - Ghidra analysis performed locally
- **๐ Audit Logging** - Complete operation logging
---
## ๐ **Acknowledgments**
### **Issue Reporting & Testing**
- **[PurpleTeam-TechSquad](https://github.com/PurpleTeam-TechSquad)** - Critical bug discovery and comprehensive testing
- Identified Python version detection failure on Python 3.13+ systems
- Discovered Ghidra path hardcoding issues on Debian/Ubuntu/Kali systems
- Reported API key validation limitations for project-based keys
- Provided detailed testing environment and reproduction steps
- Testing Environment: Kali GNU/Linux Rolling 2025.3
- Test Duration: 45 minutes comprehensive installation and functionality testing
### **Special Thanks**
We sincerely thank PurpleTeam-TechSquad for their thorough external testing that identified critical compatibility issues, enabling us to make MCP-Ghidra5 truly production-ready across multiple Linux distributions.
---
## ๐ค **Contributing**
This is **TechSquad Inc. proprietary software**. For feature requests, bug reports, or collaboration inquiries:
1. **๐ง Contact**: Via GitHub issues
2. **๐ Bug Reports**: Include system details and logs
3. **๐ก Feature Requests**: Describe use case and requirements
4. **๐ Pull Requests**: Contact maintainers first
---
## ๐ท๏ธ **Version History**
### **v1.3.0** (September 2025) - **PHASE 2 BINARY DIFFING** ๐
- ๐ **4 New Binary Diffing Tools** - file, strings, functions, metadata comparison
- ๐ค **AI-Powered Security Analysis** - Intelligent vulnerability impact assessment
- โก **Async Engine Architecture** - High-performance concurrent processing
- ๐พ **Smart Caching System** - Optimized performance with automatic cleanup
- ๐ก๏ธ **Enhanced Security** - Advanced validation for binary comparison operations
- ๐ **Structured JSON Output** - Programmatic access to comparison results
- ๐งช **Comprehensive Testing** - Full test suite with 100% pass rate
- ๐ง **Repository Optimization** - Clean structure with docs/ and tests/ organization
### **v1.2.0** (September 2025) - **TIER 1 TOOLS UPDATE** ๐
- โก **5 New Tier 1 Binary Tools** - strings, file, objdump, readelf, hexdump analysis
- ๐ **JSON Output Support** - Structured data output for programmatic consumption
- ๐ **Intelligent Caching** - 1-hour TTL cache system with automatic cleanup
- ๐ **Enhanced Security** - Advanced input validation for all new tools
- ๐ค **AI-Powered Analysis** - Each tool includes optional AI security assessment
- ๐ **Pattern Recognition** - Automated detection of crypto, URLs, suspicious content
- ๐ฏ **Cross-Platform Tested** - Validated on Ubuntu 22.04/24.04, Kali Linux, Debian 12
- ๐ฆ **Docker Ready** - Complete containerized testing infrastructure
### **v1.1.0** (January 2025) - **MAJOR UPDATE** ๐
- ๐ค **Multi-Model AI Integration** - 7 AI providers with intelligent fallback
- ๐ฐ **Cost Optimization** - Smart model selection saving 30-50% on costs
- ๐ **Local LLM Support** - Ollama integration for private offline analysis
- ๐ **Usage Analytics** - Comprehensive tracking and monitoring
- ๐ง **AI Model Management** - Built-in testing and configuration tools
- โก **Performance Improvements** - Full async processing and caching
- ๐ก๏ธ **Enhanced Security** - Advanced input validation and path controls
- ๐ **99.9% Uptime** - Automatic fallback ensures continuous availability
### **v1.0.1** (September 2024)
- ๐ง **Critical Bug Fixes** (Thanks to PurpleTeam-TechSquad!)
- โ
Fixed Python version detection for Python 3.13+ systems
- โ
Added Ghidra path auto-detection for Debian/Ubuntu/Kali
- โ
Enhanced API key validation for project-based keys
- โ
Improved Python package management for externally-managed environments
- โ
Added comprehensive AI provider compatibility testing
- โ
Enhanced cross-platform Linux distribution support
### **v1.0.0** (September 2024)
- โ
Initial public release
- โ
7 advanced analysis tools
- โ
GPT-5 integration
- โ
Comprehensive installer
- โ
Terminal Terminal support
- โ
Multi-architecture compatibility
---
## ๐ **Support**
- **๐ Documentation**: See included guides and README files
- **๐ Issues**: GitHub Issues tab
- **๐ฌ Community**: Cybersecurity forums and Discord
- **โก Emergency**: Critical security research support available
---
## โญ **Star This Repository**
If **MCP-Ghidra5** helps your security research, please **โญ star this repository** to support continued development!
---
**๐ข Copyright ยฉ 2024 TechSquad Inc. - All Rights Reserved**
**๐จโ๐ป Coded by: [TheStingR](https://github.com/TheStingR)**
**๐ Proprietary Software - NOT FOR RESALE**
*Licensed for legal cybersecurity research and education*
---
[](https://github.com/TheStingR/MCP-Ghidra5/stargazers)
[](https://github.com/TheStingR/MCP-Ghidra5/network)
[](https://github.com/TheStingR/MCP-Ghidra5/issues)