kali-mcp-server

mcp
Guvenlik Denetimi
Gecti
Health Gecti
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 10 GitHub stars
Code Gecti
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

A Python MCP Server that connects Large Language Models natively to a comprehensive suite of offensive security tools.

README.md
Kali Linux MCP Server

🐉 Kali Linux MCP Server

Connect AI assistants and MCP-compatible clients—such as Claude Desktop, VS Code (GitHub Copilot), and Cursor—to Kali Linux security assessment tools through the Model Context Protocol (MCP).

Built on the official FastMCP Python SDK, this server wraps standard Kali CLI utilities behind structured MCP tools with async execution, input validation, optional target scope enforcement, clean output formatting, and ready-to-run Docker images.

Authorized Use Only: This project is intended for authorized security assessments, lab environments, and defensive research. Only run tools against systems, networks, and accounts you own or have explicit permission to test.


✨ Highlights

  • 22 Built-in MCP Tools: Covers reconnaissance, network discovery, web assessment, password policy auditing, advisory search, packet capture, and an environment check tool (list_available_tools).
  • Two Docker Image Tiers: Choose :slim for fast pulls and core recon/web scanning, or :latest (:full) for the complete toolkit including Metasploit, WPScan, Hydra, John, Hashcat, ExploitDB, and rockyou.txt.
  • Target Scope Guardrails: Optionally restrict target hosts, domains, and CIDR ranges using KALI_MCP_ALLOWED_TARGETS.
  • Clean, LLM-Friendly Output: Strips ANSI color codes, enforces execution timeouts with process cleanup, surfaces exit codes, and truncates oversized output while preserving both the beginning and summary tail.
  • Flexible Transports: Runs over stdio by default for desktop clients and IDEs, with optional streamable-http support.

🎬 Demos

Hash Auditing with Claude

Claude hash audit demo

Autonomous Vulnerability Scanning with GitHub Copilot

Autonomous Vulnerability Scanning with GitHub Copilot & Kali MCP Server


🚀 Quick Start (Docker)

Docker is the easiest way to run the server on macOS, Windows, or Linux without installing Kali tools locally.

Choose an Image Variant

Image Tag Best For Included Tools
cyberillo/kali-mcp-server:slim Everyday recon, scanning & web testing (smaller download) whois, dnsenum, whatweb, nmap, smbclient, nikto, gobuster, dirb, ffuf, wfuzz, sqlmap, tcpdump, plus DIRB wordlists
cyberillo/kali-mcp-server:latest (or :full) Full security assessment toolkit Everything in :slim plus amass, netdiscover, enum4linux, wpscan, hydra, john, hashcat, searchsploit, msfconsole, and extracted rockyou.txt

Pull the Image

# Slim image (recommended for most setups)
docker pull cyberillo/kali-mcp-server:slim

# Or the full toolkit
docker pull cyberillo/kali-mcp-server:latest

Verify the Container

docker run --rm cyberillo/kali-mcp-server:slim --version

When run directly without arguments (docker run -i --rm cyberillo/kali-mcp-server:slim), the server starts in stdio mode and waits silently for JSON-RPC messages from an MCP client. Once connected, ask your AI client to run list_available_tools to see installed binaries, wordlists, and active scope rules.

Important: Always pass -i and never -t when running over stdio—allocating a pseudo-TTY interferes with the MCP protocol stream.

Mounting Custom Wordlists

To use your own wordlists inside the container, mount a local folder read-only and pass the container path to the tool's wordlist parameter:

docker run -i --rm \
  -v "$PWD/wordlists:/wordlists:ro" \
  -e KALI_MCP_ALLOWED_TARGETS=192.0.2.0/24,lab.example \
  cyberillo/kali-mcp-server:slim

For example, pass /wordlists/custom.txt to gobuster_dir or ffuf_scan.

Elevated Network Capabilities (Optional)

Most tools work with Docker's default container permissions. Only if your authorized assessment requires raw packet capture or ARP discovery (such as tcpdump_sniff, netdiscover_scan, or SYN scans with nmap_scan), add only the minimal capability needed:

docker run -i --rm --cap-add=NET_RAW cyberillo/kali-mcp-server:slim

Avoid --privileged and never mount the Docker socket into the container.


🤖 Connecting an MCP Client

Replace 192.0.2.0/24,lab.example with the IPs, CIDRs, or domains you are authorized to test (or omit the -e KALI_MCP_ALLOWED_TARGETS=... pair if you do not want allowlist filtering). Switch :slim to :latest if you want the full toolkit.

