msf-mcp
Allows interaction with the Metasploit Framework via RPC, providing tools for module management (search, list, info), running exploits/auxiliary/post modules, managing sessions and jobs, and executing msfconsole commands.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@msf-mcpsearch for ms17-010 exploits"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
msf-mcp
A minimal MCP (Model Context Protocol) server that exposes the Metasploit Framework to Claude Code (or any MCP-compatible client) through msfrpcd.
⚠️ Use only in environments you are authorized to test — your own lab, your own infrastructure, or an engagement you have explicit written permission for. This project is a thin wrapper around Metasploit's own documented RPC API; it doesn't add capability beyond what your installed Metasploit already has, but it does let an LLM drive it, so treat it with the same care you'd give any pentest tooling.
How it works
The project is split into two scripts, on purpose:
Script | Runs as | Needs sudo? | Purpose |
| you, manually | yes | Starts |
| Claude Code | no | Connects to the already-running |
you --sudo--> setup.py --spawns--> msfrpcd
^
| RPC (msgpack)
|
Claude Code --stdio--> server.py -------┘Keeping the privileged piece (setup.py) separate from the MCP server (server.py) means Claude Code never needs to run with elevated privileges, and the process an LLM is driving has no more access than a normal RPC client would.
Related MCP server: mcp-pymetasploit3
Requirements
Metasploit Framework installed, with
msfrpcdonPATHPython 3.9+
pip install -r requirements.txt(installsmcpandpymetasploit3)
Installation
git clone https://github.com/IMApurbo/msf-mcp.git
cd msf-mcp
pip install -r requirements.txtConfigure
Both setup.py and server.py have a CONFIG block near the top:
RPC_HOST = "127.0.0.1"
RPC_PORT = 55553
RPC_PASSWORD = "change-me-123"
USE_SSL = TrueEdit both files and make sure these four values match in each. There's no shared config file on purpose — it keeps each script standalone and easy to read.
Start msfrpcd
sudo python3 setup.pyThis will:
start
msfrpcdif it isn't running, orstop and cleanly restart it if it already is
Logs go to /var/log/msf_setup.log and to stdout. You can also run explicit actions:
sudo python3 setup.py status
sudo python3 setup.py start
sudo python3 setup.py stop
sudo python3 setup.py restartRegister the MCP server with Claude Code
claude mcp add metasploit -- python3 /full/path/to/server.pyUsing a virtualenv? Just point at that interpreter instead:
claude mcp add metasploit -- /path/to/venv/bin/python /full/path/to/server.pyCheck it registered:
claude mcp listVerifying it works
Ask Claude Code:
Use the metasploit debug_connection_check tool and tell me the result.A healthy response looks like:
{
"configured_host": "127.0.0.1",
"configured_port": 55553,
"tcp_port_reachable": true,
"rpc_login_ok": true,
"rpc_error": null,
"log_file": "/tmp/msf_mcp_server.log"
}tcp_port_reachable: false→msfrpcdisn't running — runsudo python3 setup.py.tcp_port_reachable: truebutrpc_login_ok: false→ something's listening on that port, but login failed — usually aRPC_PASSWORDmismatch betweensetup.pyandserver.py. Checkrpc_errorfor details.
Available tools
Tool | Description |
| Reports whether the server can reach and authenticate to msfrpcd |
| Returns the last N lines of the server's own log file |
| List module names by type (exploit/auxiliary/post/payload/encoder/nop) |
| Keyword search across Metasploit modules |
| Description, options, and targets for a module |
| Configure and execute an exploit/auxiliary/post module |
| Manage background jobs (handlers, running scans) |
| List active shell/meterpreter sessions |
| Send a command to a session and read the output |
| Terminate a session |
| Run a raw |
| Manage |
Debugging
server.py logs everything to /tmp/msf_mcp_server.log and to stderr — never stdout, since Claude Code uses stdout for the MCP protocol itself. If a tool call fails or behaves unexpectedly:
tail -f /tmp/msf_mcp_server.logor ask Claude directly to call the debug_tail_log tool — no terminal access needed.
setup.py logs to /var/log/msf_setup.log.
Project structure
msf-mcp/
├── setup.py # privileged: starts/stops/restarts msfrpcd (run manually with sudo)
├── server.py # unprivileged: MCP server exposing Metasploit as tools (added to Claude Code)
├── requirements.txt
└── README.mdLicense
MIT
Author
IMApurbo
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/IMApurbo/msf-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server