Hercules MCP
Provides access to the Metasploit Framework for exploitation, using native RPC to execute modules and manage sessions.
Click on "Install 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., "@Hercules MCPscan example.com for open ports and services"
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.
Hercules MCP is a Model Context Protocol server that gives AI agents the ability to perform professional penetration testing. It orchestrates a fully containerized Kali Linux environment, exposing industry-standard offensive security tools as structured MCP tools that any MCP-compatible agent can reason about and drive autonomously.
Why Hercules?
๐ณ Sandbox-First Architecture
Every command executes inside an ephemeral Docker container based on kalilinux/kali-rolling. Your host machine is never exposed โ tools, exploits, and payloads stay isolated. Containers are created per-session and destroyed on shutdown by default.
๐ค Agent-Managed Sessions: The AI agent can fully manage its own Docker sessions directly, allowing it to start, stop, and control multiple environments dynamically.
๐ Persistent Workspaces: Session files, downloaded loot, and tool outputs are automatically stored locally in the workspace/ directory at the project root. This ensures the agent maintains persistent access to scan results and artifacts between sessions while keeping the host system completely isolated.
โก Token-Cost Optimized
Hercules is designed for AI agents, not humans. Tool outputs are parsed and structured โ raw XML, verbose banners, and redundant data are stripped before reaching the model. Only the information the agent needs is returned, saving thousands of tokens per interaction.
๐ Works With Any MCP Client
Built on the open MCP standard. Connect it to any MCP-compatible agent or client โ Claude Code, Cursor, Windsurf, Gemini CLI, or your own custom agent โ with a single JSON config.
Tooling
Hercules bundles the most widely-used offensive security tools, pre-installed and ready to use. To prevent agent tool confusion and hallucination, Hercules strictly limits access only to necessary and well-structured tools:
Category | Tools |
Reconnaissance | Nmap, Amass, dnsx, Whois, dig |
Web Scanning | Nikto, Nuclei, WhatWeb, WPScan, Wafw00f, httpx, Arjun, Gobuster |
Exploitation | Metasploit Framework, SQLMap, SearchSploit |
Password Cracking | John the Ripper, Hydra |
Networking | Ncat, curl, hping3 |
Post-Exploitation | linPEAS, winPEAS, PowerUp, GTFOBins, LOLBAS |
CTF / Forensics | Binwalk, Steghide, ExifTool |
System & Shell | Full Kali Linux shell access ( |
All tools are accessed through structured MCP tool calls with typed parameters, parsed outputs, and built-in concurrency control.
Quick Start
Docker is required. Before running the setup script, ensure you have Docker installed locally and the Docker daemon is up and running.
Prerequisites
1. Clone & Install
git clone https://github.com/<your-username>/hercules-mcp.git
cd hercules-mcp
uv sync2. Build the Environment
python hercules_setup.pyThis builds the hercules-kali Docker image and downloads wordlists (SecLists, rockyou.txt). One-time operation, ~10 minutes.
3. Configure
cp .env.example .envKey settings:
Variable | Default | Description |
|
| Metasploit RPC password |
|
| Skip Metasploit for faster startup |
| (empty) | Restrict scanning to specific targets |
| (empty) | Block specific targets |
See .env.example for all options.
4. Start the Server
uv run herculesConnect to Your AI Agent
To connect Hercules to any MCP-compatible AI agent or client (such as Claude Code, Claude Desktop, Cursor, Windsurf, or your own custom agent), add the following server configuration to your client's MCP configuration file (e.g., claude_desktop_config.json or .cursor/mcp.json):
{
"mcpServers": {
"hercules": {
"command": "uv",
"args": ["run", "hercules"],
"cwd": "/absolute/path/to/hercules-mcp"
}
}
}Design Principles
๐ Sandboxed Execution
All tools run inside Docker. The host filesystem, network stack, and processes are never touched. Containers are ephemeral and destroyed after each session.
๐ Structured Output
Nmap returns parsed JSON, not 11KB of raw XML. Metasploit uses native RPC, not console scraping. Every tool returns clean, typed data the agent can reason about.
โ๏ธ Concurrency Control
Heavy operations (aggressive scans, exploits) and light operations (DNS lookups, file reads) are separated by async semaphores. No resource starvation.
๐ก๏ธ Safety Controls
Target allow/block lists, configurable resource limits, and full audit logging. Every command is logged with timestamp, tool, target, and result.
๐ Cross-Platform Compatibility
Hercules natively supports Windows, macOS, and Linux out of the box. Automatic VPN detection, LHOST recommendation, and Docker port forwarding ensure that reverse shells and network scanners work flawlessly on any operating system without manual configuration.
๐งน Token Optimization
Raw output is parsed, filtered, and compressed before reaching the LLM. Useless interfaces, verbose XML, and redundant data are stripped โ keeping context windows lean.
Project Structure
hercules-mcp/
โโโ hercules/ # Python package
โ โโโ main.py # FastMCP server entry point
โ โโโ core/ # Docker manager, config, concurrency
โ โโโ tools/ # MCP tool implementations
โ โโโ resources/ # Post-exploitation scripts
โโโ docker/ # Container entrypoint
โโโ Dockerfile # Kali container definition
โโโ hercules_setup.py # First-time setup script
โโโ hercules-mcp.json # MCP client manifest
โโโ pyproject.toml # Project metadata
โโโ .env.example # Configuration templateSecurity
โ ๏ธ Authorized Use Only
Hercules is built for authorized penetration testing, security research, CTF competitions, and lab environments. Never use it against systems without explicit written permission.
License
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xMihirK/hercules-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server