Kali-Mcp-Toolkit MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install .
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add kali-mcp-toolkit -- node "<FULL_PATH_TO_KALI_MCP_TOOLKIT>/dist/index.js"

Replace <FULL_PATH_TO_KALI_MCP_TOOLKIT>/dist/index.js with the actual folder you prepared in step 1.

README.md

Expose 500+ Kali Linux security tools to AI for automated penetration testing.

Kali-Mcp-Toolkit — Kali Linux MCP Server

将 Kali Linux 500+ 安全工具通过 Model Context Protocol 暴露给 AI 模型,实现 AI 驱动的渗透测试与安全审计


核心能力

模块 功能 关键特性
Tool Engine 执行 Kali 工具 60+ 工具目录、12 大分类、风险分级、输出解析
Terminal Manager 交互式终端 PTY 会话、异步读写、正则等待、反弹 Shell 监听
CodeForge 代码编辑/执行 12 种语言、沙箱工作区、依赖安装
Resources MCP 资源暴露 系统信息、工具目录、网络接口、工作区文件
Prompts 工作流模板 信息收集、Web 渗透、内网渗透、CTF、应急响应

系统架构

┌─────────────────────────────────────────────────┐
│                   AI Client                      │
│         (Claude / Warp / 自定义客户端)            │
└───────────────┬─────────────────────────────────┘
                │  MCP Protocol (stdio / HTTP)
┌───────────────▼─────────────────────────────────┐
│               KaliMcp Server                     │
│  ┌──────────┐ ┌───────────┐ ┌────────────────┐  │
│  │ Auth     │ │ Sanitizer │ │ Rate Limiter   │  │
│  │ (JWT/Key)│ │ (输入过滤) │ │ (速率限制)     │  │
│  └────┬─────┘ └─────┬─────┘ └───────┬────────┘  │
│       └─────────────┼───────────────┘            │
│  ┌──────────────────▼──────────────────────────┐ │
│  │              Tool Engine                     │ │
│  │  exec_tool · list_kali_tools · tool_help    │ │
│  └──────────────────┬──────────────────────────┘ │
│  ┌──────────┐ ┌─────▼─────┐ ┌────────────────┐  │
│  │ Terminal  │ │  Process  │ │   CodeForge    │  │
│  │ Manager  │ │  Executor │ │   Editor/Exec  │  │
│  └──────────┘ └───────────┘ └────────────────┘  │
│  ┌──────────────────────────────────────────────┐│
│  │          Audit Logger (JSON Lines)           ││
│  └──────────────────────────────────────────────┘│
└──────────────────────────────────────────────────┘

技术栈

  • Python 3.11+ — 类型注解、asyncio
  • FastMCP — MCP 协议服务端框架
  • Pydantic v2 — 配置校验与数据模型
  • uvicorn — HTTP 传输层
  • pty + asyncio — 伪终端异步会话
  • PyJWT — JWT 认证
  • PyYAML / aiofiles — 配置加载与异步文件 I/O

项目结构

