Kali MCP Pentest Server
Enables users to perform security testing and penetration testing tasks through a Docker-based API that provides access to popular security tools like nmap, nikto, sqlmap, wpscan, dirb, and searchsploit. Designed for educational purposes with input sanitization and non-root execution for safer pentesting workflows.
README
Kali MCP Pentest Server
A Model Context Protocol (MCP) server that provides access to essential penetration testing tools through a standardized interface. Built on Kali Linux and designed for integration with AI assistants and automation platforms.
Overview
This project packages 8 essential security testing tools into an MCP server running in a containerized Kali Linux environment. It uses the FastMCP framework to expose security tools with proper input validation, timeout handling, and safety controls.
Available Tools
The server provides the following security testing tools via MCP:
| Tool | Purpose | Parameter | Example Command |
|---|---|---|---|
nmap_scan |
Network port scanning | target (hostname/IP) |
nmap -Pn <target> |
nikto_scan |
Web server vulnerability scanning | target (hostname/IP) |
nikto -h <target> |
sqlmap_scan |
SQL injection testing | target (URL) |
sqlmap -u <target> --batch |
wpscan_scan |
WordPress security scanning | target (WordPress URL) |
wpscan --url <target> |
dirb_scan |
Directory/file enumeration | target (URL) |
dirb <target> |
searchsploit_query |
Exploit database search | query (search term) |
searchsploit <query> |
ping_scan |
Network connectivity test | target (hostname/IP) |
ping -c 4 <target> |
traceroute_scan |
Network path tracing | target (hostname/IP) |
traceroute <target> |
Architecture
- Base: Kali Linux (
kalilinux/kali-rolling) Docker container - Framework: FastMCP for MCP protocol implementation
- Transport: StreamableHTTP (supports SSE and HTTP endpoints)
- Security: Non-root execution with minimal required capabilities
- Dependencies: Python virtual environment with required packages
Quick Start
Using Docker Compose (Recommended)
# Start the server
docker compose up -d
# View logs
docker compose logs -f
# Stop the server
docker compose down
Using Docker
# Build the image
docker build -t kali-mcp-server .
# Run the container
docker run -p 8080:8080 \
--cap-add=NET_RAW \
--cap-add=NET_ADMIN \
--cap-add=NET_BIND_SERVICE \
kali-mcp-server
Using Pre-built Image
# Pull and run the latest image from GitHub Container Registry
docker run -p 8080:8080 \
--cap-add=NET_RAW \
--cap-add=NET_ADMIN \
--cap-add=NET_BIND_SERVICE \
ghcr.io/andrew-stclair/kali-mcp-server/kali-mcp-server:latest
MCP Integration
Protocol Details
- Server Name:
kali-mcp-pentest-server - Transport: StreamableHTTP
- Host:
0.0.0.0 - Port:
8080 - Endpoints:
- MCP Protocol:
http://localhost:8080/mcp - Server-Sent Events:
http://localhost:8080/sse - Status Check:
http://localhost:8080/
- MCP Protocol:
Client Configuration
For MCP clients like N8N:
{
"serverUrl": "http://localhost:8080",
"transport": "http",
"mcpPath": "/mcp"
}
Testing MCP Connection
# Check server status
curl http://localhost:8080/
# Connect to SSE endpoint for session info
curl -H "Accept: text/event-stream" http://localhost:8080/sse
Security Features
Input Validation
- Sanitizes all user inputs to prevent command injection
- Blocks dangerous characters:
;&|$`\n\r` - Validates tool names against allowed list
Runtime Security
- Runs as non-root user (
kaliuser) - Uses Python virtual environment for dependency isolation
- Required Linux capabilities:
NET_RAW,NET_ADMIN,NET_BIND_SERVICE - Tool execution timeout: 120 seconds
Tool Restrictions
- Only whitelisted tools can be executed
- Fixed command-line arguments prevent arbitrary command execution
- Subprocess isolation with proper error handling
Development
Local Development
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run the server
python main.py
Dependencies
fastapi- Web frameworkuvicorn- ASGI serverpython-multipart- Form data handlingmcp>=1.15.0- Model Context Protocol implementation
Container Build Process
The Dockerfile performs these steps:
- Starts with Kali Linux rolling release
- Installs security tools and Python dependencies
- Creates non-root user with sudo privileges
- Sets up proper file ownership and capabilities
- Creates Python virtual environment
- Installs Python packages in isolated environment
- Exposes port 8080 and runs the MCP server
CI/CD Pipeline
The GitHub Actions workflow (.github/workflows/docker-build.yml):
- Triggers: Push to
mainbranch, pull requests - Build: Multi-architecture (linux/amd64, linux/arm64)
- Registry: GitHub Container Registry (
ghcr.io) - Deployment: Automatic on merge to
main
Security Considerations
⚠️ Educational Use Only: This tool is intended for learning and authorized testing only.
Important Notes
- Always obtain proper authorization before testing targets
- Use only on systems you own or have explicit permission to test
- The container requires elevated network capabilities for certain tools
- Input validation helps prevent command injection but shouldn't be your only security layer
- Monitor logs for suspicious activity
Capabilities Required
The container needs these Linux capabilities:
NET_RAW: For raw socket operations (nmap, ping)NET_ADMIN: For network administration tasksNET_BIND_SERVICE: For binding to privileged ports if needed
License
This project is for educational purposes. Users are responsible for compliance with applicable laws and regulations.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。