nmap-mcp 0.1.0

Nmap network scanner and NSE scripting engine control for AI assistants via MCP
# Setup guide

This guide covers installing nmap, building nmap-mcp, and wiring the server
into Open Grok.

## Prerequisites

- Rust toolchain 1.88 or newer (rmcp 3.1 requires 1.88).
- nmap 7.x installed and reachable as `nmap` on `PATH` (or pointed at via
  `NMAP_MCP_BIN`).

## Installing nmap

Debian/Ubuntu:

```console
sudo apt-get install nmap
```

Verify:

```console
nmap --version
Nmap version 7.95 ( https://nmap.org )
```

Without root (userspace extraction on Debian-family systems, useful for CI
and containers):

```console
mkdir -p /tmp/nmap-deb && cd /tmp/nmap-deb
apt-get download nmap nmap-common liblinear4 liblua5.4-0 libpcap0.8t64 libssh2-1t64
for d in *.deb; do dpkg-deb -x "$d" /opt/nmap-local; done
export LD_LIBRARY_PATH=/opt/nmap-local/usr/lib/x86_64-linux-gnu
/opt/nmap-local/usr/bin/nmap --version
```

Then set `NMAP_MCP_BIN=/opt/nmap-local/usr/bin/nmap` (and keep
`LD_LIBRARY_PATH` exported) when running the server or tests.

## Building

Iterative development (keeps the incremental cache):

```console
cargo build
```

Release binary with the standard builder (produces `bin/nmap-mcp` and
removes `target/`):

```console
bash build/linux/build.sh
```

or from the shared builder:

```console
bash /data/build/linux/build.sh -p /data/nmap-mcp-rs
```

## Installing

```console
cargo install --path .
```

or copy the built binary:

```console
cp bin/nmap-mcp ~/.local/bin/
```

## Registering with Open Grok

Add to `~/.opengrok/config.toml`:

```toml
[mcp_servers.nmap-mcp]
command = "nmap-mcp"
enabled = true
```

Check the server:

```console
open-grok mcp doctor nmap-mcp
```

Refresh the MCP list in the client with `/mcps` (press `r`) or restart. The
tools appear as `nmap__nmap_status`, `nmap__nmap_list_scripts`,
`nmap__nmap_script_info`, `nmap__nmap_ping_scan`, `nmap__nmap_port_scan`,
`nmap__nmap_service_scan`, `nmap__nmap_os_scan`, `nmap__nmap_script_scan`,
and `nmap__nmap_full_scan`.

## Environment variables

- `NMAP_MCP_BIN` — path to the nmap executable (default `nmap` from `PATH`).
- `NMAP_MCP_SCRIPT_DB` — path to nmap's `script.db` (default: auto-detected
  from the binary location or standard system paths).