Kali MCP server with PentestLLM
The Kali MCP server is mcp-kali-server, a package in Kali Linux that lets an MCP client run commands on a Kali machine. Install it with apt, start its API server, add its bridge to your agent as a local MCP server, and point that agent at PentestLLM so a security-tuned model drives it.
sudo apt install mcp-kali-server
Steps
Install the package on Kali
On the Kali machine you are authorized to test from, install the package from Kali’s repositories. Kali’s tool page lists two programs in it:
kali-server-mcp, the API server that executes commands, andmcp-server, the bridge an MCP client talks to.shell (Kali) sudo apt install mcp-kali-serverStart the API server on localhost
Run the API server. By default it binds to 127.0.0.1 on port 5000, which keeps it reachable only from the machine itself. Leave it that way: anything that can reach this port can run commands on the machine.
shell (Kali) kali-server-mcpPoint an agent at PentestLLM
Set up an MCP-capable agent on a security model first. This guide uses OpenCode; follow the OpenCode guide so that
opencodestarts on the PentestLLM provider.Add the bridge as a local MCP server
Register
mcp-serverwith the agent. In OpenCode, either run themcp addcommand or write the server undermcp.serversinopencode.jsonc. The bridge’s default server URL is the local API server from the previous step. Settingcodemodeto false exposes each Kali tool as a direct tool call, so the permission rule below applies to every one of them.opencode.jsonc { "$schema": "https://opencode.ai/config.json", "mcp": { "servers": { "kali": { "type": "local", "command": ["mcp-server", "--server", "http://127.0.0.1:5000"], "codemode": false } } }, "permissions": [ { "action": "kali_*", "resource": "*", "effect": "ask" } ] }Check the connection
List the agent’s MCP servers and confirm the Kali server shows as connected. Then start a session and ask the model what tools it has; nothing runs until you approve a call.
shell opencode mcp list
What the package is
Kali’s tool page, read on 11 November 2026, describes mcp-kali-server as an API bridge that connects MCP clients to an API server which executes commands in a Linux terminal, so that a model can run tools and interact with web applications during AI-assisted testing and CTF work. The upstream project’s README lists wrappers for common Kali tools such as Nmap, Gobuster and Nikto, plus raw command execution.
It is the missing hand for a model: the model decides, the bridge executes, and the output comes back as the next message. That is powerful and it is exactly why the approval setting below matters.
Flags of the two programs
kali-server-mcp --ip- The address the API server binds to. Default 127.0.0.1, localhost only.
kali-server-mcp --port- The API server’s port. Default 5000.
mcp-server --server- The API server URL the bridge calls. Default
http://localhost:5000. mcp-server --timeout- Request timeout in seconds. Default 300.
--debug- Verbose logging, on either program.
When the agent is on another machine
If the agent runs on your laptop and Kali is a VM or a remote box, do not expose the API server to the network. The upstream README recommends an SSH tunnel and calls binding to all interfaces very dangerous. Forward the port, then run the bridge on the laptop against the forwarded address.
ssh -L 5000:localhost:5000 user@KALI_IPWhy the model choice matters here
An MCP tool loop is a chain of small decisions, and a general model often declines one of them, which ends the run. The security builds on PentestLLM are tuned or abliterated to answer security questions other models decline, so the loop keeps going. Refusals are reduced, not removed.
Use a build that takes tool calls; the router id auto/security only picks builds that can take what the request carries, and sends turns with tools to the balanced or frontier tier. Each turn re-sends earlier tool output, so input price drives the cost; the live prices are in the table below.
Approval and authorization
The permissions rule in the config makes every tool call from the Kali server wait for your approval. Keep it. Read each proposed command, check the target against your scope, and decline anything outside it. Put the scope and rules of engagement in the agent’s instructions so proposals start inside the lines.
This setup executes real commands. Use it only against systems you own or have written permission to test, from a machine you control. PentestLLM’s acceptable use policy applies to every request, and the upstream project carries its own notice that it is for educational and ethical testing only.
9 security builds, priced per token
Read from the live catalog on 2026-11-11. Prices are US dollars per million tokens, paid from a prepaid balance that starts at $10. The id auto/security has no price of its own: each request is billed at the build that answered.
| Build | Input | Output | Context |
|---|---|---|---|
| Qwen3.8 27B Cybersecurity | $0.40 | $2.40 | 262,144 |
| Gemma 4 26B A4B Cybersecurity | $0.4224 | $1.3376 | 262,144 |
| GLM-5.3 Flash Cybersecurity | $0.5093 | $1.6975 | 1,048,576 |
| Red Team (Flash) | $0.90 | $3.00 | not published |
| Red Team (Pro) | $1.50 | $6.00 | not published |
| OrcaCyber MiniMax M3.1 Flash | $2.00 | $4.00 | 261,632 |
| OrcaCyber Qwen3.8 Flash Next | $2.00 | $4.00 | 261,632 |
| Cyber Frontier | $5.25 | $15.75 | 1,048,576 |
| OrcaCyber Zero 1.5 | $7.50 | $18.75 | 999,488 |
Questions
mcp-kali-server, a Kali Linux package that connects MCP clients to an API server which executes terminal commands on the Kali machine, so a language model can run tools during authorized testing.
Run sudo apt install mcp-kali-server on Kali. Start the API server with kali-server-mcp and register the mcp-server bridge with your MCP client.
The API server listens on 127.0.0.1 port 5000 by default, and the bridge calls http://localhost:5000 unless you pass --server.
Any client that can start a local MCP server over stdio. Kali’s page names Claude Desktop and 5ire as examples; this guide uses OpenCode because it also takes a custom model endpoint.
Only with every call approved by you, the API server bound to localhost, and a target you are authorized to test. Treat it like handing a colleague your keyboard: watch what is typed.
The package is free. Model usage is billed per token; on 2026-11-11 input prices for security builds start at $0.40 per million tokens.
Read next
- All agent guidesThe same three values in every supported client.
- OpenCodeThe opencode.json provider block for the security builds.
- Kali GPT alternativeSecurity models in the terminal agents you already run on Kali.
- Red teamModels for authorized adversary emulation: planning, tooling review, detection notes and reporting.
- CTFModels that reason through web, crypto, reversing, forensics and pwn challenge categories.
Facts about other products and tools on this page were read from their own pages on 11 November 2026: Kali Linux tools: mcp-kali-server, MCP-Kali-Server README, OpenCode docs: MCP servers, OpenCode docs: Permissions. They change; check the source before relying on a figure.
One key, from $10
PentestLLM is for systems you own or have written permission to test. The acceptable use policy says what is not allowed.
- Input, 8,000 tokens at $0.40 per million
- $0.0032
- Output, 1,000 tokens at $2.40 per million
- $0.0024
- One turn
- $0.0056
- 1,000 turns
- $5.60