NmapMCP — an Nmap MCP server with structured output

NmapMCP — an Nmap MCP server with structured output

nmapmcp•by0xpratikpatil

An MCP server for Nmap that parses nmap XML output into structured JSON and offers 35 specialized tools plus scan history, diffing, and security guardrails.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Parses Nmap XML output into structured JSON including OS fingerprints, MAC vendor lookups, CPE strings, per-port NSE script results, traceroute hops, and uptime.
  • •Provides 35 purpose-built tools such as ssl_scan, smb_vuln_scan, database_scan, dns_enum, rdp_scan, ftp_scan, and ssh_audit, each pre-configured with the right scripts and flags.
  • •Tracks scan history and produces structured diffs of ports that opened, closed, or changed version between scans.
  • •Enforces guardrails including a flag allowlist, target validation, a default private-range restriction blocking public IPs, concurrency capped at 3, and a hard 1800s timeout.

BEST FOR

  • •Security learners and authorized testers scanning hosts and networks they own or have explicit written permission to test.
  • •AI assistant users who want structured scan results and change detection instead of raw nmap text.
  • •Efficient network inventory tasks where a ping sweep precedes service detection on responding hosts.

ABOUT NMAPMCP

NmapMCP — an Nmap MCP server with structured output is cataloged as an MCP server attributed to 0xpratikpatil. An MCP server for Nmap that parses nmap XML output into structured JSON and offers 35 specialized tools plus scan history, diffing, and security guardrails. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for NmapMCP — an Nmap MCP server with structured output are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How does NmapMCP differ from typical Nmap MCP servers?

It parses nmap XML into structured JSON, offers 35 purpose-built tools instead of one generic scan tool, and adds safety guardrails and scan history.

Can NmapMCP scan public IP addresses?

Public IPs are blocked by default; scanning them requires explicitly setting NMAP_ALLOW_PUBLIC=1.

Does NmapMCP have a persistent audit log?

No; scan history is in-memory only and does not persist across restarts.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 0971a5221d6f · 采集于 2026-11-13 12:10:43 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

NmapMCP

A production-grade Nmap MCP (Model Context Protocol) server — not a thin wrapper.

Most Nmap MCP servers pipe nmap output straight to an AI as raw text and call it done. NmapMCP parses nmap's XML output into structured JSON, ships 35 purpose-built tools instead of one generic nmap_scan, and adds the safety rails a tool that runs arbitrary network scans actually needs.

⚠️ Educational use only. Only scan hosts and networks you own or are explicitly authorized to test. See Responsible Use below.


Why this one is different

Structured output, not raw text. nmap's XML output is fully parsed into clean JSON — OS fingerprints, MAC vendor lookups, CPE strings, per-port NSE script results, traceroute hops, uptime — so an AI assistant can reason over fields instead of regex-ing a wall of stdout.

35 specialized tools, not one generic scan. Instead of forcing the AI to remember correct NSE script names and flag combos, there's a purpose-built tool per use case: ssl_scan, smb_vuln_scan, database_scan, dns_enum, rdp_scan, ftp_scan, ssh_audit, and more — each pre-configured with the right scripts and flags.

Scan history and diffing. list_scan_history, get_scan_result, and diff_scans let you run a scan, run it again later, and ask "what changed?" — producing a structured diff of ports that opened, closed, or changed version. Most Nmap MCP servers don't track history at all.

Security guardrails baked in.

  • Flag allowlist — every nmap flag is checked against an explicit allowlist before it reaches the shell; nothing arbitrary gets through
  • Target validation — regex-checked, length-capped input
  • Private-range guard — public IPs are blocked by default; scanning them requires explicitly setting NMAP_ALLOW_PUBLIC=1
  • Concurrency limiting — a semaphore caps parallel scans at 3, so an AI can't accidentally saturate the network with simultaneous full-port scans
  • Hard timeout — every scan is killed after 1800s if it hangs

Two-phase network inventory. network_inventory runs a ping sweep first, then only runs service detection against hosts that responded — far more efficient than blindly throwing a service scan at an entire /24.

Human-readable summaries. get_host_summary returns a formatted text report (hostname, OS guess, open ports, script highlights, traceroute) designed to be read directly by a person, not just parsed by a model.


