Skip to main content
Glama
mohdhaji87

Nmap MCP Server

by mohdhaji87

nmap_script_scan

Execute NSE scripts to detect vulnerabilities, identify services, and analyze network security on specified targets.

Instructions

Run NSE (Nmap Scripting Engine) scripts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetsYes
scriptsNodefault
portsNocommon

Implementation Reference

  • The handler function for the nmap_script_scan tool. It takes targets, scripts, and ports as input, constructs Nmap arguments for NSE scripts, runs the command via run_nmap_command, and returns the formatted output or error.
    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)
    The @app.tool decorator that registers the nmap_script_scan function as a tool, providing the name and description. The input schema is inferred from the function's type annotations.
    @app.tool( name="nmap_script_scan", description="Run NSE (Nmap Scripting Engine) scripts" )
  • The function signature defining the input parameters (targets: str, scripts: str='default', ports: str='common') and return type (str), which serves as the tool schema.
    async def nmap_script_scan( targets: str, scripts: str = "default", ports: str = "common" ) -> str:

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