Логотип MCP Kali Server

MCP Kali Server

Спільнота
TriV3

Automates Kali Linux pentesting with MCP: programmatic access to popular tools, SSH and reverse shell management, file operations, and Docker test mode. Perfect for CTFs, security research, and automated reporting.

ВидавецьTriV3
РепозиторійMCP-Kali-Server
МоваPython
Форки
19
Зірки
38
Доступні інструменти
0
Тип транспортуstdio
Категорії
ЛіцензіяMIT
Посилання
  • Підключайте інструменти до робочих процесів із ШІ

    MCP Kali Server надає можливості MCP, які можуть використовувати сумісні клієнтські ШІ-застосунки та агенти.

  • Доступні інструменти: 0

    Перегляньте нижче дії, які можна викликати, з назвами й описами, якщо сервер їх надає.

  • Готова конфігурація для копіювання

    Скористайтеся прикладами конфігурації, щоб налаштувати цей сервер у вибраному клієнті MCP.

  • Показники інтересу до відкритого коду

    Зірки: 38, форки: 19 — у пов’язаному репозиторії.

MCP Kali Server

License: MIT Version: v0.2.1

MCP Kali Server Architecture

A comprehensive Model Context Protocol (MCP) server for penetration testing and cybersecurity operations, providing seamless integration between Kali Linux tools and MCP-compatible clients.

🎥 Demo Video

Automating Kali Linux with an MCP (Model Context Protocol) — HTB Demo

In this video, I showcase how my MCP automates a Kali Linux workflow inside WSL2 and assists with solving a Hack The Box challenge — from enumeration to exploitation to auto-generated documentation.

Watch the demo on YouTube


🚀 Overview

This project provides a powerful MCP server that enables secure, programmatic access to Kali Linux penetration testing tools through a standardized interface. It includes advanced features like reverse shell management, SSH session handling, and comprehensive file operations with integrity verification.

🏗️ Architecture

This project is designed to work across different environments:

1. Kali Server (kali-server/)

Runs on Kali Linux only - The core server application that provides the actual penetration testing capabilities.

kali-server/
├── api/           # REST API routes and endpoints
├── core/          # Core functionality (SSH, reverse shells, config, Docker)
├── tools/         # Penetration testing tools integration
└── utils/         # Utility functions and file operations

Features:

  • Docker test mode (--test option) - automatically manages test containers
  • All penetration testing tools (nmap, gobuster, etc.)
  • SSH and reverse shell session management
  • File operations with integrity verification

2. MCP Server (mcp-server/)

Can run on any system - The Model Context Protocol server that provides a standardized interface for MCP clients.

mcp-server/
└── mcp_server.py  # MCP protocol implementation

Note: The MCP server communicates with the Kali server via HTTP, so they can be on different systems.

Deployment Architecture

┌─────────────────┐    HTTP     ┌──────────────────┐    HTTP     ┌──────────────────┐
│   MCP Client    │ ◄─────────► │   MCP Server     │ ◄─────────► │   Kali Server    │
│  (Any system)   │             │  (Any system)    │             │  (Kali Linux)    │
└─────────────────┘             └──────────────────┘             │                  │
                                                                  │ ┌──────────────┐ │
                                                                  │ │   Docker     │ │
                                                                  │ │ (test mode)  │ │
                                                                  │ └──────────────┘ │
                                                                  └──────────────────┘

✨ Key Features

🔧 Penetration Testing Tools

  • Nmap: Network discovery and security auditing
  • Gobuster: Directory/file enumeration
  • Dirb: Web content scanner
  • Nikto: Web server scanner
  • Hydra: Network logon cracker
  • SQLmap: SQL injection testing
  • WPScan: WordPress security scanner
  • John the Ripper: Password cracking
  • Enum4linux: SMB enumeration
  • Metasploit: Exploitation framework

🐚 Advanced Session Management

  • SSH Session Manager: Complete SSH session lifecycle management
    • start_ssh_session: Establish secure SSH connections
    • execute_ssh_command: Run commands in SSH sessions
    • get_ssh_status: Monitor SSH session status
    • stop_ssh_session: Cleanly terminate SSH sessions
    • list_ssh_sessions: View all active SSH sessions
  • Reverse Shell Manager: Multi-session reverse shell handling
    • start_reverse_shell_listener: Start listening for reverse shells
    • execute_shell_command: Execute commands in reverse shells
    • trigger_reverse_shell_action: Non-blocking trigger execution for payloads
    • get_shell_status: Monitor reverse shell session status
    • stop_reverse_shell: Terminate reverse shell sessions
    • list_reverse_shell_sessions: View all active reverse shell sessions