Claude Desktop

Open your claude_desktop_config.json (in Claude Desktop: Settings → Developer → Edit Config) and add:

{
  "mcpServers": {
    "kali-tools": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "KALI_MCP_ALLOWED_TARGETS=192.0.2.0/24,lab.example",
        "cyberillo/kali-mcp-server:slim"
      ]
    }
  }
}

VS Code / GitHub Copilot

Create or update .vscode/mcp.json in your workspace:

{
  "servers": {
    "kali-tools": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "KALI_MCP_ALLOWED_TARGETS=192.0.2.0/24,lab.example",
        "cyberillo/kali-mcp-server:slim"
      ]
    }
  }
}

Cursor & Other MCP Clients

Add a new MCP server with:

  • Transport: stdio
  • Command: docker
  • Arguments: run -i --rm -e KALI_MCP_ALLOWED_TARGETS=192.0.2.0/24,lab.example cyberillo/kali-mcp-server:slim

Tip: Keep tool confirmation/approval enabled in your MCP client, especially before running active web checks or credential audits.


🌐 Streamable HTTP Mode (Optional)

If your client connects over HTTP instead of stdio, start the server with --transport streamable-http. The MCP endpoint is served at /mcp.

With Docker (bound to localhost):

docker run --rm -p 127.0.0.1:8000:8000 \
  -e KALI_MCP_ALLOWED_TARGETS=lab.example \
  cyberillo/kali-mcp-server:slim \
  --transport streamable-http --host 0.0.0.0 --port 8000

Locally:

kali-mcp-server --transport streamable-http --host 127.0.0.1 --port 8000

Then connect your client to http://127.0.0.1:8000/mcp.

Security Note: Streamable HTTP mode has no built-in authentication. Keep it bound to 127.0.0.1 for local use, or place it behind an authenticated TLS reverse proxy if remote access is required.


🛠️ Building from Source or Running Locally

Build the Docker Images Locally

git clone https://github.com/cyberillo/kali-mcp-server.git
cd kali-mcp-server

# Build the slim variant
docker build --target slim -t cyberillo/kali-mcp-server:slim .

# Build the full variant
docker build --target full -t cyberillo/kali-mcp-server:latest .

Run Directly on Kali Linux (No Docker)

Requires Python 3.10+ and whichever Kali command-line tools you plan to use installed in your PATH.

git clone https://github.com/cyberillo/kali-mcp-server.git
cd kali-mcp-server

python3 -m venv .venv
source .venv/bin/activate
pip install .

# Start the MCP server (stdio)
kali-mcp-server

You can also run the launcher script directly with python3 kali-mcp-server.py. To connect a local MCP client such as Claude Desktop, point its command to /absolute/path/to/.venv/bin/kali-mcp-server.


🧰 Available Tools

Every tool validates its inputs before execution and returns command output, warnings, or a clear error message. If a tool requires a binary only included in :latest, the server will let you know.

System

Tool Parameters Description
list_available_tools (none) Shows server version, image tier (slim/full/local), installed binaries, detected wordlists, and active scope rules.

Reconnaissance

Tool Parameters Description
whois_lookup domain Queries domain registration and ownership details.
dnsenum_scan domain Enumerates DNS records for a domain (reverse lookup disabled).
whatweb_scan target_url, verbose=false Identifies web technologies, CMS platforms, and HTTP headers.
amass_enum domain, timeout_minutes=4 Runs passive subdomain enumeration (timeout_minutes clamped to 1–15).
netdiscover_scan ip_range Discovers active hosts on a local subnet (e.g., 192.168.1.0/24; requires raw network access).

Network Scanning & Enumeration

Tool Parameters Description
nmap_scan target, flags="-sV -F" Discovers open ports and services. Supports -sV, -sT, -sS, -sU, -sn, -Pn, -n, -F, -O, --open, --reason, -v, -vv, -T0–-T4, and -p PORTS (e.g., 22,80-81).
enum4linux_scan target_ip Enumerates users, shares, and policies on Windows/Samba hosts.
smbclient_list target_ip, user="", password="" Lists SMB shares (uses a null session when user is omitted).

Web Assessment

