Kali Linux MCP Server: Setup, Scope, and Access Controls

Connecting an AI assistant to Kali Linux tools over MCP makes sense for authorized security testing, where the assistant can run commands and reason over output within an approved scope. Here is how to set up the connection, define command-access boundaries, and use fenbs to keep the approved scope, sanitized findings, and remediation handoffs.

Updated 4 min read

Connecting an AI assistant to a Kali Linux environment over MCP lets the assistant run shell commands and reason over their output within a defined scope. For authorized penetration testing and security research, this means the assistant can execute a reconnaissance command, read the result, and suggest the next step rather than requiring you to copy output manually into a chat window. Tools like fenbs keep the approved testing scope, sanitized findings, and remediation handoffs in one shared place without carrying raw vulnerability details that belong in your engagement management system.

Kali Linux is a Debian-based distribution maintained by Offensive Security, designed for penetration testing and security research. An MCP connection to a Kali environment is only appropriate for systems you are authorized to test. Confirm the scope in writing before any assistant-assisted testing begins.

How a shell MCP server works on Kali

A shell MCP server wraps command execution as a named tool. The assistant calls the tool with a command string; the server runs it in a shell and returns the output. In a Kali environment, those commands can include any tool installed on the system, from nmap to nikto to custom scripts.

The server runs with the permissions of the user account that starts it. On Kali, many tools require root or sudo. Before running a shell MCP server as root, consider the consequence of a command executing unexpectedly. A misconfigured prompt or a misunderstood instruction can result in commands that were not intended. Start with a lower-privilege account and escalate only for the specific tools that require it.

Defining command-access boundaries

An unrestricted shell MCP server lets the assistant run any command the account can run. That is rarely the right starting point. A scoped server that exposes specific tools or limits execution to a named directory reduces the blast radius of an unexpected command.

  • Allow list: specify which commands or tools the server will execute and block everything else.
  • Network scope: confirm the target IP ranges or hostnames before the assistant runs any network tool.
  • Output handling: decide whether the server returns raw output, truncated output, or a summary for large results.
  • Destructive commands: explicitly block or require human confirmation for commands that modify files, change configurations, or create network traffic outside the test scope.

Record the command-access boundaries as standing rules before connecting an assistant to any testing environment. Those rules should name the authorized targets, the approved tools, and any commands that require a person to confirm before the assistant runs them.

Review the allow list before each engagement because authorized targets and tools often differ between engagements. A configuration written for one client should not carry over automatically to the next. Make the scope review part of the setup step, not an afterthought, so the assistant starts every session with the correct current boundaries.

Keeping the scope current and visible

Penetration test scopes change during an engagement: additional hosts are added, certain paths are declared out of scope, or the client extends the test window. Every assistant session needs to start from the current scope, not the scope as it was at the beginning of the engagement.

A shared scope record that the assistant reads at the start of each session prevents it from running tools against targets added to the out-of-scope list after the initial briefing. The record also shows the authorized testing period, which is as important as the authorized targets.

How fenbs helps

Keep the authorized scope where every session starts

fenbs keeps Decisions and rules in a place every connected AI assistant reads before starting. Record the authorized targets, the approved tool list, the out-of-scope paths, and the testing period. A rule recorded once reaches every session without relying on the engineer to re-explain the scope at the start of each chat.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

Handing off findings without copying evidence

Penetration test findings need to reach a remediation report, but the raw output from testing tools is not the same as a finding. Vulnerability details, proof-of-concept output, and evidence artifacts belong in your engagement platform, not in a general-purpose AI context record.

Write the handoff at a structural level: which hosts were assessed, which finding categories were identified, what the recommended remediation steps are, and what remains to be tested. Reference the engagement ID for the detailed evidence. A colleague reading the handoff can continue the work without the full evidence trail in the shared record.

See mcp-server-configuration for general guidance on running MCP servers securely, and mcp-server-hosting for network isolation considerations when the server runs on a test host.

How to do this with fenbs

  1. Create a free account and set up a project for the authorized testing engagement.
  2. Record the authorized scope as Decisions and rules before any assistant-assisted testing begins: the target systems, the approved tool categories, the testing period, and the commands that require human confirmation.
  3. Connect your AI assistant over MCP from Integrations. At the start of each session, ask it to read the project context and confirm the current scope before running any tools.
  4. After each session, save where the testing stands: which hosts were assessed, which findings were identified at a category level, and what remains. Use the engagement platform for detailed evidence.
  5. At engagement close, add a sanitized handoff note with the finding categories, recommended remediation priorities, and the next steps for the client team.

Questions people ask.

Should a Kali Linux MCP server run as root?

Start with the lowest-privilege account that covers the tools you need. Many Kali tools require elevated privileges for certain operations; use sudo for specific commands rather than running the server as root. An unexpected command running as root has far greater consequences than one running as a standard user.

How do I prevent the assistant from running commands outside the test scope?

Use an allow list in the MCP server configuration that restricts execution to approved commands or tools. Record the authorized target IP ranges and hostnames as standing rules the assistant reads before each session. Review its proposed commands before execution for any that target systems outside the scope.

Can I use an AI assistant for fully automated penetration testing?

Not without human oversight for each significant action. Automated execution of testing tools against systems requires a person to review the scope, confirm each stage, and assess the results. The assistant accelerates the work; the tester makes the decisions about what to run and what the findings mean.

What should I keep out of a shared AI context record during a penetration test?

Keep raw tool output, proof-of-concept code, credential samples, and vulnerability evidence in your engagement platform. The shared record holds the scope, the finding categories, the remediation recommendations, and the handoff state. Reference the engagement ID for the detailed evidence.

Does running an MCP server on Kali require any special network configuration?

A local stdio MCP server runs only on the test machine and does not expose a network port by default. If you need a remote connection from a separate machine, use a network-isolated environment and authenticate the connection. Never expose a shell MCP server to an untrusted network.

More in Connect your AI tools

All Connect your AI tools articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.