nmap MCP server for AI-assisted network security auditing
简介
nmap MCP server for AI-assisted network security auditing
原始描述
Network scanning MCP server wrapping nmap. Provides 14 purpose-built tools for host discovery, port scanning (SYN/TCP/UDP), service & OS detection, NSE scrip...
通过你的 Agent 添加
安装目录:nmap-mcp-server-for-ai-assisted-network-security-auditing/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: nmap-mcp
description: >
Network scanning MCP server wrapping nmap. Provides 14 purpose-built tools
for host discovery, port scanning (SYN/TCP/UDP), service & OS detection, NSE
script execution, and vulnerability scanning. Returns structured JSON output.
Includes scope enforcement (CIDR allowlist), audit logging, and scan
persistence. Use when performing network security audits, asset discovery,
or recon on authorized networks.
nmap-mcp Skill
MCP server that exposes nmap as structured tools with scope enforcement, audit logging, and persistent scan results.
Prerequisites
- nmap installed (
/usr/bin/nmap or configure path in config.yaml)
- Python 3.10+ with
fastmcp, python-nmap, pyyaml
- For SYN/OS/ARP scans:
cap_net_raw capability on the nmap binary (see Setup)
Setup
# 1. Install Python dependencies
pip install fastmcp python-nmap pyyaml
# 2. Grant nmap raw socket capability (required for SYN + OS detection)
# Only needs to be done once. Re-run after nmap upgrades.
sudo setcap cap_net_raw+ep $(which nmap)
# 3. Verify it worked
getcap $(which nmap)
# Expected: /usr/bin/nmap cap_net_raw=ep
# 4. Configure scope (edit config.yaml — set your allowed CIDRs)
# 5. Register with mcporter (see mcporter.json entry below)
mcporter.json Entry
{
"nmap": {
"command": "python3",
"args": ["-u", "/path/to/nmap-mcp/server.py"],
"type": "stdio",
"env": {
"NMAP_CONFIG": "/path/to/nmap-mcp/config.yaml"
}
}
}
Configuration (config.yaml)
# Scope enforcement — targets outside these CIDRs are rejected
allowed_cidrs:
- "127.0.0.0/8"
- "192.168.1.0/24" # your local network
# Paths (defaults to relative paths if omitted)
audit_log: "./audit.log"
scan_dir: "./scans"
nmap_bin: "/usr/bin/nmap"
# Timeouts in seconds
timeouts:
quick: 120
standard: 300
deep: 600
Tools
Tool
Purpose
Privileges
nmap_ping_scan
ICMP+TCP host discovery
none
nmap_arp_discovery
ARP host discovery (LAN)
cap_net_raw
nmap_top_ports
Fast scan of N common ports
none
nmap_syn_scan
SYN half-open port scan
cap_net_raw
nmap_tcp_scan
Full TCP connect port scan
none
nmap_udp_scan
UDP port scan
cap_net_raw
nmap_service_detection
Service/version detection
none
nmap_os_detection
OS fingerprinting
cap_net_raw
nmap_script_scan
Run named NSE scripts
none
nmap_vuln_scan
Run vuln NSE category
none
nmap_full_recon
SYN+service+OS+scripts
cap_net_raw
nmap_custom_scan
Arbitrary flags (scoped+logged)
varies
nmap_list_scans
List recent saved scans
none
nmap_get_scan
Retrieve scan by ID
none
Running Tests
python3 -m pytest tests/ -v
# 28 tests covering scope enforcement, audit logging,
# scan persistence, injection guards, and live scans
/usr/bin/nmap or configure path in config.yaml)fastmcp, python-nmap, pyyamlcap_net_raw capability on the nmap binary (see Setup)# 1. Install Python dependencies
pip install fastmcp python-nmap pyyaml
# 2. Grant nmap raw socket capability (required for SYN + OS detection)
# Only needs to be done once. Re-run after nmap upgrades.
sudo setcap cap_net_raw+ep $(which nmap)
# 3. Verify it worked
getcap $(which nmap)
# Expected: /usr/bin/nmap cap_net_raw=ep
# 4. Configure scope (edit config.yaml — set your allowed CIDRs)
# 5. Register with mcporter (see mcporter.json entry below)
mcporter.json Entry
{
"nmap": {
"command": "python3",
"args": ["-u", "/path/to/nmap-mcp/server.py"],
"type": "stdio",
"env": {
"NMAP_CONFIG": "/path/to/nmap-mcp/config.yaml"
}
}
}
Configuration (config.yaml)
# Scope enforcement — targets outside these CIDRs are rejected
allowed_cidrs:
- "127.0.0.0/8"
- "192.168.1.0/24" # your local network
# Paths (defaults to relative paths if omitted)
audit_log: "./audit.log"
scan_dir: "./scans"
nmap_bin: "/usr/bin/nmap"
# Timeouts in seconds
timeouts:
quick: 120
standard: 300
deep: 600
Tools
Tool
Purpose
Privileges
nmap_ping_scan
ICMP+TCP host discovery
none
nmap_arp_discovery
ARP host discovery (LAN)
cap_net_raw
nmap_top_ports
Fast scan of N common ports
none
nmap_syn_scan
SYN half-open port scan
cap_net_raw
nmap_tcp_scan
Full TCP connect port scan
none
nmap_udp_scan
UDP port scan
cap_net_raw
nmap_service_detection
Service/version detection
none
nmap_os_detection
OS fingerprinting
cap_net_raw
nmap_script_scan
Run named NSE scripts
none
nmap_vuln_scan
Run vuln NSE category
none
nmap_full_recon
SYN+service+OS+scripts
cap_net_raw
nmap_custom_scan
Arbitrary flags (scoped+logged)
varies
nmap_list_scans
List recent saved scans
none
nmap_get_scan
Retrieve scan by ID
none
Running Tests
python3 -m pytest tests/ -v
# 28 tests covering scope enforcement, audit logging,
# scan persistence, injection guards, and live scans
{
"nmap": {
"command": "python3",
"args": ["-u", "/path/to/nmap-mcp/server.py"],
"type": "stdio",
"env": {
"NMAP_CONFIG": "/path/to/nmap-mcp/config.yaml"
}
}
}
# Scope enforcement — targets outside these CIDRs are rejected
allowed_cidrs:
- "127.0.0.0/8"
- "192.168.1.0/24" # your local network
# Paths (defaults to relative paths if omitted)
audit_log: "./audit.log"
scan_dir: "./scans"
nmap_bin: "/usr/bin/nmap"
# Timeouts in seconds
timeouts:
quick: 120
standard: 300
deep: 600
Tools
Tool
Purpose
Privileges
nmap_ping_scan
ICMP+TCP host discovery
none
nmap_arp_discovery
ARP host discovery (LAN)
cap_net_raw
nmap_top_ports
Fast scan of N common ports
none
nmap_syn_scan
SYN half-open port scan
cap_net_raw
nmap_tcp_scan
Full TCP connect port scan
none
nmap_udp_scan
UDP port scan
cap_net_raw
nmap_service_detection
Service/version detection
none
nmap_os_detection
OS fingerprinting
cap_net_raw
nmap_script_scan
Run named NSE scripts
none
nmap_vuln_scan
Run vuln NSE category
none
nmap_full_recon
SYN+service+OS+scripts
cap_net_raw
nmap_custom_scan
Arbitrary flags (scoped+logged)
varies
nmap_list_scans
List recent saved scans
none
nmap_get_scan
Retrieve scan by ID
none
Running Tests
python3 -m pytest tests/ -v
# 28 tests covering scope enforcement, audit logging,
# scan persistence, injection guards, and live scans
| Tool | Purpose | Privileges |
|---|---|---|
nmap_ping_scan |
ICMP+TCP host discovery | none |
nmap_arp_discovery |
ARP host discovery (LAN) | cap_net_raw |
nmap_top_ports |
Fast scan of N common ports | none |
nmap_syn_scan |
SYN half-open port scan | cap_net_raw |
nmap_tcp_scan |
Full TCP connect port scan | none |
nmap_udp_scan |
UDP port scan | cap_net_raw |
nmap_service_detection |
Service/version detection | none |
nmap_os_detection |
OS fingerprinting | cap_net_raw |
nmap_script_scan |
Run named NSE scripts | none |
nmap_vuln_scan |
Run vuln NSE category | none |
nmap_full_recon |
SYN+service+OS+scripts | cap_net_raw |
nmap_custom_scan |
Arbitrary flags (scoped+logged) | varies |
nmap_list_scans |
List recent saved scans | none |
nmap_get_scan |
Retrieve scan by ID | none |
python3 -m pytest tests/ -v
# 28 tests covering scope enforcement, audit logging,
# scan persistence, injection guards, and live scans
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。