MCP Kali Server
About
A comprehensive Model Context Protocol (MCP) server for penetration testing and cybersecurity operations, providing seamless integration between Kali Linux tools and MCP-compatible clients.
Details
- Author
- triv3
- Categories
- Other, Security, Infrastructure, Developer Tools
Jump to
Setup
Install MCP Kali Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/triv3/MCP-Kali-Server
Follow the installation instructions in the repository README, then restart your MCP client.
A comprehensive Model Context Protocol (MCP) server for penetration testing and cybersecurity operations, providing seamless integration between Kali Linux tools and MCP-compatible clients.
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.
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.
This project is designed to work across different environments:
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
- Docker test mode (--testoption) - automatically manages test containers
- All penetration testing tools (nmap, gobuster, etc.)
- SSH and reverse shell session management
- File operations with integrity verification
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.
┌─────────────────┐ HTTP ┌──────────────────┐ HTTP ┌──────────────────┐ │ MCP Client │ ◄─────────► │ MCP Server │ ◄─────────► │ Kali Server │ │ (Any system) │ │ (Any system) │ │ (Kali Linux) │ └─────────────────┘ └──────────────────┘ │ │ │ ┌──────────────┐ │ │ │ Docker │ │ │ │ (test mode) │ │ │ └──────────────┘ │ └──────────────────┘
- 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
- 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
- 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
- Kali Server File Management:
- upload_to_kali: Upload files directly to Kali server
- download_from_kali: Download files from Kali server
- 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_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
- Command Execution: Direct command execution on Kali server
- Health Monitoring: Server health checks and status monitoring
- Session Persistence: Maintain multiple concurrent sessions
- 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
- 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
Seeinstall.mdfor detailed installation instructions.
After installation, configure your MCP client to connect to the Kali server:
- Setting up.claude/mcp_settings.jsonfor Claude Desktop
- Configuring alternative MCP clients
- Finding your Python path and Kali IP address
- Platform-specific examples (Windows, Linux, macOS)
If you're running Kali Linux in WSL 2, proper network configuration iscriticalfor the MCP server to function. See our comprehensive guide:
- 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 Windowsmustbe able to access the Kali server vialocalhost. Review this guide before running the server.
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.
pip install -r requirements.kali.txt # On Kali host running kali-server/ pip install -r requirements.mcp.txt # On host running mcp-server/
IMPORTANT: Be extremely cautious when running the Kali server withsudoprivileges:
# ⚠️ DANGEROUS - Avoid if possible sudo python kali_server.py
- 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
- 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 seeTODO.mdfor planned security enhancements including granular privilege management and access controls.
Seeusage.mdfor detailed usage instructions and examples.
The project includes comprehensive test suites using Docker containers for isolated testing environments.
cd tests ./run_all.bat # Windows # or chmod +x run_all.sh && ./run_all.sh # Linux
cd tests/docker docker-compose up -d --build python test_config_docker.py
cd tests/kali python -m pytest test_ssh_manager.py -v
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
The MCP server provides the following tools:
# 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" }
# All downloads include automatic integrity verification download_result = { "success": True, "remote_checksum": "def456...", "local_checksum": "def456...", "checksum_verified": True, "integrity_check": "PASSED" }
- 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
# Check if server is running curl http://localhost:5000/health
# Verify SSH connectivity ssh user@target-host
# Install missing tools sudo apt update && sudo apt install nmap gobuster
If you encounter Docker-related errors when using--testmodeon Kali Linux:
# 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
# For the server python kali_server.py --test --debug # For Python logging import logging logging.basicConfig(level=logging.DEBUG)
- Fork the repository
- Create a feature branch
- Follow the coding standards (English comments, proper naming)
- Add comprehensive tests
- Update documentation
- Submit a pull request
- 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
This project is licensed under the MIT License - see theLICENSEfile for details.
- Original Project: This project is initially a fork ofMCP-Kali-Serverbut has been completely rewritten and restructured
- Kali Linuxfor the comprehensive penetration testing platform
- Model Context Protocolfor the standardized interface
- The cybersecurity community for continuous tool development
- Issues:GitHub Issues
- Documentation:Wiki
⚠️ Disclaimer: This tool is designed for authorized penetration testing and security research only. Users are responsible for complying with applicable laws and regulations.
Security testing MCP server with 51 tools for penetration testing, network forensics, memory analysis, and vulnerability assessment.
This tool creates an MCP server to bridge the gap between AI workflows and EMBA security analysis.
A complete Model Context Protocol (MCP) server for Fortinet FortiOS 7.6.6
A Python MCP Server that connects Large Language Models natively to a comprehensive suite of offensive security tools.
A server that allows MCP clients to use Suricata for network traffic analysis.
MCP access to cluster-wide L4 and L7 network traffic, packets, APIs, and complete payloads.
Interact with the Illumio Policy Compute Engine (PCE) to manage workloads, labels, and analyze traffic flows.
MCP server for managing pfSense firewalls through AI assistants — firewall rules, DHCP, DNS, gateways, ARP, and services. 17 tools with two-step confirmation for destructive operations.
Network reconnaissance and security scanning with port scanning, DNS analysis, and vulnerability assessment
A server for real-time network packet monitoring and security analysis.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