KaliMcp/
├── pyproject.toml                  # 构建配置 & 依赖
├── config/
│   ├── default.yaml                # 默认配置文件
│   └── tools_catalog.yaml          # Kali 工具目录 (60+ 工具 × 12 分类)
├── src/kalimcp/
│   ├── __init__.py                 # 版本号
│   ├── config.py                   # Pydantic v2 配置模型 + YAML 加载 + 环境变量覆盖
│   ├── auth.py                     # API Key / JWT 认证、作用域、速率限制
│   ├── server.py                   # FastMCP 组装、所有 MCP 工具/资源/提示注册、CLI
│   ├── tools/
│   │   ├── __init__.py             # KaliToolInfo / ToolCatalog 数据模型
│   │   ├── tool_engine.py          # exec_tool / list_kali_tools / tool_help 核心引擎
│   │   ├── recon.py                # 信息收集 (nmap, whois, dig)
│   │   ├── vuln.py                 # 漏洞扫描 (nikto, openvas)
│   │   ├── webapp.py               # Web 渗透 (sqlmap, gobuster, ffuf, whatweb)
│   │   ├── password.py             # 密码攻击 (hydra, john, hashcat)
│   │   ├── exploit.py              # 漏洞利用 (msfconsole, searchsploit)
│   │   ├── wireless.py             # 无线攻击 (aircrack-ng)
│   │   ├── sniff.py                # 嗅探/欺骗 (tcpdump, wireshark)
│   │   ├── post_exploit.py         # 后渗透 (mimikatz, empire)
│   │   ├── forensic.py             # 取证分析 (volatility, autopsy)
│   │   ├── social.py               # 社会工程 (setoolkit)
│   │   ├── crypto.py               # 密码学 (openssl, gpg)
│   │   └── reverse.py              # 逆向工程 (ghidra, radare2)
│   ├── terminal/
│   │   ├── ansi.py                 # ANSI 转义码清理
│   │   ├── pty_session.py          # PTY 伪终端会话 (RingBuffer)
│   │   ├── manager.py              # 多会话生命周期管理 + 超时回收
│   │   └── listener.py             # 反弹 Shell 监听器 (默认关闭)
│   ├── codeforge/
│   │   ├── workspace.py            # 路径安全 (符号链接解析、大小限制)
│   │   ├── editor.py               # 文件创建 / 编辑 (search-replace) / 读取
│   │   └── executor.py             # 代码执行 (12 种语言) + 依赖安装
│   ├── utils/
│   │   ├── audit.py                # 异步 JSON Lines 审计日志 + 按大小轮转
│   │   ├── sanitizer.py            # 白名单、Shell 元字符防御、路径穿越防护
│   │   ├── process.py              # 异步子进程 (信号量并发、超时 SIGTERM→SIGKILL)
│   │   └── parser.py               # nmap XML 解析、格式自动检测、输出截断
│   ├── resources/
│   │   └── system.py               # MCP Resources (系统信息、工具目录、网络接口)
│   └── prompts/
│       └── workflows.py            # 6 个中文渗透测试工作流模板
├── tests/
│   ├── conftest.py                 # pytest fixtures
│   ├── test_security.py            # 安全测试 (17 cases)
│   ├── test_tool_engine.py         # 工具引擎测试 (11 cases)
│   ├── test_terminal.py            # 终端测试 (9 cases)
│   └── test_codeforge.py           # CodeForge 测试 (7 cases)
├── deploy/
│   └── kalimcp.service             # systemd 服务文件
└── scripts/
    └── install.sh                  # 一键部署脚本

快速开始

环境要求

  • Kali Linux (或任何已安装 Kali 工具的 L

Tools (3)

exec_toolExecutes a specific Kali Linux security tool from the catalog.
list_kali_toolsLists all available Kali Linux tools categorized by security domain.
tool_helpProvides help documentation for a specific Kali tool.

Environment Variables

KALI_MCP_API_KEYAPI key for authenticating requests to the server.

Configuration

claude_desktop_config.json
{"mcpServers": {"kali-mcp": {"command": "python", "args": ["-m", "kalimcp"]}}}

Try it

List all available web penetration testing tools in the catalog.
Run nmap on 192.168.1.1 and provide a summary of open ports.
Help me perform a vulnerability scan using nikto on the target domain.
Show me the help documentation for sqlmap.
Execute a searchsploit query to find exploits for the identified service version.

Frequently Asked Questions

What are the key features of Kali-Mcp-Toolkit?

Access to 500+ Kali Linux security tools across 12 categories.. Interactive terminal management with PTY session support.. CodeForge sandbox for multi-language code editing and execution.. MCP resource exposure for system info, network interfaces, and workspace files.. Pre-built workflow templates for information gathering, web penetration, and CTF..

What can I use Kali-Mcp-Toolkit for?

Automated reconnaissance and information gathering during security audits.. Streamlining web application penetration testing workflows.. Assisting in CTF challenges by automating tool execution and output parsing.. Performing post-exploitation tasks in a controlled, audited environment..

How do I install Kali-Mcp-Toolkit?

Install Kali-Mcp-Toolkit by running: pip install .

What MCP clients work with Kali-Mcp-Toolkit?

Kali-Mcp-Toolkit works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Kali-Mcp-Toolkit docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare