- Explore MCP Servers
- nmap-mcp-server
Nmap Mcp Server
What is Nmap Mcp Server
nmap-mcp-server is an example Model Context Protocol (MCP) server that integrates Nmap scanning tools, allowing users to perform network scans through a web-based AI assistant interface powered by OpenAI.
Use cases
Use cases for nmap-mcp-server include performing security assessments, troubleshooting network issues, discovering services on a network, and enumerating SMB shares.
How to use
To use nmap-mcp-server, users can interact with the web-based chat interface provided by Gradio. The AI assistant processes user requests and utilizes the Nmap tools for network scanning as needed.
Key features
Key features of nmap-mcp-server include a conversational AI assistant, filesystem access tool, various Nmap scanning capabilities (ping, port scans, service discovery, SMB share enumeration), and a user-friendly web interface.
Where to use
nmap-mcp-server can be used in cybersecurity, network administration, and IT support fields, where network scanning and analysis are essential.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Nmap Mcp Server
nmap-mcp-server is an example Model Context Protocol (MCP) server that integrates Nmap scanning tools, allowing users to perform network scans through a web-based AI assistant interface powered by OpenAI.
Use cases
Use cases for nmap-mcp-server include performing security assessments, troubleshooting network issues, discovering services on a network, and enumerating SMB shares.
How to use
To use nmap-mcp-server, users can interact with the web-based chat interface provided by Gradio. The AI assistant processes user requests and utilizes the Nmap tools for network scanning as needed.
Key features
Key features of nmap-mcp-server include a conversational AI assistant, filesystem access tool, various Nmap scanning capabilities (ping, port scans, service discovery, SMB share enumeration), and a user-friendly web interface.
Where to use
nmap-mcp-server can be used in cybersecurity, network administration, and IT support fields, where network scanning and analysis are essential.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
AI Assistant Chat with Nmap Tool Integration
This project provides a web-based chat interface using Gradio where users can interact with an AI assistant powered by the OpenAI API. The assistant is equipped with tools to interact with the local filesystem and perform network scans using a containerized Nmap server.
Overview
The application uses the OpenAI Agents SDK framework. User requests are processed by an AI agent that can reason about the request and decide whether to use available tools. It features:
- A Gradio frontend for easy interaction.
- An AI agent backend leveraging an OpenAI model (requires API key).
- A Model Context Protocol (MCP) server for filesystem access (using
@modelcontextprotocol/server-filesystem). - A containerized MCP server providing Nmap scanning capabilities (ping, port scans, service discovery, SMB share enumeration)[cite: 14, 16, 18, 20, 22].
The Nmap server runs inside a Docker container for easy dependency management and isolation.
Features
- Conversational AI assistant.
- Filesystem access tool (scoped to the application directory).
- Network scanning tools via Nmap:
ping_host[cite: 14]scan_network(Top 100 ports) [cite: 16]all_scan_network(-A comprehensive scan) [cite: 18]all_ports_scan_network(All 65535 ports) [cite: 20]smb_share_enum_scan(SMB Share Enumeration) [cite: 22]
- Web-based UI using Gradio[cite: 11, 12].
- Containerized Nmap tool server using Docker.
Architecture
- Gradio UI (
app.txt): Handles user input and displays conversation history. - Main Application (
app.txt):- Initializes Gradio interface.
- Manages conversation state.
- Sets up and manages MCP servers.
- Instantiates and runs the OpenAI Agent.
- OpenAI Agent (
agentslibrary): Processes user messages, calls tools when needed, and generates responses[cite: 1, 3]. - MCP Servers:
- Filesystem Server: Runs via
npxto provide local file access[cite: 1]. - Nmap Toolkit Server (
nmap-server.txtin Docker): Runs inside a Docker container, exposing Nmap scan functions as tools via MCP[cite: 2, 14].app.txtusesdocker runto start this server for each request.
- Filesystem Server: Runs via
Prerequisites
- Python: 3.9+
- Docker: Latest version installed and running.
- Node.js/npm: Required for
npxto run the filesystem MCP server. - OpenAI API Key: Set as an environment variable
OPENAI_API_KEY.
Installation & Setup
-
Clone the repository:
git clone <your-repository-url> cd <your-repository-directory> -
Set OpenAI API Key:
Export your API key as an environment variable. Replaceyour_api_key_herewith your actual key.- Linux/macOS:
export OPENAI_API_KEY='your_api_key_here' - Windows (Command Prompt):
set OPENAI_API_KEY=your_api_key_here - Windows (PowerShell):
$env:OPENAI_API_KEY='your_api_key_here'
- Linux/macOS:
-
Build the Nmap Docker Image:
Navigate to the directory containingnmap-server.pyandDockerfile, then run:docker build -t nmap-mcp-server .(Ensure the
Dockerfilecontent is correct, especially the MCP package name if it’s notmodelcontextprotocol) -
Install Python Dependencies:
It’s recommended to use a virtual environment.python -m venv venv # Activate the virtual environment # Linux/macOS: source venv/bin/activate # Windows: .\venv\Scripts\activate # Install requirements pip install -r requirements.txt
Running the Application
Ensure your OpenAI API key is set, Docker is running, and you are in the project’s root directory with the virtual environment activated.
python app.py An example MCP server with a couple nmap scans as tools.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