Tool Parameters Description
nikto_scan target_url Scans a web server for common configuration issues (tuning categories 1, 2, 3).
gobuster_dir target_url, wordlist Discovers web directories and files using a wordlist.
dirb_scan target_url, wordlist Scans web content against a wordlist.
ffuf_scan target_url, wordlist Fast web path/parameter fuzzing. target_url must contain FUZZ in the path or query (e.g., https://lab.example/FUZZ).
wfuzz_scan target_url, wordlist Web path/parameter fuzzing hiding HTTP 404 responses. target_url must contain FUZZ in the path or query.
sqlmap_scan target_url, params="--batch" Detection-only SQL injection checks (always non-interactive). Supports --batch, --smart, --text-only, --titles, --disable-coloring, --level=1..3, --risk=1, --threads=1..4, --timeout=1..99, --retries=0..3.
wpscan_enum target_url Enumerates vulnerable WordPress plugins. Set WPSCAN_API_TOKEN for full vulnerability data.

Default web wordlist: /usr/share/wordlists/dirb/common.txt.

Password & Authentication Auditing

Tool Parameters Description
hydra_bruteforce target, service, user, wordlist Audits an authorized test account on ssh, ftp, smb, imap, or pop3 (single worker, stops on first match). May trigger account lockouts—use a small approved wordlist.
john_crack hash_string, wordlist Audits a single inline password hash using John the Ripper and displays matched results automatically.
hashcat_crack hash_string, hash_type="0", wordlist Audits a single inline password hash using a numeric Hashcat mode (requires a supported compute device).

Default password wordlist: /usr/share/wordlists/rockyou.txt (included in :latest/:full).

Advisories, Packet Capture & Service Checks

Tool Parameters Description
searchsploit_query query Searches the local Exploit-DB advisory database for remediation research.
tcpdump_sniff interface="eth0", packet_count="10" Captures between 1 and 1000 packets (60-second timeout; requires capture permissions).
metasploit_exploit module, options Runs Metasploit auxiliary/scanner/ modules non-interactively. Pass comma-separated KEY=VALUE options supporting RHOST/RHOSTS, RPORT, and SSL (e.g., RHOSTS=192.0.2.10, RPORT=443, SSL=true).

⚙️ Configuration

Pass environment variables with -e NAME=value in Docker or export them in your shell when running locally:

Variable Default Description
KALI_MCP_ALLOWED_TARGETS (unset) Comma-separated allowlist of exact hostnames, IPs, CIDRs, or wildcard domains (e.g., 192.0.2.0/24,lab.example,*.internal.example). lab.example matches only that host; *.internal.example matches the domain and its subdomains.
KALI_MCP_MAX_OUTPUT_CHARS 30000 Maximum characters returned per command before head/tail truncation.
KALI_MCP_DEFAULT_TIMEOUT 300 Fallback command timeout in seconds (tools with explicit timeouts range from 30s to 900s).
WPSCAN_API_TOKEN (unset) Optional WPScan API token for vulnerability database lookups in wpscan_enum.

About KALI_MCP_ALLOWED_TARGETS: Target allowlisting is an input-validation guardrail, not a network firewall. It checks the requested host/IP string before running a tool, but does not filter DNS resolution, HTTP redirects, passive enumeration results, or packet captures. Combine it with network isolation and MCP client approvals for strict containment.


🔧 Troubleshooting

  • MCP client fails to connect: Verify Docker is running (docker info), ensure your client args include -i and not -t, and check that the image name is cyberillo/kali-mcp-server:slim or cyberillo/kali-mcp-server:latest.
  • Tool or wordlist not found: Run list_available_tools to check what is installed. Heavy tools and rockyou.txt are included in :latest (not :slim), or you can mount custom wordlists with -v.
  • Command timed out: Narrow the target or port range, or use a smaller wordlist. Partial output collected before the timeout is returned whenever available.
  • Permission denied on tcpdump or netdiscover: Add --cap-add=NET_RAW to your docker run arguments and verify the interface name visible inside the container.
  • Hashcat reports no devices: Containers do not automatically expose host GPU/OpenCL drivers. Use john_crack for CPU-based hash auditing, or configure device passthrough for Hashcat.
  • Amass reports missing libpostal data: Kali's Amass package relies on large external libpostal datasets that this server will not download automatically during an MCP tool call. Initialize the data in a persistent environment or custom derived image if you need amass_enum.
  • WPScan shows no vulnerability details: Pass a valid WPSCAN_API_TOKEN environment variable.

📄 License

Licensed under the MIT License. Bundled Kali Linux utilities are governed by their respective upstream licenses.

Yorumlar (0)

Sonuc bulunamadi