Skip to main content
Glama

Metasploit-MCP

Connect AI agents to local Metasploit through MCP. Includes 23 tools for RPC, modules, sessions, jobs, consoles, native terminals, and files.

Use only on systems you are authorized to test.

Installation

Requirements

  • Python 3.11+, uv, and Git.

  • Metasploit Framework installed, with msfrpcd on your PATH.

  • An AI client that supports local MCP servers.

Supports macOS, Linux, and Windows 10 (1809+) / Windows 11.

1. Install

git clone https://github.com/ethanroubal/Metasploit-MCP.git
cd Metasploit-MCP
uv sync --frozen

2. Add the MCP server

ChatGPT desktop — through the app:

  1. Open Settings → MCP servers → Add server and choose STDIO.

  2. Enter these settings:

    Field

    Value

    Name

    metasploit

    Command

    uv (uv.exe on Windows)

  3. Add each argument below as a separate entry, in this order:

    --directory
    /absolute/path/to/Metasploit-MCP
    run
    --frozen
    metasploit-mcp
    --launch-rpc

    The directory must be this cloned project, not msfconsole or the Metasploit installation. Keep the entire path in one entry, including any spaces.

  4. Replace the project path with your clone's absolute path, then Save and select Restart.

Alternatively, use the TOML configuration for ChatGPT desktop / Codex. ChatGPT in a browser requires the separate tunnel setup in the ChatGPT setup guide.

Clients that use JSON: add this entry to your AI client's MCP configuration:

{
  "mcpServers": {
    "metasploit": {
      "command": "uv",
      "args": [
        "--directory", "/absolute/path/to/Metasploit-MCP",
        "run", "--frozen", "metasploit-mcp", "--launch-rpc"
      ]
    }
  }
}

Replace the project path with your clone's absolute path. If you already have MCP servers configured, add metasploit inside the existing mcpServers object.

Windows: use uv.exe and a path such as C:/Users/you/Metasploit-MCP. See the Windows configuration.

3. Connect

Restart your AI client and ask it to call msf_status. A successful response shows the Metasploit version.

The client starts the MCP server and local RPC daemon automatically. Each connection gets a free local port and temporary credentials, so multiple chats can run at once. The bridge stops its own daemon on shutdown. Automatic startup requires a recent Metasploit release; for an existing or older daemon, follow these instructions.

Related MCP server: MSFConsole MCP Server

Usage

Ask your AI client to use the Metasploit tools. For example:

  • “Check the Metasploit version and list running jobs.”

  • “Search for HTTP auxiliary modules and show their options.”

  • “Create a console, run version, read the output, and close it.”

  • “List the available sessions.”

You do not need to start the MCP server manually when using the configuration above. Metasploit must be installed separately; database operations also need a configured Metasploit database.

Troubleshooting

  • Command not found: use absolute paths for uv and msfrpcd. Append "--msfrpcd", "/path/to/msfrpcd" to the configuration's args if needed.

  • Desktop setup: enter each argument separately. If Metasploit is installed under /opt/metasploit-framework, add --msfrpcd and /opt/metasploit-framework/bin/msfrpcd as two more argument entries. For slow startup, set startup_timeout_sec = 120 using the TOML example.

  • Port already in use: remove MSF_RPC_URL from an automatic-startup configuration to choose a free port, or connect to the running daemon using the existing-daemon configuration.

More information

Available Tools

23 tools
msf_console_createB
Destructive

Create a persistent msfconsole and return its ID; destroy it when finished.

Inputs: options. Returns: object

msf_console_destroyA
Destructive

Destroy a console by ID. This does not stop its background jobs/sessions.

Inputs: console_id (required). Returns: object

msf_console_listA
Read-only

List consoles and their busy state.

Inputs: no named parameters. Returns: object

msf_console_readA
Destructive

Consume available console output; returns data, prompt, and busy status.

Reads drain the console's output buffer. busy=false is a snapshot, not proof that a just-submitted command has completed or that a job has ended.

