MCP-Kali-Server
Bridges Claude Code to a Kali Linux VM via MCP, enabling execution of security tools like nmap, metasploit, and arbitrary commands.
README
MCP-Kali-Server
将 Kali Linux VM 的能力通过 MCP 暴露给 Claude Code 的 API 桥。包含 Kali 侧命令执行服务端(server.py)和 MCP 网关客户端(client.py),配合 execute_command 可执行 Kali 上任意工具。
架构
Claude Code
│ stdio (client.py)
▼
client.py ──HTTP──► server.py (Kali VM, 127.0.0.1:5000)
│ subprocess
▼
Kali 工具 (nmap/masscan/impacket...)
server.py:跑在 Kali VM,Flask HTTP API,执行命令并返回结构化结果client.py:MCP 网关,把工具调用转发到 Kali server
工具面
12 个专用 MCP 工具:nmap_scan / gobuster_scan / dirb_scan / nikto_scan / sqlmap_scan / metasploit_run / hydra_attack / john_crack / wpscan_analyze / enum4linux_scan / server_health / execute_command
通用 kali_tool(tool, params) 调度器:走 TOOL_SPECS 规格表,覆盖 57 工具——
| 类别 | 工具 |
|---|---|
| 侦察 | masscan / netdiscover / theharvester / whatweb / wafw00f / dnsrecon / dnsenum / fierce / amass / subfinder / httpx / dig / whois / dnsx |
| Web/目录 | ffuf / wfuzz / dirsearch / feroxbuster / nuclei / commix / joomscan / arjun |
| 服务枚举 | smbclient / smbmap / rpcclient / nbtscan / ldapsearch / snmpwalk / onesixtyone / nmblookup |
| 利用/凭据 | msfvenom / searchsploit / hashcat / responder / netexec / secretsdump / hashid / ncrack / cewl |
| AD/横向 | psexec / wmiexec / ntlmrelayx / evil-winrm / xfreerdp / bloodhound |
| 流量 | tcpdump / tshark / ngrep / arpspoof / tcpflow |
| 取证 | binwalk / exiftool / steghide / foremost |
| 无线 | aircrack-ng / airmon-ng / reaver |
| 后渗透 | proxychains |
每个工具都支持 additional_args 透传,配合 execute_command 可覆盖 Kali 全能力。
本版增强功能
- 通用工具调度器:
TOOL_SPECS规格表 +/api/tools/run,一行规格加一个工具,无需逐个写 wrapper - 自动 sudo:需要 root 的工具(masscan/arp-scan/tcpdump/无线类)自动加
sudo -n(SUDO_TOOLS),前提是 Kali 侧已配 NOPASSWD sudo - 每请求超时:请求体可带
timeout字段(秒)覆盖默认 180s;execute_command(command, timeout=)/kali_tool(..., params={"timeout": ...})均已支持,超时返回timed_out:true及部分结果 - 参数校验:缺失必需参数/未知工具返回明确错误
使用
1. Kali 侧启动 server
python3 server.py --ip 0.0.0.0 --port 5000
2. 注册 MCP client
Claude Code 项目级 .mcp.json(将 <YOUR_KALI_IP> 替换为 Kali 实际 IP):
{
"mcpServers": {
"kali": {
"type": "stdio",
"command": "python",
"args": ["/absolute/path/to/MCP-Kali-Server/client.py", "--server", "http://<YOUR_KALI_IP>:5000/"]
}
}
}
客户端通过 HTTP 直连 Kali server(NAT/桥接均可),无需 SSH 隧道;改 IP 只动 .mcp.json 一处。
3. 调用示例
# 专用工具
mcp__kali__nmap_scan(target="10.0.0.1", scan_type="-sV")
# 通用调度器
mcp__kali__kali_tool(tool="masscan", params={"target": "10.0.0.0/24", "ports": "80,443"})
# 任意命令
mcp__kali__execute_command(command="whoami", timeout=600)
部署
- 部署到 Kali:
scp server.py kali@<YOUR_KALI_IP>:/home/kali/kali-mcp-server.py(或直接git clone后运行) - 客户端在本机:
pip install -r requirements.txt后用python client.py --server http://<YOUR_KALI_IP>:5000/启动 - 含对上游
Wh0am123/MCP-Kali-Server的针对性增强(通用调度器/超时/sudo)
免责声明
仅供授权测试、CTF、安全教育使用。VM 快照可回溯,故本适配未做安全加固(含 execute_command 任意命令)。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.