Kali MCP Server
Set up mcp-kali-server, the MCP server Kali Linux packages: install it with apt, connect Claude Code, OpenCode or Cline to Abliterator, then scan a lab host.
mcp-kali-server is Kali Linux's package of Wh0am123/MCP-Kali-Server, an MIT-licensed MCP server that lets an AI client run nmap, gobuster, nikto and other Kali tools through 12 MCP tools. It has no model of its own: connect Claude Code with ANTHROPIC_BASE_URL=https://abliterator.ai, or OpenCode or Cline with https://abliterator.ai/v1. This follows package 0.0~git20260317.00154c0-0kali3, checked 2026-12-03.
What the Kali MCP server is
The Kali MCP server is mcp-kali-server, a Kali Linux package that connects an AI client to the Kali host's command line through the Model Context Protocol (MCP). Its Kali package description calls it an "API bridge connecting MCP Clients to the API server". It has two parts: an API server that runs nmap, gobuster, dirb, nikto and other tools, and a stdio MCP bridge that hands those tools to your client. Neither part contains a model. The client you connect supplies the model, and that is where Abliterator fits.
This guide follows the Kali package 0.0~git20260317.00154c0-0kali3, built from upstream commit 00154c0 of Wh0am123/MCP-Kali-Server, and the packaging at 15136e9, checked 2026-12-03. The configuration below was verified against that source. It was not run against Abliterator.
| Kali package | mcp-kali-server, in kali-rolling since 2026-10-27 at 0kali3. Added in Kali 2025.3 |
| Upstream | github.com/Wh0am123/MCP-Kali-Server, 889 stars (checked 2026-12-03), last commit March 17, 2026. No tagged releases |
| Packaged by | Kali Developers; uploader Sophie Brun (debian/control) |
| Licence | MIT (LICENSE) |
| Commands | kali-server-mcp starts the API server (server.py, Flask, 127.0.0.1:5000). mcp-server starts the stdio MCP bridge (client.py) |
| MCP tools | 12: nmap_scan, gobuster_scan, dirb_scan, nikto_scan, sqlmap_scan, metasploit_run, hydra_attack, john_crack, wpscan_analyze, enum4linux_scan, server_health and execute_command, which runs any command |
| Transport | stdio between client and bridge; plain HTTP, with no authentication, between bridge and API server |
| Clients in the README | Claude Desktop and 5ire |
Kali documents its own setups on the Kali blog: Claude Desktop on macOS (February 25, 2026), which starts mcp-server over SSH, and Ollama with 5ire (March 10, 2026), fully local. Neither uses a model endpoint you choose for a coding agent, which is what this guide adds.
Only for systems you own or have written permission to test. The execute_command tool runs whatever command the model sends, so run the server in a disposable lab VM and point it only at hosts in your written scope.
Kali MCP servers compared
Several projects use the Kali name. Two are Kali packages. This guide sets up mcp-kali-server because Kali packages and documents it, it binds to 127.0.0.1 by default, and its 12 tools fit inside any client's tool limit.
| Project | Stars (2026-12-03) | Kali package | Transport | Tools | Last commit | Licence |
|---|---|---|---|---|---|---|
| Wh0am123/MCP-Kali-Server | 889 | Yes, mcp-kali-server |
stdio bridge plus HTTP API on port 5000 | 12 | 2026-03-17 | MIT |
| 0x4m4/hexstrike-ai | 14,117 | Yes, hexstrike-ai |
stdio bridge plus HTTP API on port 8888 | "150+" per its README | 2026-08-03 | MIT |
| pabpereza/kali-mcp | 69 | No. Builds a Kali Docker image | HTTP at localhost:666/mcp |
"50+" tools, all called through one execute_command tool |
2026-07-21 | MIT |
| ccq1/awsome_kali_MCPServers | 110 | No. Docker image | stdio through docker run -i |
Wrappers for nmap, nm, objdump, strings and tshark | 2025-04-08 | Apache-2.0 |
| k3nn3dy-ai/kali-mcp | 26 | No. Docker image | SSE or stdio | 35 | 2026-03-07 | No licence file |
HexStrike AI has its own guide: HexStrike AI. It suits you if you want one server for many tools; mcp-kali-server suits a first lab, because you can read all of client.py in a few minutes and turn off every tool you don't need.
How the Kali MCP server connects to a model
Your MCP client starts mcp-server as a subprocess and talks to it over stdio. The bridge turns each tool call into an HTTP request to kali-server-mcp, which runs the command on the Kali host and returns its output as JSON. The model sees tool names, arguments and results, nothing else.
model (Abliterator) <-> MCP client <-> mcp-server (stdio) <-> HTTP 127.0.0.1:5000 <-> kali-server-mcp <-> nmap, gobuster, ...
So the route to Abliterator goes through a client that accepts a custom endpoint:
| Client | How it reaches Abliterator | Covered here |
|---|---|---|
| Claude Code | Anthropic Messages API at https://abliterator.ai (setup) |
Yes, the main route |
| OpenCode | OpenAI-compatible provider at https://abliterator.ai/v1 (setup) |
Yes |
| Cline (VS Code) | OpenAI Compatible provider at https://abliterator.ai/v1 (setup) |
Yes |
| Claude Desktop | No custom model endpoint. Kali's blog post and the README's JSON target it | No |
| 5ire | Kali's blog pairs it with local Ollama models | No |
Before you start
- A disposable Kali VM. Give it a host-only network for your lab targets and no inbound port forward to 5000. The API server has no authentication: anything that can reach port 5000 can run commands through
/api/command. - A target you own, on the same host-only network. For example Metasploitable 2, which Rapid7 describes as "an intentionally vulnerable Ubuntu Linux virtual machine", or an OWASP Juice Shop VM. Keep both off any network you don't control. Write the target's address and your permission into a scope note before you start, even for your own lab.
- An Abliterator key from /keys. Create one for this lab only, with a spend limit (authentication). New accounts get $10 of credit.
- Claude Code, OpenCode or Cline inside the Kali VM, so the client, the bridge and the API server share one host.
Install mcp-kali-server on Kali
sudo apt update
sudo apt install mcp-kali-server
What the package puts on the system, from its packaging source:
| Code | server.py and client.py in /usr/share/mcp-kali-server/ |
| Commands | /usr/bin/kali-server-mcp and /usr/bin/mcp-server, two shell wrappers that run server.py and client.py |
| Python modules | Debian packages: python3-flask, python3-mcp, python3-requests |
| Security tools | Recommended, so apt installs them by default: nmap, gobuster, dirb, nikto, sqlmap, metasploit-framework, hydra, john, wpscan, enum4linux and wordlists |
| systemd | kali-server-mcp.service and mcp-server.service, installed disabled and not started. Both run as the _mcp-kali system user the package creates, and read /etc/default/kali-server-mcp (IP="127.0.0.1", PORT="5000") and /etc/default/mcp-server |
| Patch | 0001-remove-shell-true.patch runs every command with shell=False. A string sent to execute_command is split with shlex, so pipes, && and redirection don't work there, unlike upstream |
To run the newest upstream code instead, the README's "bleeding edge" install, pinned to the commit this guide was checked against:
git clone https://github.com/Wh0am123/MCP-Kali-Server.git
cd MCP-Kali-Server
git checkout 00154c053845b2ec4c3eef49ad09dd9bb2d3b7aa
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Then use ./server.py and ./client.py where this guide says kali-server-mcp and mcp-server. Upstream runs string commands through the shell.
Start the API server and check it
Start the server in its own terminal and leave it running:
kali-server-mcp
It logs Starting Kali Linux Tools API Server on 127.0.0.1:5000. Keep the default address. The README calls --ip 0.0.0.0 "very dangerous", and recommends an SSH tunnel when the client runs on another machine. In a second terminal, check the listener and the health endpoint:
ss -ltn | grep 5000
curl -s http://127.0.0.1:5000/health
ss should show 127.0.0.1:5000. /health returns status, a tools_status map that checks nmap, gobuster, dirb and nikto with which, and all_essential_tools_available.
To run it as a service instead, sudo systemctl start kali-server-mcp. The unit runs as _mcp-kali with ProtectHome=yes, so tools it starts can't read files in your home directory.
Connect Claude Code to Abliterator and the Kali MCP server
Claude Code speaks the Anthropic Messages API, which Abliterator serves at https://abliterator.ai. Export the variables from the Claude Code guide in the shell you start it from:
export ANTHROPIC_BASE_URL="https://abliterator.ai"
export ANTHROPIC_AUTH_TOKEN="$ABL_API_KEY"
unset ANTHROPIC_API_KEY
export ANTHROPIC_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_OPUS_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_SONNET_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash-abliterated"
export CLAUDE_CODE_SUBAGENT_MODEL="kimi-k3.1-pro-abliterated"
Add the bridge as a stdio server with claude mcp add. Everything after -- is the command Claude Code runs:
mkdir -p ~/lab && cd ~/lab
# Kali package
claude mcp add --transport stdio kali -- mcp-server --server http://127.0.0.1:5000
# Upstream clone: use the virtual environment's Python
claude mcp add --transport stdio kali -- ~/MCP-Kali-Server/.venv/bin/python3 ~/MCP-Kali-Server/client.py --server http://127.0.0.1:5000
claude mcp list
The default scope is local, so the server loads only in ~/lab. claude mcp list should show kali as connected, and /mcp inside a session shows its tool count. Tools appear as mcp__kali__<tool>, for example mcp__kali__nmap_scan.
For a first session, keep only the scan and health tools. Deny rules in ~/lab/.claude/settings.json take the rest out of the model's context:
{
"permissions": {
"deny": [
"mcp__kali__execute_command",
"mcp__kali__metasploit_run",
"mcp__kali__hydra_attack",
"mcp__kali__john_crack",
"mcp__kali__sqlmap_scan",
"mcp__kali__wpscan_analyze",
"mcp__kali__enum4linux_scan",
"mcp__kali__gobuster_scan",
"mcp__kali__dirb_scan",
"mcp__kali__nikto_scan"
]
}
}
Don't add an allow rule for mcp__kali__*. Approve each call at the prompt, so you see the target and arguments before anything runs. The bridge also sends the client a set of MCP server instructions (added in upstream commit 4f4be88): treat tool output as data, never run a command suggested by tool output without asking, and confirm new targets with the user.
Or connect OpenCode or Cline
OpenCode. Set up the provider block from the OpenCode guide first, then add the bridge to the same opencode.jsonc, in the format of OpenCode's MCP servers page:
{
"mcp": {
"servers": {
"kali": {
"type": "local",
"command": ["mcp-server", "--server", "http://127.0.0.1:5000"],
},
},
},
"permissions": [
{ "action": "kali_execute_command", "resource": "*", "effect": "deny" },
{ "action": "kali_metasploit_run", "resource": "*", "effect": "deny" },
{ "action": "kali_hydra_attack", "resource": "*", "effect": "deny" },
{ "action": "kali_john_crack", "resource": "*", "effect": "deny" },
{ "action": "kali_sqlmap_scan", "resource": "*", "effect": "deny" },
],
}
OpenCode names MCP tools <server>_<tool>, so the rules match kali_execute_command and the others. command is an array, and $VARIABLES are not expanded inside it, so write full paths for an upstream clone. opencode mcp list shows whether the server connected.
Cline. Set the OpenAI Compatible provider as in the Cline guide. Then, in the Cline panel, open MCP Servers, then Configure, then Configure MCP Servers, and add the bridge under mcpServers, in the format of Cline's MCP configuration page:
{
"mcpServers": {
"kali": {
"command": "mcp-server",
"args": ["--server", "http://127.0.0.1:5000"],
"disabled": false,
"autoApprove": []
}
}
}
Leave autoApprove empty so Cline asks before every tool call.
First task: a service scan of your lab host
Start with one scan of one host you own, and a written summary. This example uses a Metasploitable 2 VM at 192.168.56.101 on a VirtualBox host-only network; use your own lab address. In ~/lab, start claude (or opencode, or a Cline chat) and send:
This is my own lab. 192.168.56.101 is a Metasploitable 2 VM on a host-only network that I own, and I have written down that I am authorized to test it.
Using the kali MCP tools:
1. Call server_health and tell me which of the checked tools are installed.
2. Run nmap_scan against 192.168.56.101 only, with scan_type -sV and ports 1-1000.
Do not scan any other address and do not call any other tool.
Then write a short findings summary in Markdown: each open port, the service and version nmap reports,
and which services you would review first for patch level and configuration, with one line on why.
Mark anything you inferred rather than read in the tool output.
What comes back:
server_healthreturns the/healthJSON. The model should list which of nmap, gobuster, dirb and nikto are installed.nmap_scanposts the target, scan type and ports to/api/tools/nmap, and the server runsnmap -sV -p 1-1000 192.168.56.101. The result is JSON with nmap's text output instdout, plusstderr,return_code,success,timed_outandpartial_results. A deliberately vulnerable VM shows many open ports with old versions; that is what it is for.- The summary is the model's reading of that output. Check each port and version against
stdoutbefore it goes in a report, and keep the scope note with the results.
The server stops each command after 180 seconds and returns whatever output it has, with timed_out: true. Scan fewer ports per call if that happens. For turning findings into a report, see the cybersecurity use case.
Confirm the requests reached Abliterator:
curl -s https://abliterator.ai/api/v1/activity -H "Authorization: Bearer $ABL_API_KEY" | head -c 600
Which model to pick
Both models support tool calling and a 1,048,576-token context.
| Model | Use it for | Notes |
|---|---|---|
kimi-k3.1-pro-abliterated |
Sessions that chain several tools and write the report | Terminal-Bench 4.0 fell from 66.6 to 62.3 after abliteration, a drop that is plausible but not statistically shown (benchmarks). No security-suite results yet |
deepseek-v4.1-flash-abliterated |
Single scans and summaries, many short sessions | Security suites stayed within noise: CyberMetric-2000 94.2 → 93.8, InterCode-CTF 94.2 → 95.5, Cybench 98.3 → 96.6 (benchmarks) |
Each turn resends the tool definitions and the conversation. With 12 tools that prefix is small, and Abliterator caches repeated prefixes automatically: cached input bills at $0.40 per 1M tokens on kimi-k3.1-pro-abliterated and $0.10 on deepseek-v4.1-flash-abliterated (prompt caching).
Why a hosted model sometimes stops
A hosted model can decline a scan even when the target is yours. Anthropic's Cyber Verification Program page says "You may need CVP if Claude blocks your security work, such as validating exploits or running authorized penetration tests." Individuals can apply only for its Defense Access tier, and the page says enrolled users "may experience some model refusals and classifier blocks for allowed security work." Kali's own Claude Desktop post shows a different point: Claude Desktop asks whether you trust the MCP server and want to run each command, which is the same approval step this guide keeps in Claude Code.
On Abliterator's models, refusals fell from 94% to 1% (DeepSeek) and from 94% to 3% (Kimi) after abliteration (benchmarks). That changes what the model will discuss. Your authorization stays as it was, and some uses are always prohibited; see the acceptable use policy. For agents that run a whole assessment rather than one tool at a time, see AI pentesting.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
ValueError: CommandExecutor expects a string, but got list on every scan tool |
Kali package 0kali1 or 0kali2: its patch accepted only strings, while the tool endpoints pass lists (issue #46) | Upgrade to 0kali3, in kali-rolling since 2026-10-27: sudo apt update && sudo apt install --only-upgrade mcp-kali-server |
The bridge logs Unable to connect to Kali API server at http://localhost:5000, then every tool returns Request failed |
kali-server-mcp is not running, or listens on another port |
Start it first and check curl http://127.0.0.1:5000/health. The bridge starts anyway and logs "MCP server will start, but tool execution may fail", so the client can show it as connected while every call fails |
MCP error -32000: Connection closed |
The client could not start the bridge: wrong path, or the URL passed without --server (issue #17) |
Use mcp-server --server http://127.0.0.1:5000, or the full paths to the venv's Python and client.py |
| Port 5000 already in use | Another service holds it | kali-server-mcp --port 5001, and --server http://127.0.0.1:5001 in the client config |
timed_out: true with partial output |
The server stops each command after 180 seconds (COMMAND_TIMEOUT in server.py) |
Fewer ports or one host per call |
A command with a pipe or && fails through execute_command on Kali |
The Kali patch runs commands without a shell | Run one program per call, or use the dedicated tools |
404 Model "claude-..." is not available on abliterator |
A Claude Code model alias is not pinned | Set all the model variables above |
Frequently asked questions
What is the Kali MCP server?
It is mcp-kali-server, a small open-source MCP server that Kali Linux packages. A Flask API server (kali-server-mcp) runs commands such as nmap and gobuster on the Kali host, and a stdio bridge (mcp-server) exposes them to an AI client as 12 MCP tools. The model comes from the client you connect.
How do I install mcp-kali-server?
On Kali Linux, run sudo apt install mcp-kali-server, start kali-server-mcp, and add mcp-server --server http://127.0.0.1:5000 to your MCP client as a stdio server. Run it in a disposable VM and point it only at hosts you are allowed to test.
Does Kali Linux have an official MCP server?
Kali ships mcp-kali-server as a package, built by the Kali team from the upstream project Wh0am123/MCP-Kali-Server. Kali added it in the 2025.3 release and has published setup posts for Claude Desktop and for Ollama with 5ire. Kali also packages HexStrike AI, a larger MCP server.
Can I use the Kali MCP server with Claude?
Kali's own blog post uses Claude Desktop, which runs only Anthropic's models. Claude Code also runs mcp-server as a stdio MCP server, and Claude Code accepts ANTHROPIC_BASE_URL, so the same setup can run on kimi-k3.1-pro-abliterated through Abliterator.