Metasploit Mcp Server — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Metasploit Mcp Server (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A Model Context Protocol (MCP) server that provides AI assistants with secure access to Metasploit Framework functionality through a standardized interface. This server wraps core Metasploit capabilities into MCP tools that can be discovered and used by compatible clients.
msfconsole) git clone https://github.com/RobertoDure/metasploit-mcp-server.git
cd metasploit-mcp-server npm install msfconsole --versionnpm run devnpm startThe server communicates via STDIO transport, making it compatible with any MCP client that supports this transport method.
The MCP server exposes the following tools through the @modelcontextprotocol/sdk:
| Tool Name | Description | Required Parameters | Optional Parameters | |||||
|---|---|---|---|---|---|---|---|---|
execute-command | Execute raw Metasploit commands with security validation | command (string) | None | |||||
search-exploit | Search for exploits by name, CVE, or keywords | query (string) | None | |||||
module-info | Get detailed information about a specific module | modulePath (string) | None | |||||
list-modules | List available modules by type | type (exploit\ | auxiliary\ | post\ | payload\ | encoder\ | nop) | None |
get-version | Get Metasploit Framework version information | None | None | |||||
run-nmap-scan | Execute Nmap scans through Metasploit's database | target (string) | options (string) | |||||
run-vuln-scan | Run vulnerability scans using auxiliary modules | target (string) | None |
#### execute-command
#### search-exploit
#### module-info
#### list-modules
#### run-nmap-scan
#### run-vuln-scan
When connected to an MCP-compatible client, you can interact with Metasploit using natural language:
Searching and Information:
Scanning and Reconnaissance:
System Information:
The server returns structured JSON responses:
{
"success": true,
"output": "Metasploit Framework Console Output...",
"command": "search apache"
}Or in case of errors:
{
"success": false,
"output": "Command contains potentially dangerous characters",
"error": "Security violation"
}The server follows a clean, modular architecture:
src/
├── index.js # Main MCP server with tool registrations
└── services/
└── metasploit-service.js # Metasploit Framework integration layer
tests/
└── metasploit-service.test.js # Unit tests with Jest@modelcontextprotocol/sdk for MCP protocol implementation;&|$()`)The server is configured as an ES module with the following key settings:
{
"name": "metasploit-mcp-server",
"version": "1.0.0",
"type": "module",
"main": "src/index.js",
"engines": {
"node": ">=16.0.0"
}
}Production Dependencies:
@modelcontextprotocol/sdk (^1.12.0) - MCP protocol implementationzod (^3.22.4) - Runtime type validation and schema definitionDevelopment Dependencies:
jest (^29.7.0) - Testing framework with ES module supporteslint (^8.57.0) - Code linting and style enforcementFor Claude Desktop, add to your MCP settings:
{
"mcpServers": {
"metasploit": {
"command": "node",
"args": ["src/index.js"],
"cwd": "/path/to/metasploit-mcp-server"
}
}
}For VS Code with MCP extension:
{
"mcpServers": {
"metasploit-mcp-server": {
"command": "npm",
"args": ["start"],
"cwd": "/path/to/metasploit-mcp-server"
}
}
}⚠️ Important Security Notice
This MCP server provides direct access to Metasploit Framework capabilities. Please observe these security guidelines:
# Start in development mode with file watching
npm run dev
# Run production server
npm start
# Run tests with Jest
npm test
# Run tests in watch mode
npm run test:watch
# Lint code with ESLint
npm run lint
# Fix linting issues automatically
npm run lint:fixThe project includes comprehensive Jest tests:
# Run all tests
npm test
# Generate coverage report
npm test -- --coverage
# Watch mode for development
npm run test:watchTest coverage includes:
metasploit-mcp-server/
├── src/
│ ├── index.js # MCP server entry point
│ └── services/
│ └── metasploit-service.js # Metasploit integration
├── tests/
│ └── metasploit-service.test.js # Unit tests
├── package.json # Dependencies and scripts
├── jest.config.json # Jest testing configuration
└── README.md # DocumentationTo add new Metasploit capabilities:
async myNewFeature(param) {
return this.executeCommand(`my_command ${param}`);
} server.registerTool("my-new-tool", {
title: "My New Tool",
description: "Description of what it does",
inputSchema: {
param: z.string().describe("Parameter description")
}
}, async ({ param }) => {
const result = await metasploitService.myNewFeature(param);
return {
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
};
}); describe('myNewFeature', () => {
it('should execute the new feature', async () => {
// Test implementation
});
});For specific module integrations, you can create specialized methods:
async scanForWebVulns(target) {
const commands = [
`use auxiliary/scanner/http/dir_scanner`,
`set RHOSTS ${target}`,
`run`,
`back`
].join('; ');
return this.executeCommand(commands);
}Follow the established error handling pattern:
if (!param || typeof param !== 'string') {
return {
success: false,
output: 'Invalid parameter',
error: 'Validation failed'
};
}Metasploit not found:
# Ensure Metasploit is in PATH
which msfconsole
# Or check installation
msfconsole --versionPermission errors:
# Check file permissions
ls -la src/index.js
# Ensure Node.js has execution rights
chmod +x src/index.jsModule import errors:
"type": "module" is set in package.json.js extensions in all import statementsMCP client connection issues:
Enable debug logging by setting environment variables:
DEBUG=mcp* npm startFor better performance with large scans:
// Increase timeout for long-running operations
const { stdout, stderr } = await execAsync(fullCommand, {
timeout: 60000 // 60 seconds
});MIT License - see LICENSE file for details.
Contributions are welcome! Please follow these guidelines:
# Clone your fork
git clone https://github.com/yourusername/metasploit-mcp-server.git
# Install dependencies
npm install
# Create a feature branch
git checkout -b feature/new-tool
# Make changes and test
npm test
npm run lint
# Commit and push
git commit -m "Add new tool for X"
git push origin feature/new-toolimport/export)Happy hacking! 🚀🔒
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.