Skip to main content
Glama
mohdhaji87

Nmap MCP Server

by mohdhaji87

nmap_script_scan

Execute NSE scripts to perform targeted network scans, detect services, and identify vulnerabilities using the Nmap Scripting Engine via the Nmap MCP Server.

Instructions

Run NSE (Nmap Scripting Engine) scripts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portsNocommon
scriptsNodefault
targetsYes

Implementation Reference

  • The handler function for the nmap_script_scan tool. It constructs Nmap arguments using the provided scripts, ports, and targets, executes the scan via run_nmap_command, and returns formatted stdout or stderr.
    async def nmap_script_scan( targets: str, scripts: str = "default", ports: str = "common" ) -> str: """Run NSE (Nmap Scripting Engine) scripts.""" args = [f"--script={scripts}", "-p", ports, targets] result = run_nmap_command(args) if result["success"]: return f"NSE script scan completed:\n\n{result['stdout']}" else: return f"NSE script scan failed:\n\n{result['stderr']}"
  • server.py:159-162 (registration)
    Registration of the nmap_script_scan tool using the @app.tool decorator from FastMCP, specifying the name and description.
    @app.tool( name="nmap_script_scan", description="Run NSE (Nmap Scripting Engine) scripts" )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mohdhaji87/Nmap-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server