Inputs: console_id (required). Returns: object

msf_console_writeA
Destructive

Send arbitrary console commands, including multiline scripts.

The console retains state (selected module, options, workspace). This tool only submits input; read output separately. A newline is appended by default.

Inputs: command (required), console_id (required), append_newline. Returns: object

msf_file_listA
Read-only

List a local directory with pagination to locate scripts and output artifacts.

Inputs: path (required), limit, offset. Returns: object

msf_file_readA
Read-only

Read a local file as lossless base64 chunks; continue using next_offset.

Use for generated binaries, loot, reports, resource scripts, or modules. This accesses the MCP host's filesystem with its OS permissions.

Inputs: path (required), offset, max_bytes. Returns: object

msf_file_writeA
Destructive

Write text or {$binary: base64} at a local file byte offset.

Creates missing parent directories and files. truncate=true clears an existing file first; use only on the first chunk when replacing a file. Supports arbitrary-sized resource scripts, modules, and import artifacts by writing successive chunks at next_offset. Paths are local to the MCP host.

Inputs: data (required), path (required), offset, truncate. Returns: object

msf_jobsA
Read-only

List running jobs. Use msf_rpc job.info or job.stop with a job ID.

Inputs: no named parameters. Returns: object

msf_module_executeA
Destructive

Execute an installed module with its datastore options; returns job/UUID or output.

Inspect module.info and module.options first. Execution may continue after this tool returns. Poll job.list, module.running_stats, or module.results using msf_rpc. Binary output is represented as a $binary base64 object.

Inputs: options (required), module_name (required), module_type (required). Returns: object

msf_module_infoB
Read-only

Return module metadata. Use msf_rpc module.options for its option schema.

Inputs: module_name (required), module_type (required). Returns: object

msf_process_closeA
Destructive

Stop this process and owned descendants, release its PTY, and delete output.

Detached descendants are tracked by ancestry and an inherited ownership marker. Retrieve output first. Owned processes are also stopped when the MCP server shuts down. This does not stop an external RPC daemon.

Inputs: process_id (required). Returns: object

msf_process_listA
Read-only

List processes owned by this bridge and their exit status.

Inputs: no named parameters. Returns: object

msf_process_readA
Read-only

Read lossless spooled output at a byte offset, without consuming it.

data is base64 bytes; text is a display-only UTF-8 decoding. Use next_offset to continue reading. Pipe mode separates stdout/stderr; PTY merges them into stdout. eof means the process exited and this stream has been read. A process timeout/cancellation never implicitly replays or stops it.

Inputs: process_id (required), offset, stream, max_bytes. Returns: object

msf_process_resizeB
Destructive

Resize a persistent PTY and notify its foreground terminal program.

Inputs: rows (required), columns (required), process_id (required). Returns: object

msf_process_signalA
Destructive

Signal the process group: interrupt, terminate, kill, stop, or continue.

Accepts named POSIX signals, including SIGINT, SIGTERM, SIGKILL, SIGSTOP, SIGCONT, SIGHUP, SIGUSR1, SIGUSR2, and SIGWINCH. SIGINT interrupts native console/IRB work. It may exit a standalone tool.

Inputs: process_id (required), signal_name. Returns: object

msf_process_startA
Destructive

Start a local executable with literal argv, without a shell.

Use ["msfconsole", "-q"] with terminal=true for a real interactive PTY, including IRB, prompts, and terminal input. Use ["msfvenom", "--help"] with terminal=false for exact binary output and separate stderr. Other installed Framework utilities and interpreters can be run the same way. These processes do not share the RPC daemon's in-memory sessions or jobs. Returns immediately with process_id. Read output, write input, signal, resize, and close using the process tools. cwd and env are optional.

Inputs: argv (required), cwd, env, rows, +2 more. Returns: object

msf_process_writeA
Destructive

Write text or {$binary: base64} to stdin, without adding a newline.

