Nmap MCP Server
Nmap MCP 服务器
这是一个模型控制协议 (MCP) 服务器,提供对 nmap 网络扫描功能的访问。
特征
使用可自定义的选项对指定目标运行 nmap 扫描
存储和检索扫描结果
使用 AI 提示分析扫描结果
Related MCP server: Nmap MCP Server
安装
要求:
Python 3.10+
python-libnmap
nmap(安装在系统上)
pip install python-libnmap确保您的系统上安装了 nmap:
# On Debian/Ubuntu
sudo apt-get install nmap
# On Fedora/CentOS
sudo dnf install nmap用法
运行服务器
要直接从源代码运行服务器:
python -m src.nmap_mcp要安装包并作为命令运行:
pip install -e .
nmap-mcp可用工具
运行 nmap 扫描
对指定目标运行 nmap 扫描
参数:
target:目标主机或网络(例如,192.168.1.1 或 192.168.1.0/24)options:Nmap 选项(例如 -sV -p 1-1000)
获取扫描详细信息
获取有关特定扫描的详细信息
参数:
scan_id:要检索的扫描的 ID
列出所有扫描
列出所有可用的扫描结果
无需参数
可用提示
分析扫描
分析nmap扫描结果
参数:
scan_id:要分析的扫描的 IDfocus:重点领域(安全/服务/概述)
资源
扫描结果可作为具有nmap://scan/{scan_id} URI 方案的资源使用。
示例工作流程
运行扫描:
Call tool: run-nmap-scan Parameters: {"target": "192.168.1.0/24", "options": "-sV -p 22,80,443"}获取扫描详细信息:
Call tool: get-scan-details Parameters: {"scan_id": "<scan_id from previous step>"}列出所有扫描:
Call tool: list-all-scans分析扫描结果:
Get prompt: analyze-scan Parameters: {"scan_id": "<scan_id>", "focus": "security"}
安全注意事项
此服务器在您的系统上执行 nmap 命令。扫描不属于您或您无权扫描的网络时请务必谨慎,因为未经授权的扫描在某些司法管辖区可能是违法的。
故障排除
如果遇到与 nmap 未找到或执行不正确相关的错误:
确保 nmap 已安装并位于 PATH 中
检查正在使用 nmap 可执行文件的日志
服务器将尝试使用 nmap 的完整路径以避免冲突
Docker 使用
您可以在 Docker 容器中运行 MCP 服务器:
# Build the Docker image
docker build -t nmap-mcp-server .
# Run the Docker container
docker run -it --rm nmap-mcp-server为了与 Glama MCP 目录集成,Docker 容器允许其他人轻松使用此 MCP 服务器,而无需担心安装依赖关系。
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
Available Tools
3 toolsget-scan-detailsC
Get detailed information about a specific scan
Inputs: scan_id (required).
list-all-scansB
List all available scan results
Inputs: no named parameters.
run-nmap-scanC
Run an nmap scan on specified targets
Inputs: target (required), options.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: get-scan-details retrieves specific scan information, list-all-scans shows all available results, and run-nmap-scan performs new scans. The actions (get, list, run) and targets (details, scans, scan) are well-differentiated, making misselection unlikely.
All tools follow a consistent verb-noun pattern with hyphens (get-scan-details, list-all-scans, run-nmap-scan). The naming is predictable and readable, using clear action words and descriptive nouns without any deviations in style or convention.
With only 3 tools, the server feels thin for an nmap domain, which typically involves more operations like managing scan configurations, exporting results, or filtering scans. While the core functions are covered, the limited count may restrict agent flexibility in complex scenarios.
The tools cover the basic lifecycle of running, listing, and retrieving scans, but there are minor gaps such as updating or deleting scans, or handling scan parameters more granularly. Agents can work around these with the existing tools, but the surface is not fully comprehensive.
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Scans remote MCP servers for protocol, security, and TLS issues; exposes scan tools via MCP.
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- FlicenseBqualityDmaintenanceExposes Nmap network scanning capabilities through a Model Context Protocol (MCP) server, allowing users to perform various types of network scans including vulnerability assessment, service detection, and OS fingerprinting.117-
- FlicenseNot gradedqualityDmaintenanceEnables network scanning and security assessment using Nmap through MCP, allowing AI assistants to perform port scans, service detection, and network reconnaissance on specified targets with configurable scan parameters.-
- AlicenseNot gradedqualityDmaintenanceEnables network security scanning using Nmap through MCP protocol. Supports quick port scans, full port scans with service detection, and custom Nmap commands with async task management.3MIT
- AlicenseAqualityDmaintenanceA production-ready MCP server that wraps Nmap to enable AI agents to perform automated network security assessments, including port scanning, host discovery, service detection, OS fingerprinting, and vulnerability scanning.617Apache 2.0