Skip to main content
Glama
Linux Network Scanner MCP Server

Linux Network Scanner MCP Server

by nibesh0

# NetSecMCP

NetSecMCP is a secure, modular network security assessment platform designed for authorized lab environments. It combines MCP-compatible tools with a lightweight agentic workflow, centralized authorization checks, and an allowlisted execution engine.

What changed

The original repository was refactored away from shell-based, unconstrained scanning primitives toward a safer architecture:

  • Centralized asynchronous subprocess execution using asyncio.create_subprocess_exec

  • No shell=True

  • No string concatenation of untrusted arguments into shell commands

  • Executable allowlist enforcement

  • Explicit IPv4/IPv6 and CIDR validation

  • Private-network default allowlist

  • Scan profile enforcement and timeout limits

  • Persistent scan history via repository abstraction

  • Agentic orchestration skeleton using LangGraph when available

Related MCP server: Kali Pentest MCP Server

Core architecture

NetSecMCP/
├── server.py
├── src/netsecmcp/
│   ├── config.py
│   ├── main.py
│   ├── core/
│   │   ├── executor.py
│   │   ├── permissions.py
│   │   ├── validator.py
│   │   ├── scheduler.py
│   │   └── exceptions.py
│   ├── mcp_server/
│   │   └── server.py
│   ├── scanners/
│   │   ├── nmap.py
│   │   ├── masscan.py
│   │   ├── sslscan.py
│   │   └── nuclei.py
│   ├── parsers/
│   │   └── nmap_parser.py
│   ├── models/
│   │   ├── asset.py
│   │   ├── finding.py
│   │   └── scan.py
│   └── storage/
│       ├── database.py
│       └── repository.py
├── agent/
│   ├── graph.py
│   ├── planner.py
│   ├── state.py
│   └── nodes/
│       ├── scope_validator.py
│       ├── recon.py
│       ├── scanning.py
│       ├── analysis.py
│       ├── verification.py
│       └── reporting.py
├── api/
│   └── main.py
├── pyproject.toml
├── Dockerfile
├── requirements.txt
├── README.md
└── tests/

Security principles

  • Explicit authorization is required for every scan target.

  • Default policy allows only lab-safe private ranges such as 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and loopback ranges.

  • Intrusive operations such as credential brute force, stealth scanning, and exploit execution are intentionally removed from the default tool surface.

  • Commands are limited to an executable allowlist and are validated before execution.

  • Every execution returns structured output and capture limits to prevent runaway or oversized logs.

MCP tools exposed

The server currently includes safe, authorized tools:

  • authorize_target

  • scan_network

  • scan_ports

  • scan_services

  • scan_ssl

  • run_security_assessment

  • assessment_plan

  • Compatibility aliases: networkDiscovery, portScan, osDetection, webScan, sslScan

Typical usage

from netsecmcp.mcp_server.server import mcp

# The tool runner enforces allowed targets and scan limits.
# Example: authorized lab target only.

Running locally

Install the Python dependencies and ensure Nmap is available on PATH:

python -m pip install -r requirements.txt
python server.py

The MCP server uses stdio transport. For Docker:

docker build -t netsecmcp .
docker run --rm -i netsecmcp

Scans are restricted to the CIDRs configured in NetSecConfig.allowed_cidrs in src/netsecmcp/config.py. The defaults permit private IPv4 lab ranges, carrier-grade NAT space, and loopback; public targets are denied. Keep the allowlist narrow and limited to systems you are authorized to assess.

The scanner adapters currently use Nmap for discovery, port, and service scans; OpenSSL is used for the TLS connection check. Additional adapters are present for Masscan, sslscan, and Nuclei, but their executables must be installed in the runtime image before those adapters can be used. Scan history is stored locally in .netsecmcp/scan_history.json.

Validation

Run the unit and execution-policy tests with:

python -m unittest discover -s tests -v

Notes

The LangGraph workflow and API are scaffolding and are not enabled as live assessment interfaces by the MCP server. This project intentionally focuses on safe, authorized assessment patterns for lab and controlled environments. It does not implement credential theft, stealth evasion, persistence, or unauthorized exploitation.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides secure access to Kali Linux security tools through a dockerized environment for authorized penetration testing and defensive security. Enables network scanning, web application testing, system enumeration, and credential testing with built-in input sanitization and network restrictions.
      MIT
    • -
      license
      Not graded
      quality
      D
      maintenance
      Provides secure access to Kali Linux penetration testing tools including nmap, nikto, dirb, wpscan, and sqlmap for educational vulnerability assessment on whitelisted targets. Runs in a controlled Docker environment and includes reconnaissance capabilities for authorized security testing.
      1
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides access to over 40 industry-standard penetration testing tools, including Nmap, SQLMap, and Metasploit, within an isolated Kali Linux Docker container. It enables security professionals to perform comprehensive network reconnaissance, web application testing, and vulnerability research through natural language commands.
      -

    Appeared in Searches