For commands include a newline explicitly. Control characters can be sent directly in PTY mode (e.g.  for Ctrl-C,  for EOF). In pipe mode, close_stdin=true sends EOF after data. PTY stdin cannot be closed separately.

Inputs: process_id (required), data, close_stdin. Returns: object

msf_rpcA
Destructive

Call ANY Metasploit RPC method with positional arguments, excluding its auth token.

Examples: core.version []; module.info ["auxiliary", "module/name"]; job.list []; session.list []; db.workspaces []; plugin.loaded []. Methods and arguments depend on your installed Metasploit version. authenticated=null detects auth.login and health.check as unauthenticated; false omits the token for other noauth endpoints. timeout overrides the per-request HTTP timeout in seconds, without retrying a failed action. For binary arguments use an exact {"$binary": "base64..."} object. For typed map keys or literal marker objects use {"$map": [[key, value], ...]}. Non-string map keys in results are preserved using the same pair-list form. This can mutate state, execute modules, manage sessions, or stop the daemon. Use console tools for functionality without an RPC method.

Inputs: method (required), params, timeout, authenticated. Returns: object

msf_rpc_methodsA
Read-only

Find RPC method names, Ruby argument signatures, and authentication requirements.

Defaults to a bundled reference catalog pinned to an upstream commit. Pass the installed Framework root to scan its source instead. This is source discovery, not a live capability probe; plugins and versions can differ. The catalog never restricts msf_rpc calls to unlisted methods.

Inputs: limit, query, offset, framework_root. Returns: object

msf_sessionsA
Read-only

List sessions; use msf_rpc session.* methods to interact with them.

Inputs: no named parameters. Returns: object

msf_statusB
Read-only

Authenticate and get Metasploit and API version information.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 23 tools

    Disambiguation4/5

    Tools are organized into clean families (console, process, file, module, RPC) with descriptions that explicitly distinguish risky pairs, e.g. msf_console_* (RPC daemon state) vs msf_process_* (local PTY executables). The remaining overlap is intentional: msf_rpc is a documented catch-all that can do most of what msf_sessions, msf_jobs, msf_status, and msf_module_execute do, which can tempt misselection but is clearly framed as an escape hatch.

    Naming Consistency4/5

    Nearly all tools follow a predictable msf_<family>_<verb> snake_case pattern (msf_console_create, msf_process_signal, msf_file_read, msf_module_execute). A few are bare nouns without a verb (msf_sessions, msf_jobs, msf_status, msf_rpc), a minor deviation but still readable and unambiguous within their families.

    Tool Count4/5

    23 tools is on the heavy side, but the count is driven by a few genuinely stateful subsystems (7 process lifecycle tools, 5 console tools) where read/write/signal/close genuinely each earn a place. No tool appears redundant or filler; a slightly flatter surface could merge some list-only endpoints.

    Completeness3/5

    Core areas are covered (module search/info/execute, console lifecycle, process and file I/O), but sessions and jobs are list-only and must be driven through raw msf_rpc for interaction, stopping, or data read — a notable gap in the typed surface for Metasploit's central post-exploitation workflow. File tools also lack delete/move, though the generic RPC escape hatch prevents true dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables secure integration with Metasploit Framework for AI assistants, providing comprehensive access to penetration testing tools, module management, payload generation, and database operations. Designed for authorized security testing and defensive analysis with 28 specialized tools covering complete MSF functionality.
      8
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI assistants to interact with Metasploit Framework through 28 comprehensive tools for penetration testing and security analysis. Provides secure, structured access to MSF modules, database operations, session management, and payload generation capabilities.
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Bridges large language models with the Metasploit Framework to enable natural language control over penetration testing workflows. It provides tools for searching modules, executing exploits, generating payloads, and managing active sessions.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Metasploit Framework via the msfrpc protocol, exposing tools for module management, session control, and exploitation through MCP.
      79 PyPI
      1
      MIT