📁 Comprehensive File Operations

  • Kali Server File Management:
    • upload_to_kali: Upload files directly to Kali server
    • download_from_kali: Download files from Kali server
  • SSH File Transfer (optimized for large files):
    • ssh_upload_content: Upload content via SSH with auto-optimization
    • ssh_download_content: Download content via SSH with chunking
    • ssh_estimate_transfer_time: Estimate transfer times and get recommendations
  • Reverse Shell File Transfer:
    • reverse_shell_upload_file: Upload files via reverse shell
    • reverse_shell_upload_content: Upload content via reverse shell
    • reverse_shell_download_file: Download files via reverse shell
    • reverse_shell_download_content: Download content via reverse shell

🛠️ System Integration

  • Command Execution: Direct command execution on Kali server
  • Health Monitoring: Server health checks and status monitoring
  • Session Persistence: Maintain multiple concurrent sessions

🔒 Security Features

  • Data Integrity: SHA256 checksum verification for all file transfers
  • Secure Communications: Encrypted SSH connections
  • Session Isolation: Independent session management
  • Error Handling: Comprehensive error detection and reporting

📊 Performance Optimization

  • Chunked Transfers: Optimized for large file operations
  • Automatic Method Selection: Smart selection based on file size
  • Background Processing: Non-blocking operations for long-running tasks
  • Resource Management: Efficient memory and CPU usage

🛠️ Installation

See install.md for detailed installation instructions.

MCP Client Configuration

After installation, configure your MCP client to connect to the Kali server:

📖 Configuration Guide

This guide covers:

  • Setting up .claude/mcp_settings.json for Claude Desktop
  • Configuring alternative MCP clients
  • Finding your Python path and Kali IP address
  • Platform-specific examples (Windows, Linux, macOS)

WSL Network Configuration

If you're running Kali Linux in WSL 2, proper network configuration is critical for the MCP server to function. See our comprehensive guide:

📖 WSL Network Configuration Guide

This guide covers:

  • Essential WSL configuration (wsl.conf)
  • DNS resolution setup for Kali tools
  • Critical: Understanding WSL 2 localhost behavior (Windows → Kali communication)
  • Network testing and troubleshooting

⚠️ Important: The MCP client on Windows must be able to access the Kali server via localhost. Review this guide before running the server.

Dependency Split

This project now separates Python dependencies for the two runtime components:

  • requirements.kali.txt – Only what the Kali API server Python code needs (Flask, etc.)
  • requirements.mcp.txt – Dependencies for the MCP server client interface (requests, FastMCP, test libs)
  • requirements.txt – Informational file describing the split; contains no direct packages now.

Install on each machine as appropriate:

pip install -r requirements.kali.txt   # On Kali host running kali-server/
pip install -r requirements.mcp.txt    # On host running mcp-server/

⚠️ Security Warning

IMPORTANT: Be extremely cautious when running the Kali server with sudo privileges:

bash
# ⚠️ DANGEROUS - Avoid if possible
sudo python kali_server.py

Why this is risky:

  • The entire server runs with root privileges
  • All API endpoints and commands execute with full system access
  • Any compromise of the server grants complete root access to the system
  • No privilege separation or access control

Safer alternatives:

  • Run the server as a regular user (many tools work without root)
  • Use specific sudo permissions only for commands that require them
  • Consider containerization or virtualization for isolation
  • Implement privilege escalation only when absolutely necessary

For production environments: Please see TODO.md for planned security enhancements including granular privilege management and access controls.

📖 Usage

See usage.md for detailed usage instructions and examples.

🧪 Testing

The project includes comprehensive test suites using Docker containers for isolated testing environments.

Run All Tests

bash
cd tests
./run_all.bat  # Windows
# or
chmod +x run_all.sh && ./run_all.sh  # Linux

Docker Testing Environment

bash
cd tests/docker
docker-compose up -d --build
python test_config_docker.py

SSH Manager Tests

bash
cd tests/kali
python -m pytest test_ssh_manager.py -v

Test Configuration

Tests use Docker containers for consistent and isolated testing environments. The configuration is automatically set up in:

  • tests/kali/test_config.py - Main test configuration (Docker-based)
  • tests/docker/test_config_docker.py - Docker-specific test configuration

📋 Available MCP Tools

The MCP server provides the following tools:

ToolDescription
mcp_kali_mcp_nmap_scanNetwork scanning and enumeration
mcp_kali_mcp_gobuster_scanDirectory and file enumeration
mcp_kali_mcp_hydra_attackPassword brute forcing
mcp_kali_mcp_start_ssh_sessionSSH session management
mcp_kali_mcp_execute_ssh_commandSSH command execution
mcp_kali_mcp_ssh_upload_contentFile upload via SSH
mcp_kali_mcp_ssh_download_contentFile download via SSH
mcp_kali_mcp_start_reverse_shell_listenerReverse shell management
mcp_kali_mcp_generate_reverse_shell_payloadPayload generation

🔍 File Operations

Upload with Integrity Verification

python
# The system automatically verifies file integrity using SHA256 checksums
upload_result = {
    "success": True,
    "source_checksum": "abc123...",
    "remote_checksum": "abc123...",
    "checksum_verified": True,
    "integrity_check": "PASSED"
}

Download with Integrity Verification

python
# All downloads include automatic integrity verification
download_result = {
    "success": True,
    "remote_checksum": "def456...",
    "local_checksum": "def456...",
    "checksum_verified": True,
    "integrity_check": "PASSED"
}

🚨 Security Considerations

  • Testing Environment: All tests use isolated Docker containers for security
  • Network Security: Ensure proper firewall configuration
  • Authentication: Use strong passwords and key-based authentication
  • Session Management: Regularly clean up unused sessions
  • File Permissions: Set appropriate file permissions on uploaded files
  • Logging: Monitor all activities through comprehensive logging

🐛 Troubleshooting

Common Issues

  1. Connection Refused

    bash
    # Check if server is running
    curl http://localhost:5000/health
  2. SSH Connection Failed

    bash
    # Verify SSH connectivity
    ssh user@target-host
  3. Tool Not Found

    bash
    # Install missing tools
    sudo apt update && sudo apt install nmap gobuster
  4. Docker Test Mode Issues

    If you encounter Docker-related errors when using --test mode on Kali Linux:

    Common Docker fixes on Kali Linux:

    bash
    # Install Docker
    sudo apt update && sudo apt install docker.io
    
    # Start Docker service
    sudo systemctl start docker
    sudo systemctl enable docker
    
    # Add user to docker group (then logout/login)
    sudo usermod -aG docker $USER
    
    # Test Docker access
    docker --version
    docker ps

    If Docker commands work manually but fail in test mode:

    • The issue might be PATH-related in the Python environment
    • Try running with sudo: sudo python kali_server.py --test
    • Check Docker socket permissions: ls -la /var/run/docker.sock
    • Ensure you're running this on Kali Linux, not Windows

Debug Mode

Enable debug logging:

bash
# For the server
python kali_server.py --test --debug

# For Python logging
import logging
logging.basicConfig(level=logging.DEBUG)

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Follow the coding standards (English comments, proper naming)
  4. Add comprehensive tests
  5. Update documentation
  6. Submit a pull request

Coding Standards

  • All code, variables, and functions must be in English
  • All comments and documentation must be in clear English
  • Follow standard naming conventions
  • Add tests for new features or bug fixes
  • Update README and documentation

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Original Project: This project is initially a fork of MCP-Kali-Server but has been completely rewritten and restructured
  • Kali Linux for the comprehensive penetration testing platform
  • Model Context Protocol for the standardized interface
  • The cybersecurity community for continuous tool development

📞 Support


⚠️ Disclaimer: This tool is designed for authorized penetration testing and security research only. Users are responsible for complying with applicable laws and regulations.

Використовуйте MCP MCP Kali Server з різними моделями ШІ

TypingMind підключає інструменти MCP на рівні робочого простору, тож після підключення MCP Kali Server ви можете використовувати їх із різними моделями ШІ в TypingMind, а не налаштовувати окремо для кожної моделі. Ця інтеграція MCP працює локально через конектор MCP TypingMind на вашому пристрої.

Інструкція з налаштування локального конектора

Виберіть цей варіант, якщо серверу MCP потрібен доступ до локальних файлів, програм або приватних ресурсів на вашому комп’ютері.

1

Відкрийте налаштування MCP

У TypingMind перейдіть до розділу «Налаштування», відкрийте «Розширені налаштування», потім «Протокол контексту моделі» й виберіть «Параметри конектора».

  1. Відкрийте TypingMind у браузері.
  2. Натисніть значок налаштувань.
  3. Перейдіть до розділу «Розширені налаштування».
  4. Відкрийте розділ «Протокол контексту моделі».
  5. Натисніть «Параметри конектора» й виберіть «Цей пристрій».
