HackBridge

HackBridge

An MCP server that connects AI clients to a Linux terminal for real-time automated penetration testing and CTF challenge solving. It enables AI models to execute terminal commands and interact with offensive security tools like Nmap, SQLMap, and Gobuster.

Category
访问服务器

README

🌉 HackBridge

HackBridge is a lightweight MCP (Model Context Protocol) bridge that connects AI clients (e.g., Claude Desktop, 5ire) to a Linux terminal API server — enabling AI-assisted penetration testing, CTF challenge solving, and automated recon/exploitation in real time.

Run terminal commands like nmap, nxc, sqlmap, or any other tool. Interact with web applications using curl, wget, gobuster. Let the AI drive your offensive security workflow — from enumeration to exploitation.


📝 My Medium Article on This Tool

How MCP is Revolutionizing Offensive Security

👉 How MCP is Revolutionizing Offensive Security


🔍 Use Case

HackBridge enables AI-driven offensive security by:

  • Connecting MCP-compatible AI clients (OpenAI, Claude, DeepSeek, Gemini, etc.) to a Linux terminal.
  • Exposing a controlled API to execute commands on your Linux machine.
  • Letting AI suggest, run, and analyze terminal commands to solve CTF challenges or automate recon/exploitation tasks.
  • Allowing MCP apps to send structured requests (e.g., nmap, ffuf, curl) and receive parsed outputs.

Here are some examples from my testing (using Google's AI Gemini 2.0 Flash):

Example: Solving a Web CTF Challenge in RamadanCTF

https://github.com/user-attachments/assets/dc93b71d-9a4a-4ad5-8079-2c26c04e5397

Example: Attempting to Solve Machine "Code" from HTB

https://github.com/user-attachments/assets/3ec06ff8-0bdf-4ad5-be71-2ec490b7ee27


🚀 Features

  • 🧠 AI Integration via MCP — Connect your Linux machine to any MCP-compatible client like Claude Desktop or 5ire.
  • 🖥️ Command Execution API — Controlled API to execute terminal commands on your Linux machine.
  • 🛠️ Built-in Tool Support — Pre-configured endpoints for Nmap, Gobuster, Dirb, SQLMap, Hydra, and WPScan.
  • 🕸️ Web Challenge Support — AI can interact with websites and APIs, capture flags via curl and any other tool.
  • ⏱️ Configurable Timeouts — Per-tool timeout support to handle long-running scans without interruption.
  • 🔐 Built for Offensive Security — Ideal for red teamers, bug bounty hunters, and CTF players automating common tasks.
  • 🔄 Arbitrary Command Execution — Execute any terminal command beyond the built-in tools for maximum flexibility.

📁 Project Structure

MCP-Kali-Server/
├── kali_server.py          # Flask API server (runs on Linux/Kali)
├── mcp_server.py           # MCP client bridge (connects AI to API server)
├── mcp-kali-server.json    # Example MCP client configuration
├── requirements.txt        # Python dependencies
└── README.md               # This file

🛠️ Installation & Setup

Prerequisites

  • Python 3.8+
  • pip (Python package manager)
  • The following Python packages (installed via requirements.txt):
    • Flask>=3.0.0
    • requests>=2.31.0
    • mcp>=1.0.0

1. On Your Linux Machine (API Server)

Install HackBridge via apt:

sudo apt install hackbridge

Or install manually:

git clone <your-repo-url>
cd MCP-Kali-Server
pip install -r requirements.txt
python3 kali_server.py

Command Line Options:

  • --ip <address> — IP to bind the server to (default: 127.0.0.1 for localhost only)
    • 127.0.0.1 — Local connections only (secure, recommended)
    • 0.0.0.0 — Allow connections from any interface (⚠️ very dangerous; use with caution)
    • Specific IP — Bind to a particular network interface
  • --port <port> — Port number (default: 5000)
  • --debug — Enable debug mode for verbose logging

Examples:

# Run on localhost only (secure, default)
python3 kali_server.py

# Run on all interfaces (less secure, useful for remote access)
python3 kali_server.py --ip 0.0.0.0

# Run on a specific IP and custom port
python3 kali_server.py --ip 192.168.1.100 --port 8080

# Run with debug mode
python3 kali_server.py --debug

2. On Your MCP Client Machine (Can Be Local or Remote)

git clone <your-repo-url>
cd MCP-Kali-Server
pip install -r requirements.txt

MCP Client Command Line Options:

  • --server <url> — Kali API server URL (default: http://localhost:5000)
  • --timeout <seconds> — Request timeout in seconds (default: 600)
  • --debug — Enable debug logging

If running the client and server on the same machine:

python3 mcp_server.py --server http://127.0.0.1:5000

If on separate machines, create an SSH tunnel to your Linux machine, then launch the client:

ssh -L 5000:localhost:5000 user@LINUX_IP
python3 mcp_server.py --server http://127.0.0.1:5000

Note: If you're openly hosting the API server on your network (kali_server.py --ip 0.0.0.0), you don't need the SSH tunnel — but ⚠️ this is highly discouraged for security reasons.

python3 mcp_server.py --server http://LINUX_IP:5000

⚙️ MCP Client Configuration

Claude Desktop

Edit C:\Users\USERNAME\AppData\Roaming\Claude\claude_desktop_config.json:

{
    "mcpServers": {
        "hackbridge": {
            "command": "python3",
            "args": [
                "/absolute/path/to/mcp_server.py",
                "--server",
                "http://LINUX_IP:5000/"
            ],
            "timeout": 600
        }
    }
}

5ire Desktop Application

Simply add an MCP server with the command:

python3 /absolute/path/to/mcp_server.py --server http://LINUX_IP:5000

5ire will automatically generate the needed configuration files.


🧰 Supported Tools

Tool MCP Function Description
Nmap nmap_scan Network scanning & version detection
Gobuster gobuster_scan Directory, DNS, and vhost brute-forcing
Dirb dirb_scan Web content scanning
SQLMap sqlmap_scan SQL injection testing
Hydra hydra_attack Password brute-forcing
WPScan wpscan_analyze WordPress vulnerability scanning
Any command execute_command Execute any arbitrary terminal command

🔌 API Endpoints

The Flask API server (kali_server.py) exposes the following endpoints:

Method Endpoint Description
POST /api/command Execute any arbitrary command
POST /api/tools/nmap Run an Nmap scan
POST /api/tools/gobuster Run a Gobuster scan
POST /api/tools/dirb Run a Dirb scan
POST /api/tools/sqlmap Run a SQLMap scan
POST /api/tools/hydra Run a Hydra attack
POST /api/tools/wpscan Run a WPScan scan
GET /health Server health check

🔮 Other Possibilities

Since the AI model can now execute commands on the terminal, the possibilities go beyond just pentesting:

  • Memory Forensics with Volatility — Automate memory analysis: process enumeration, DLL injection checks, registry extraction from memory dumps.
  • Disk Forensics with SleuthKit — Automate disk image analysis, timeline generation, file carving, and hash comparisons.
  • OSINT & Recon — Automate recon workflows using tools like theHarvester, amass, subfinder, etc.
  • Log Analysis — Parse and analyze security logs, access logs, or system logs.

⚠️ Disclaimer

This project is intended solely for educational and ethical testing purposes. Any misuse of the information or tools provided — including unauthorized access, exploitation, or malicious activity — is strictly prohibited.

The author assumes no responsibility for misuse.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选