Nmap Network Scanner
STDIOMCP server providing access to nmap network scanning functionality.
MCP server providing access to nmap network scanning functionality.
This is a Model Control Protocol (MCP) server that provides access to nmap network scanning functionality.
Requirements:
pip install python-libnmap
Make sure nmap is installed on your system:
# On Debian/Ubuntu sudo apt-get install nmap # On Fedora/CentOS sudo dnf install nmap
To run the server directly from the source code:
python -m src.nmap_mcp
To install the package and run as a command:
pip install -e . nmap-mcp
run-nmap-scan
target
: Target host or network (e.g., 192.168.1.1 or 192.168.1.0/24)options
: Nmap options (e.g., -sV -p 1-1000)get-scan-details
scan_id
: ID of the scan to retrievelist-all-scans
scan_id
: ID of the scan to analyzefocus
: Focus area (security/services/overview)Scan results are available as resources with the nmap://scan/{scan_id}
URI scheme.
Run a scan:
Call tool: run-nmap-scan
Parameters: {"target": "192.168.1.0/24", "options": "-sV -p 22,80,443"}
Get scan details:
Call tool: get-scan-details
Parameters: {"scan_id": "<scan_id from previous step>"}
List all scans:
Call tool: list-all-scans
Analyze scan results:
Get prompt: analyze-scan
Parameters: {"scan_id": "<scan_id>", "focus": "security"}
This server executes nmap commands on your system. Be cautious when scanning networks you don't own or have permission to scan, as unauthorized scanning may be illegal in some jurisdictions.
If you encounter errors related to nmap not being found or being executed incorrectly:
You can run the MCP server in a Docker container:
# Build the Docker image docker build -t nmap-mcp-server . # Run the Docker container docker run -it --rm nmap-mcp-server
For integration with the Glama MCP directory, the Docker container allows others to easily use this MCP server without worrying about installation dependencies.
This project is licensed under the MIT License - see the LICENSE file for details.