Екран налаштування конектора MCP у TypingMind з вибраним варіантом «Цей пристрій»
2

Виконайте команду конектора

Виберіть «Цей пристрій», скопіюйте команду з TypingMind і виконайте її в терміналі. Не зупиняйте процес, поки користуєтеся MCP.

  1. Скопіюйте команду налаштування, показану в TypingMind.
  2. Відкрийте «Термінал» у macOS або Windows Terminal у Windows.
  3. Вставте й виконайте команду.
  4. Підтвердьте встановлення пакета, якщо термінал запитає дозволу продовжити.
  5. Не закривайте вікно термінала й не зупиняйте процес, поки користуєтеся інструментами MCP.
3

Додайте MCP Kali Server як сервер

Коли статус конектора зміниться на «Готово», натисніть «Змінити сервери» та вставте конфігурацію сервера MCP.

  1. Зачекайте, доки статус конектора зміниться на «Готово».
  2. Натисніть «Змінити сервери».
  3. Вставте конфігурацію сервера MCP MCP Kali Server.
  4. Збережіть список серверів.
  5. Оновіть дані, щоб переконатися, що конектор досі готовий до роботи.
Налаштування MCP у TypingMind з активним сервером і кнопкою «Змінити сервери»
{
  "mcpServers": {
    "mcp-kali-server": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Використовуйте підключення з різними моделями

Збережіть список серверів, відкрийте «Плагіни», увімкніть інструменти MCP для MCP Kali Server, а потім виберіть будь-яку підтримувану модель ШІ в TypingMind і використовуйте інструменти в чаті або призначте їх агенту ШІ.

  1. Відкрийте сторінку «Плагіни» в TypingMind.
  2. Увімкніть інструменти MCP для MCP Kali Server.
  3. Почніть чат і виберіть модель ШІ, яку хочете використовувати.
  4. Використовуйте інструменти MCP у чаті або призначте їх агенту ШІ.
  5. За потреби перемикайтеся на іншу модель ШІ без повторного підключення MCP.
Чат TypingMind із використанням увімкнених інструментів MCP і вибраної моделі ШІ
Допоможете з цим завданням через MCP Kali Server?
MCP Kali Server
Звісно. Я це прочитав.
Ось що я знайшов за допомогою MCP Kali Server.

Поширені запитання

Для чого використовується сервер MCP MCP Kali Server?

MCP Kali Server — це сервер MCP, який дає змогу сумісним клієнтам ШІ підключатися до зовнішніх інструментів і контексту. У TypingMind ви можете додати цей сервер MCP один раз і зробити його інструменти доступними у своєму робочому просторі ШІ.

Чи можу я використовувати MCP MCP Kali Server з кількома моделями ШІ в TypingMind?

Так. TypingMind підключає інструменти MCP на рівні робочого простору, тому ви можете використовувати MCP Kali Server з різними моделями ШІ, як-от Claude, ChatGPT, Gemini або іншими моделями, які ви налаштували в TypingMind, без окремого налаштування сервера MCP для кожної моделі.

Навіщо використовувати MCP MCP Kali Server із TypingMind?

TypingMind — один із найкращих інтерфейсів для чату з великими мовними моделями, адже він об’єднує різні моделі ШІ, промпти, плагіни, агентів ШІ, ключі API та інструменти MCP в одному робочому просторі. Підключивши MCP Kali Server, ви зможете використовувати його інструменти MCP з вибраними моделями та впорядковано працювати з чатами в TypingMind.

Як підключити MCP MCP Kali Server до TypingMind?

MCP Kali Server працює через локальний конектор MCP TypingMind. Це найкращий варіант, коли серверу MCP потрібен доступ до локальних файлів, настільних застосунків, інструментів командного рядка або приватних ресурсів на вашому комп’ютері.

Які інструменти надає MCP MCP Kali Server у TypingMind?

MCP Kali Server надає можливості MCP, які можна ввімкнути на сторінці «Плагіни» в TypingMind і використовувати в чаті або призначати агентам ШІ.

Чи потрібно передавати свої ключі API в TypingMind, щоб використовувати MCP MCP Kali Server?

Ні. TypingMind орієнтований насамперед на локальну роботу й дає змогу зберігати контроль над постачальниками моделей, ключами API, промптами та конфігурацією MCP. Якщо MCP Kali Server потребує автентифікації, під час створення підключення додайте потрібні заголовки, налаштування OAuth або локальну конфігурацію для цього сервера MCP.

Схожі сервери MCP

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