Skip to main content
Glama
Nmap MCP Server

Nmap MCP Server

by imjdl

Nmap MCP サーバー

これは、nmap ネットワーク スキャン機能へのアクセスを提供するモデル制御プロトコル (MCP) サーバーです。

特徴

  • カスタマイズ可能なオプションを使用して、指定したターゲットで 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

利用可能なツール

  1. nmapスキャンを実行する

    • 指定したターゲットに対して nmap スキャンを実行する

    • パラメータ:

      • target : ターゲットホストまたはネットワーク(例:192.168.1.1 または 192.168.1.0/24)

      • options : Nmapオプション(例:-sV -p 1-1000)

  2. スキャンの詳細を取得する

    • 特定のスキャンに関する詳細情報を取得する

    • パラメータ:

      • scan_id : 取得するスキャンのID

  3. すべてのスキャンをリストする

    • 利用可能なすべてのスキャン結果を一覧表示する

    • パラメータは必要ありません

利用可能なプロンプト

  1. 分析スキャン

    • nmapスキャン結果を分析する

    • パラメータ:

      • scan_id : 分析するスキャンのID

      • focus : 重点分野(セキュリティ/サービス/概要)

リソース

スキャン結果はnmap://scan/{scan_id} URI スキームを持つリソースとして利用できます。

ワークフローの例

  1. スキャンを実行します:

    Call tool: run-nmap-scan
    Parameters: {"target": "192.168.1.0/24", "options": "-sV -p 22,80,443"}
  2. スキャンの詳細を取得します:

    Call tool: get-scan-details
    Parameters: {"scan_id": "<scan_id from previous step>"}
  3. すべてのスキャンを一覧表示します:

    Call tool: list-all-scans
  4. スキャン結果を分析します。

    Get prompt: analyze-scan
    Parameters: {"scan_id": "<scan_id>", "focus": "security"}

セキュリティに関する考慮事項

このサーバーは、システム上で nmap コマンドを実行します。所有していないネットワークやスキャン権限のないネットワークをスキャンする場合は、一部の法域では許可されていないスキャンが違法となる可能性があるため、ご注意ください。

トラブルシューティング

nmap が見つからない、または正しく実行されないことに関連するエラーが発生した場合:

  1. nmapがインストールされ、PATHで利用可能であることを確認してください

  2. nmap実行ファイルが使用されているログを確認します

  3. サーバーは衝突を避けるためにnmapへのフルパスを使用しようとします

Dockerの使用

MCP サーバーを Docker コンテナ内で実行できます。

# 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 tools
get-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

    B3.4/5.0

    Scored across 3 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count3/5

    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.

    Completeness4/5

    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

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Exposes 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.
      11
      7
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      3
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A 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.
      6
      17
      Apache 2.0