A Model Context Protocol (MCP) server that exposes Kali Linux tools to AI agents. This allows LLMs to discover and execute security testing tools like nmap, sqlmap, hydra, metasploit, etc.
This server runs inside a Kali Linux Docker container and provides MCP tools to:
- List all available Kali tools
- Check if a specific tool is available
- Execute Kali tools with arguments
- Monitor server health
┌─────────────┐ ┌──────────────────────────┐
│ MCP Host │────▶│ Kali MCP Server │
│ (e.g., LLM) │ │ FastMCP + Docker │
│ │◀────│ (stdio transport) │
└─────────────┘ └──────────────────────────┐
│ Kali Linux Container │
│ - /usr/bin tools │
│ - /usr/sbin tools │
└────────────────────────────┘
- Docker installed on your system
- Python 3.10+ (for local development)
docker build -t kali-mcp-server:latest .If your Docker environment sits behind TLS inspection or a corporate proxy, inject the trusted root CA during build:
docker build \
--build-arg KALI_REPO_URL=https://http.kali.org/kali \
--build-arg CUSTOM_CA_PEM="$(cat company-root-ca.crt)" \
-t kali-mcp-server:latest .Notes:
company-root-ca.crtshould be a PEM-encoded root certificate trusted by your network.- The Dockerfile defaults to Kali's official
http://http.kali.org/kalisource. If you switch to HTTPS, the Dockerfile installs this certificate beforeapt-get updateso Kali package downloads can validate TLS correctly. - If your shell has trouble with multiline PEM build args, prefer the prebuilt image workflow below.
The Docker image is built from kalilinux/kali-rolling and includes:
- Python 3 with FastMCP SDK
- Kali Linux toolset (all tools from
/usr/bin,/usr/sbin) - MCP server configuration
If your environment cannot build from Kali package repositories, you can provide the image ahead of time and skip the local build step.
docker load < kali-mcp-server.tardocker pull <your-registry>/kali-mcp-server:latest
docker tag <your-registry>/kali-mcp-server:latest kali-mcp-server:latestdocker image inspect kali-mcp-server:latestThe MCP client configuration in this repository expects the local image name kali-mcp-server:latest.
The MCP server connects directly through Docker using the mcp.json configuration:
# Ensure Docker is running
docker ps
# The server starts automatically when your MCP client connects# Start container interactively
docker run -it --name kali-mcp kali-mcp-server:latest
# Run commands inside the container
docker exec -it kali-mcp python3 /app/server.pyThe mcp.json file contains the MCP server configuration:
{
"mcpServers": {
"kali-linux-tools": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--name",
"kali-mcp-${SESSION_ID}",
"kali-mcp-server:latest"
],
"env": {
"MCP_TRANSPORT": "stdio"
}
}
}
}This configuration:
- Uses Docker as the command to run
- Runs a fresh container for each session (
--rm) - Uses stdio transport for MCP protocol
- Names containers uniquely per session
This repository includes add.sh, a helper script that installs the Kali MCP server entry into supported MCP client configs.
- Claude Desktop
- Claude Code
- Cursor
- Windsurf
- VS Code / GitHub Copilot
- Continue
- Cline
- Roo Code
- OpenCode
- Zed
- Codex
- Gemini CLI
# Show help
./add.sh --help
# Add to a single client
./add.sh --claude-desktop
./add.sh --opencode
# Add to multiple clients at once
./add.sh --claude-code --cursor --vscode
# Add to every supported target
./add.sh --all- Uses the local
docker-wrapper.shpath from this repository - Adds or updates the
kali-linux-toolsMCP entry - Creates missing config files and parent directories when needed
- Preserves unrelated config entries in existing files
| Target | Config path |
|---|---|
| Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, ~/.config/Claude/claude_desktop_config.json on Linux, %APPDATA%/Claude/claude_desktop_config.json on Windows |
| Claude Code | .mcp.json |
| Cursor | .cursor/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json on macOS/Linux, %USERPROFILE%/.codeium/windsurf/mcp_config.json on Windows |
| VS Code / Copilot | .vscode/mcp.json |
| Continue | ~/.continue/config.json on macOS/Linux, %USERPROFILE%/.continue/config.json on Windows |
| Cline | ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json on macOS, ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json on Linux, %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json on Windows |
| Roo Code | ~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json on macOS, ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json on Linux, %APPDATA%/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json on Windows |
| OpenCode | opencode.json |
| Zed | ~/.config/zed/settings.json on macOS/Linux, %APPDATA%/Zed/settings.json on Windows |
| Codex | .codex/config.toml |
| Gemini CLI | ~/.gemini/settings.json on macOS/Linux, %USERPROFILE%/.gemini/settings.json on Windows |
- Project-level targets write into this repository.
- Global targets write into your home directory config locations.
- The script now handles macOS, Linux, and Windows-style config paths for supported global targets.
- On Windows, run the script from Git Bash, MSYS2, or Cygwin so
bashand the wrapper-based command remain valid. - After updating a client config, restart that client so it reloads MCP servers.
Once the Docker image is built, an MCP client can launch this server on demand and call its tools.
This repository includes deploy_kali_mcp.sh to automate common local deployment tasks:
- Build the Docker image (
kali-mcp-server:latestby default) - Install/update the systemd service using
install_systemd_service.sh - Install/update the Claude agent file at
~/.claude/agents/kali-operator.md
# Show help
./deploy_kali_mcp.sh --help
# Preview actions without making changes
./deploy_kali_mcp.sh --dry-run
# Run full deployment
./deploy_kali_mcp.shOptional overrides:
# Use a custom Docker tag
./deploy_kali_mcp.sh --image-tag kali-mcp-server:stable
# Install agent file to a custom Claude agents directory
./deploy_kali_mcp.sh --claude-agent-dir /path/to/agentsNotes:
install_systemd_service.sh installmay prompt for sudo/root privileges.- The script is intended for Linux hosts that use systemd.
# 1. Build the image, or load/pull a prebuilt one
docker build -t kali-mcp-server:latest .
# If needed, force HTTPS mirror and inject a trusted corporate/proxy root CA
# docker build --build-arg KALI_REPO_URL=https://http.kali.org/kali --build-arg CUSTOM_CA_PEM="$(cat company-root-ca.crt)" -t kali-mcp-server:latest .
# Alternative: load or pull a prebuilt image
# docker load < kali-mcp-server.tar
# docker pull <your-registry>/kali-mcp-server:latest
# docker tag <your-registry>/kali-mcp-server:latest kali-mcp-server:latest
# 1b. Verify the image exists locally
docker image inspect kali-mcp-server:latest
# 2. Install the MCP entry into one or more clients
./add.sh --claude-desktop
# or
./add.sh --claude-code --cursor --vscode
# 3. Restart the client you updated- Your MCP client loads the
kali-linux-toolsserver entry. - When the client connects, it starts the Docker-backed server.
- The client discovers the available MCP tools.
- You ask the client to inspect tools or run a Kali command.
- The server returns structured results over MCP.
After restarting your MCP client, verify the server is available by asking it to:
- list available tools from
kali-linux-tools - run
health_check - run
server_info
If the client is connected correctly, it should show the server tools and return a healthy status.
Use prompts like these in your MCP-enabled client:
List the first 20 Kali tools exposed by kali-linux-tools.Check whether sqlmap is installed.Run nmap --version using the kali-linux-tools MCP server.Run health_check on the kali-linux-tools server.Show server_info for the kali-linux-tools MCP server.
| Intent | MCP tool | Example |
|---|---|---|
| Discover tools | list_tools |
list_tools(limit=20) |
| Check one tool | check_tool |
check_tool(tool_name="nmap") |
| Execute a command | execute_tool |
execute_tool(tool="nmap", arguments=["--version"]) |
| Verify health | health_check |
health_check() |
| Inspect server metadata | server_info |
server_info() |
- Start with read-only or version-check commands such as
--helpor--version. - Prefer targeted commands over broad scans until you confirm the client-server setup works.
- Treat
execute_toolas direct command execution inside the Kali container. - Review generated arguments in your client before approving tool execution.
- Use this server only in environments where running security tools is appropriate.
add.shinstalls MCP client config only; it does not build, pull, or publish Docker images.- In restricted environments, using a prebuilt
kali-mcp-server:latestimage may be more reliable than building locally.
The server exposes the following tools through MCP:
List all available Kali tools.
Arguments:
limit(optional): Maximum number of tools to return
Check if a specific Kali tool is available.
Arguments:
tool_name(required): Name of the tool to check
Execute a Kali tool with specified arguments.
Arguments:
tool(required): Name of the Kali tool to executearguments(optional, default: []): List of command line arguments for the tooltimeout(optional, default: 60): Timeout in seconds for command execution
Check server health status.
Arguments: None
Get server information and available endpoints.
Arguments: None
# Install dependencies
pip install "mcp[cli]" uvicorn
# Run server
python3 server.py [--transport stdio|streamable-http]Server will start with stdio transport (default) or HTTP on port 3001.
server.py- FastMCP server implementationmcp.json- MCP server configuration for DockerDockerfile- Docker image definitionREADME.md- This documentation
⚠️ No authentication - This is a local development tool only⚠️ Direct command execution - Any Kali tool can be run with any arguments⚠️ No input validation - Arguments are passed directly to system commands
If deploying in a production environment:
- Add authentication (API keys, OAuth, etc.)
- Implement input validation and sanitization
- Add rate limiting
- Restrict which tools can be executed
- Run in a restricted Docker network
- Enable logging and monitoring
# Check if Docker is running
docker ps
# Check logs
docker logs kali-mcp-${SESSION_ID}
# Ensure image exists
docker images | grep kali-mcp-server# Verify container is running Kali Linux
docker exec -it kali-mcp-${SESSION_ID} cat /etc/os-release
# Check tool directory
docker exec kali-mcp-${SESSION_ID} ls /usr/bin | head -20# Verify container is running
docker ps | grep kali-mcp
# Check container ports (if using HTTP transport)
docker port kali-mcp-${SESSION_ID}Ensure Docker is installed and accessible in your PATH:
docker --versionThis is a work in progress for internal/testing use only.