Pentester-MCP
<h1 align="center">Pentester-MCP</h1>
<p align="center">
<strong>Empower your AI assistants with the ultimate open-source penetration testing arsenal.</strong>
</p>
<p align="center">
<img alt="Tools" src="https://img.shields.io/badge/Tools-217-blue">
<img alt="Python" src="https://img.shields.io/badge/Python-3.11%2B-blue">
<img alt="FastMCP" src="https://img.shields.io/badge/Powered%20By-FastMCP-orange">
<img alt="Docker" src="https://img.shields.io/badge/Integration-Docker-cyan">
</p>
## Overview
**Pentester-MCP** provides **Model Context Protocol (MCP)** integration for over **200 of the most popular open-source cybersecurity and penetration testing tools**.
By adding Pentester-MCP to an AI assistant (like Claude Desktop, Cursor, or specialized agents), the AI gains the autonomous ability to act as a penetration tester:
- It can run `nmap` scans, analyze open ports, and automatically decide to run `ffuf` on discovered web servers.
- It can execute `sqlmap` against parameters it identifies as vulnerable.
- It understands tool arguments, required flags, and syntaxes thanks to AI-optimized documentation strings injected into every MCP tool.
All 217 Python `*_mcp.py` tools were generated intelligently from cheat sheets to ensure safe execution (e.g., preventing shell injection, enforcing timeouts, and handling huge terminal outputs).
## The Arsenal
The `tools/` directory includes MCP servers for almost every category:
* **Reconnaissance:** `nmap`, `masscan`, `recon-ng`, `amass`, `subfinder`, `nuclei`
* **Web Exploitation:** `sqlmap`, `commix`, `ffuf`, `gobuster`, `dirsearch`, `nikto`
* **Active Directory & Network:** `impacket` (full suite), `bloodhound`, `responder`, `evil-winrm`
* **Brute-Forcing & Password:** `hydra`, `medusa`, `john`, `hashcat`, `nxc`
* **And 180+ more** covering WiFi, Cloud, Kubernetes, and reversing.
---
## Installation & Usage
Because of the massive amount of tools, installing everything on your host machine can be messy. Therefore, Pentester-MCP offers two primary ways to run: **Docker Sandbox** (Recommended) and **Local Execution**. Both use [uv](https://docs.astral.sh/uv/) for dependency management — the project is defined in `pyproject.toml`, locked in `uv.lock`, and everything lives under `src/`.
### Method A: Docker Sandbox (Recommended & Secure)
The sandbox is based on [Exegol](https://github.com/ThePorgs/Exegol-images) — a well-known, curated set of Docker build recipes for pentesters (shell history, wordlists, custom tool configs). Exegol's prebuilt Docker Hub tags are stale (frozen at v3.1.6 while upstream is at 3.2), so Pentester-MCP **builds Exegol from source**: the [`src/exegol-images`](src/exegol-images) git submodule pins the upstream recipe tree, and each `src/docker/Dockerfile.<variant>` runs Exegol's own `entrypoint.sh` package installers on top of `debian:13-slim`. You always get the current Exegol tree — update it with one command and rebuild:
```bash
git submodule update --remote src/exegol-images
```
Variant images live in `src/pentester_mcp/docker/` (`Dockerfile.<variant>`) with a matching compose file in `src/pentester_mcp/compose-files/` per profile:
| Variant | Exegol packages | Focus | Suggested config |
| --- | --- | --- | --- |
| `example-kali` *(default)* | *(none)* | thin Kali base, you pick tools via apt in the Dockerfile — fastest way to try Pentester-MCP | pick your own |
| `web` | base + web + cracking + code analysis | web app security | `web-config.yaml` |
| `ad` | base + ad + c2 + network | Active Directory / internal | `ad-config.yaml` |
| `light` | base + `package_most_used` | essentials only, fastest build | pick your own |
| `osint` | base + osint | OSINT | `recon-config.yaml` |
| `full` | all `package_*` installers | every supported tool | any |
> **Build time warning:** building Exegol from source compiles the whole toolkit — expect **hours** and a multi-GB image (`light` is the fastest). Docker layer caching makes later rebuilds incremental.
The `MCP_CONFIG_PATH` in each compose file controls which tool wrappers are *exposed* to the AI; the image determines which binaries are *installed*. Exposed-but-missing tools simply return a `FileNotFoundError` the AI can report.
1. **Clone with submodules and select your tools (`src/pentester_mcp/configs/*.yaml`):**
```bash
git clone --recurse-submodules https://github.com/halilkirazkaya/pentester-mcp.git
cd pentester-mcp
```
2. **Build and Run the Sandbox:**
```bash
docker compose -f src/pentester_mcp/compose-files/docker-compose.example-kali.yml up -d --build
```
For another profile, e.g. web:
```bash
docker compose -f src/pentester_mcp/compose-files/docker-compose.web.yml up -d --build
```
*Your container is now running silently in the background.*
3. **Add to your AI Client:**
Open your MCP client's configuration (e.g., `claude_desktop_config.json`) and copy a snippet from `src/pentester_mcp/mcp-config-files/`.
---
### Method B: Local Execution (Fastest Setup)
If you already have Kali Linux, Parrot OS, or you specifically only want to use the tools already installed on your host system:
1. **Clone and Install with uv:**
```bash
git clone https://github.com/halilkirazkaya/pentester-mcp.git
cd pentester-mcp
uv sync
uv run pentester-mcp # default config (example)
uv run pentester-mcp src/pentester_mcp/configs/web-config.yaml
uv run python -m pentester_mcp.server src/pentester_mcp/configs/ad-config.yaml
```
2. **Add to your AI Client:** Point your MCP client at the console script (`.venv/bin/pentester-mcp`) or run `python -m pentester_mcp.server` from your local environment. The active tool set is chosen by (in order): the config path **argument**, `MCP_CONFIG_PATH`, or the default `src/pentester_mcp/configs/example-config.yaml`.
*Note: If the tool binary (e.g., `nmap` or `gobuster`) is not installed on your host system, the AI will gracefully receive a `FileNotFoundError` and inform you.*
---
## 🔧 Configuring MCP Clients (Claude, Cursor, etc.)
Unlike legacy setups requiring you to register a server per tool out of 217 options, Pentester-MCP now uses a **Unified Server Architecture**.
1. Define which tools you want available by editing a configuration file in `src/pentester_mcp/configs/` (e.g., `example-config.yaml`).
2. Add the **single Unified Server** to your Claude/Cursor configuration. Ready-to-use MCP client snippets live in **`src/pentester_mcp/mcp-config-files/`** in two sets — same eight tool configs each, one file per tool config:
- **`docker/`** — runs the server inside the running `pentester-mcp` container (`docker exec ... uv run --no-sync --project /app pentester-mcp configs/<name>.yaml`). For use with Method A.
- **`local/`** — runs the server directly on your host with uv (`uv run --no-sync --directory <repo> pentester-mcp src/pentester_mcp/configs/<name>.yaml`). For use with Method B; replace the `/path/to/pentester-mcp` placeholder with your clone's path and run `uv sync` once first.
| File (in both `docker/` and `local/`) | Starts the server with | Tools exposed |
| --- | --- | --- |
| `mcp-config.json` | `example-config.yaml` | starter 18-toolkit |
| `mcp-config.full.json` | `full-config.yaml` | everything (217) |
| `mcp-config.web.json` | `web-config.yaml` | web only |
| `mcp-config.ad.json` | `ad-config.yaml` | AD only |
| `mcp-config.recon.json` | `recon-config.yaml` | recon only |
| `mcp-config.pwd.json` | `pwd-config.yaml` | password attacks |
| `mcp-config.exploit.json` | `exploit-config.yaml` | exploitation/C2 |
| `mcp-config.misc.json` | `misc-config.yaml` | misc/scanning |
Multiple snippets can coexist in one MCP client (distinct `mcpServers` keys: `pentester_mcp`, `pentester_mcp_web`, ...), letting the AI pick the right toolset per task. Don't register the `docker/` and `local/` version of the same profile together — they use the same server keys.
### Claude Desktop Example
Simply copy the contents of `src/pentester_mcp/mcp-config-files/docker/mcp-config.json` (Method A) or `src/pentester_mcp/mcp-config-files/local/mcp-config.json` (Method B) into your `claude_desktop_config.json` file. The docker one looks like this:
```json
{
"mcpServers": {
"pentester_mcp": {
"command": "docker",
"args": [
"exec",
"-i",
"pentester-mcp",
"uv",
"run",
"--no-sync",
"--project",
"/app",
"pentester-mcp",
"configs/example-config.yaml"
]
}
}
}
```
> **WARNING:** The snippets use `docker exec -i pentester-mcp`, targeting the running Docker container named `pentester-mcp`. Ensure the container is running (e.g. `docker compose -f src/pentester_mcp/compose-files/docker-compose.example-kali.yml up -d`) before using the AI assistant. The `configs/<name>.yaml` argument is the path **inside** the container; the same files live locally under `src/pentester_mcp/configs/`.
---
## Contributing & Architecture
The Python scripts in the `src/pentester_mcp/tools/` directory are auto-generated from YAML cheat sheets to guarantee consistent API design (proper timeouts, truncating outputs to >8000 chars, no `shell=True` vulnerabilities). Only security- and pentest-specific tools are included; generic sysadmin utilities are intentionally excluded (the `kubectl` wrapper is kept for Kubernetes attack-surface checks like RBAC enumeration and secret viewing).
If you have a request for a new tool to be added, please feel free to open an issue.
---
## Disclaimer
**Legal Disclaimer:** This project is created strictly for educational purposes, authorized auditing, and ethical hacking. The developers of Pentester-MCP assume no liability and are not responsible for any misuse or damage caused by this software. **Never use these tools against environments you do not own or do not have explicit, written permission to test.**
## Star History
<a href="https://www.star-history.com/?repos=halilkirazkaya%2Fpentester-mcp&type=date&legend=bottom-right">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=halilkirazkaya/pentester-mcp&type=date&theme=light&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=halilkirazkaya/pentester-mcp&type=date&theme=light&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=halilkirazkaya/pentester-mcp&type=date&legend=top-left" />
</picture>
</a>
TDQS
Scored across 32 tools
Most tools are named after distinct underlying utilities, but several categories overlap heavily: run_nmap/run_masscan/run_nping, run_ffuf/run_gobuster, run_subfinder/run_amass/run_theharvester, and run_hydra/run_john/run_hashcat. The duplicate start_ncat_listener/start_netcat_listener and stop_ncat_listener/stop_netcat_listener pairs are especially ambiguous. Descriptions help distinguish them, but an agent still has many plausible choices for the same task.
The set largely follows a predictable snake_case verb_noun convention: run_<tool>, start_<process>, stop_<process>, and list_<resource>. Minor deviations like john_prepare (noun_verb) and the long session-specific names are readable but slightly inconsistent.
With 32 tools, the surface is heavy for a single MCP server and includes duplicate listener controls plus multiple overlapping scanners. While each tool maps to a real pentesting utility, the set could be consolidated and better scoped.
The surface covers a broad pentesting lifecycle: reconnaissance, network scanning, web scanning/fuzzing, exploitation, password attacks, SMB enumeration, and listeners. Some common areas are missing, such as a full exploitation framework, reporting, and generic process management, but the core workflow coverage is strong.