$git clone https://github.com/Wh0am123/MCP-Kali-ServerMCP Kali Server (MKS) is a lightweight API bridge that connects MCP clients (e.g: Claude Desktop or 5ire) to the [API server](https://modelcontextprotoc
| 1 | # MCP Kali Server |
| 2 | |
| 3 | **MCP Kali Server (MKS)** is a lightweight API bridge that connects [MCP clients](https://modelcontextprotocol.io/clients) (e.g: [Claude Desktop](https://code.claude.com/docs/en/desktop) or [5ire](https://github.com/nanbingxyz/5ire)) to the [API server](https://modelcontextprotocol.io/examples) which allows executing commands on a Linux terminal. |
| 4 | |
| 5 | This MCP is able to run terminal commands as well as interacting with web applications using: |
| 6 | |
| 7 | - `Dirb` |
| 8 | - `enum4linux` |
| 9 | - `gobuster` |
| 10 | - `Hydra` |
| 11 | - `John the Ripper` |
| 12 | - `Metasploit-Framework` |
| 13 | - `Nikto` |
| 14 | - `Nmap` |
| 15 | - `sqlmap` |
| 16 | - `WPScan` |
| 17 | - As well as being able to execute raw commands. |
| 18 | |
| 19 | As a result, this is able to perform **AI-assisted penetration testing** and solving **CTF challenges** in real time. |
| 20 | |
| 21 | ## Articles Using This Tool |
| 22 | |
| 23 | [](https://yousofnahya.medium.com/how-mcp-is-revolutionizing-offensive-security-93b2442a5096) |
| 24 | |
| 25 | 👉 [**How MCP is Revolutionizing Offensive Security**](https://yousofnahya.medium.com/how-mcp-is-revolutionizing-offensive-security-93b2442a5096) |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ## 🔍 Use Case |
| 30 | |
| 31 | The goal is to enable AI-driven offensive security testing by: |
| 32 | |
| 33 | - Letting the MCP interact with AI endpoints like [OpenAI](https://openai.com/), [Claude](https://claude.ai/), [DeepSeek](https://www.deepseek.com/), [Ollama](https://docs.ollama.com/) or any other models. |
| 34 | - Exposing an API to execute commands on a [Kali](https://www.kali.org/) machine. |
| 35 | - Using AI to suggest and run terminal commands to [solve CTF challenges](#example-solving-a-web-ctf-challenge-from-ramadanctf) or automate recon/exploitation tasks. |
| 36 | - Allowing MCP apps to send custom requests (e.g. `curl`, `nmap`, `ffuf`, etc.) and receive structured outputs. |
| 37 | |
| 38 | Here are some example (using Google's AI `gemini 2.0 flash`): |
| 39 | |
| 40 | ### Example solving a web CTF challenge from RamadanCTF |
| 41 | |
| 42 | https://github.com/user-attachments/assets/dc93b71d-9a4a-4ad5-8079-2c26c04e5397 |
| 43 | |
| 44 | ### Trying to solve machine "code" from HTB |
| 45 | |
| 46 | https://github.com/user-attachments/assets/3ec06ff8-0bdf-4ad5-be71-2ec490b7ee27 |
| 47 | |
| 48 | --- |
| 49 | |
| 50 | ## 🚀 Features |
| 51 | |
| 52 | - 🧠 **AI Endpoint Integration**: Connect your Kali to any MCP of your liking such as Claude Desktop or 5ier. |
| 53 | - 🖥️ **Command Execution API**: Exposes a controlled API to execute terminal commands on your Kali Linux machine. |
| 54 | - 🕸️ **Web Challenge Support**: AI can interact with websites and APIs, capture flags via `curl` and any other tool AI the needs. |
| 55 | - 🔐 **Designed for Offensive Security Professionals**: Ideal for red teamers, bug bounty hunters, or CTF players automating common tasks. |
| 56 | |
| 57 | --- |
| 58 | |
| 59 | ## 🛠️ Installation and Running |
| 60 | |
| 61 | ### On your Kali Machine |
| 62 | |
| 63 | ```bash |
| 64 | sudo apt install mcp-kali-server |
| 65 | kali-server-mcp |
| 66 | ``` |
| 67 | |
| 68 | Otherwise for **bleeding edge**: |
| 69 | |
| 70 | ```bash |
| 71 | git clone https://github.com/Wh0am123/MCP-Kali-Server.git |
| 72 | cd MCP-Kali-Server |
| 73 | python3 -m venv .venv |
| 74 | source .venv/bin/activate |
| 75 | pip install -r requirements.txt |
| 76 | ./server.py |
| 77 | ``` |
| 78 | |
| 79 | **Command Line Options**: |
| 80 | |
| 81 | - `--ip <address>`: Specify the IP address to bind the server to (default: `127.0.0.1` for localhost only) |
| 82 | - Use `127.0.0.1` for local connections only (secure, recommended) |
| 83 | - Use `0.0.0.0` to allow connections from any network interface (very dangerous; use with caution) |
| 84 | - Use a specific IP address to bind to a particular network interface |
| 85 | - `--port <port>`: Specify the port number (default: `5000`) |
| 86 | - `--debug`: Enable debug mode for verbose logging |
| 87 | |
| 88 | **Examples**: |
| 89 | |
| 90 | ```bash |
| 91 | # Run on localhost only (secure, default) |
| 92 | ./server.py |
| 93 | |
| 94 | # Run on all interfaces (less secure, useful for remote access) |
| 95 | ./server.py --ip 0.0.0.0 |
| 96 | |
| 97 | # Run on a specific IP and custom port |
| 98 | ./server.py --ip 192.168.1.100 --port 8080 |
| 99 | |
| 100 | # Run with debug mode |
| 101 | ./server.py --debug |
| 102 | ``` |
| 103 | |
| 104 | ### On your MCP client machine |
| 105 | |
| 106 | This can be local (on the same Kali machine) or remote (another Linux machine, Windows or macOS). |
| 107 | |
| 108 | If you're running the client and server on the same _Kali_ machine (aka loc |