Tool reference

CategoryTools
General scanningnmap_scan, structured_scan, quick_scan, top_ports_scan, full_port_scan, check_single_port
Host discoveryping_sweep, arp_scan, network_inventory
Scan techniquessyn_stealth_scan, udp_scan, ipv6_scan
Service / OSservice_scan, os_detection, aggressive_scan, banner_grab
Vulnerabilityvuln_scan, safe_vuln_scan, smb_vuln_scan
Protocol auditsssl_scan, http_enum, dns_enum, smb_enum, ftp_scan, ssh_audit, rdp_scan, database_scan
Network analysisfirewall_detection, traceroute_scan
Scriptingscript_scan (run any NSE script/category by name)
History & reportinglist_scan, list_scan_history, get_scan_result, diff_scans, get_host_summary

Example prompts once connected to Claude:

run a quick_scan on 192.168.1.100
get_host_summary on 192.168.1.1
run a vuln_scan on 192.168.1.50
network_inventory of 192.168.1.0/24
diff_scans between scan_id_a and scan_id_b

Setup

Requirements

RequirementVersionNotes
Python3.13+
Nmap7.9+The actual scanner binary
uvLatestPython package manager
Claude DesktopLatestOr any MCP-compatible client

1. Install Python 3.13+

Download from python.org. On Windows, check "Add Python to PATH" during install. Verify:

python --version

2. Install Nmap

Download from nmap.org. Keep Npcap checked during install (Windows). Verify:

nmap --version

3. Install uv

pip install uv

4. Get the project

git clone https://github.com/<your-username>/NmapMCP.git
cd NmapMCP

5. Point the server at your Nmap binary

By default the server looks for Nmap via the NMAP_PATH environment variable (falls back to a Windows default). Set it to your actual nmap path — on macOS/Linux this is usually just nmap or /usr/bin/nmap; on Windows it needs the 8.3 short path with forward slashes, e.g. C:/PROGRA~1/Nmap/nmap.exe (find yours with where nmap, then convert to short path if it contains spaces).

Set it as an environment variable rather than editing the source:

export NMAP_PATH=/usr/bin/nmap   # macOS/Linux
set NMAP_PATH=C:/PROGRA~1/Nmap/nmap.exe   # Windows

6. Install dependencies

uv venv
uv pip install -e .

7. Configure your MCP client

Add to your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "NmapMCP": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/NmapMCP", "run", "main.py"]
    }
  }
}

Restart Claude Desktop and look for the tools icon to confirm it loaded.

Docker

A Dockerfile is included for containerized deployment; see it for details.


Responsible Use

This project is published for educational and authorized-testing purposes only. Network scanning tools like Nmap can be misused to probe systems without authorization, which is illegal in most jurisdictions.

  • Only run scans against hosts, networks, or services you own or have explicit written permission to test
  • Public-IP scanning is disabled by default (NMAP_ALLOW_PUBLIC=1 required to override) — leave this off unless you specifically need it and have authorization
  • The maintainer(s) of this repository are not responsible for misuse

Troubleshooting

"nmap not found" — Confirm nmap --version works in your terminal, and that NMAP_PATH points to the correct binary.

"0 hosts up" on everything (Windows) — Usually a Npcap permissions issue. Use quick_scan or get_host_summary (TCP-connect based, no admin needed) instead of ping_sweep/arp_scan, or run your terminal/Claude Desktop as Administrator.

Tools icon doesn't appear in Claude Desktop — Validate your config JSON, confirm the path is correct and absolute, then fully quit and reopen Claude Desktop.

Some scans need elevated privileges — syn_stealth_scan, udp_scan, arp_scan, and os_detection typically require admin/root.


Roadmap / Known Limitations

Being transparent about where this stands:

  • No automated test suite yet
  • Single-file architecture (main.py) — works well, but a future split into runner/parser/validator/tools modules would improve maintainability
  • Scan history is in-memory only and does not persist across restarts; no persistent audit log yet
  • No per-target rate limiting (only global parallelism is capped)

License

MIT — see LICENSE.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for NmapMCP — an Nmap MCP server with structured output from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/nmapmcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools