NTOPNG
STDIONTOPNG MCP server for querying network monitoring data and alerts
NTOPNG MCP server for querying network monitoring data and alerts
NTOPNG Model Context Protocol Server
A Model Context Protocol server implementation for NTOPNG that enables AI agents to query networks monitoring data using the NTOPNG database.
This MCP Server assumes that ntopng is using ClickHouse to store historical flows and alert. Check ntopng Clickhouse
fetch_ntopng_all_ifidsget_ntopng_hosts_locationfetch_ntopng_top_local_talkersfetch_ntopng_top_remote_talkersget_ntopng_all_alert_statsget_ntopng_flow_alert_statsget_ntopng_host_alert_statsget_ntopng_interface_alert_statsget_ntopng_mac_alert_statsget_ntopng_network_alert_statsget_ntopng_snmp_device_alert_listget_ntopng_snmp_device_alert_statsget_ntopng_system_alert_statsquery_ntopng_flows_dataget_ntopng_top-k_flowsget_ntopng_user_alert_statsget_ntopng_flow_devices_statsget_ntopng_sflow_devices_statslist_tables_ntopng_databasequery_ntopng_databaseWorks with Claude Desktop app and other MCP compliant hosts and clients.
No support for MCP resources or prompts yet.
Create or edit the Claude Desktop configuration file located at:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.jsonAdd the following:
{ "mcpServers": { "mcp-ntopng": { "command": "/path/to/your/uv-binary", "args": ["run", "--with", "mcp-ntopng", "--python", "3.13", "mcp-ntopng"] "env": { "NTOPNG_HOST": "<ntopng-host>", "NTOPNG_DBPORT": "<ntopng-dbport>", "NTOPNG_DBUSER": "<ntopng-dbuser>", "NTOPNG_DBPASSWORD": "<ntopng-dbpassword>", "NTOPNG_SECURE": "true", "NTOPNG_VERIFY": "true", "NTOPNG_CONNECT_TIMEOUT": "30", "NTOPNG_SEND_RECEIVE_TIMEOUT": "300", "NTOPNG_API_KEY": "NTOPNG_TOKEN" } } } }
Replace /path/to/your/uv-binary with the absolute path to the uv executable. Find the path with which uv. This ensures that the correct version of uv is used when starting the server.
Restart Claude Desktop to apply the changes.
claude_desktop_config.json file or in a .env file in the root of the repository.NTOPNG_HOST=localhost
NTOPNG_PORT=9000
NTOPNG_USER=default
NTOPNG_PASSWORD=
Run uv sync to install the dependencies. To install uv follow the instructions here. Then do source .venv/bin/activate.
Install the mcp-ntopng package with uv pip install -e . from the project main directory.
For easy testing, you can run mcp dev mcp_ntopng/mcp_server.py to start the MCP server. CHANGE WITH A PROPER CHAT CLIENT
The following environment variables are used to configure the database connection:
NTOPNG_HOST: The hostname of the ntopng serverNTOPNG_DBUSER: The username for Clickhouse DB authenticationNTOPNG_DBPASSWORD: The password for Clickhouse DB authenticationNTOPNG_API_KEY: The ntopng authentication token.NTOPNG_DBPORT: The port number of the Clickhouse DB in the  ntopng server
9000 if HTTPS is enabled, 8123 if disabledNTOPNG_SECURE: Enable/disable a TLS connection
falsetrue for a secure TLS connectionsNTOPNG_VERIFY: Enable/disable SSL certificate verification
trueNTOPNG_CONNECT_TIMEOUT: Connection timeout in seconds
NTOPNG_SEND_RECEIVE_TIMEOUT: Send/receive timeout in seconds
300Check TLS Setup in the
ntopngdocumentation for details about setting up a TLS connection to Clickhouse.
Install the package on the local machine:
$ uv sync
$ uv pip install -e .
Run the MCP Inspector
$ cd mcp_ntopng
$ source .env
$ CLIENT_PORT=8077 SERVER_PORT=8078  mcp dev run_mcp_ntopng.py --with clickhouse-driver --with python-dotenv --with uvicorn --with pip-system-certs
Use the local library in Claude Desktop.
Find: /Users/marco/Library/Application\ Support/Claude/claude_desktop_config.json
Edit the claude_desktop_config.json changing the local paths:
{
    "mcpServers": {
      "mcp-ntopng": {
        "command": "/Users/marco/Development/claude/mcp-server-ntopng/.venv/bin/python",
        "args": [
           "/Users/marco/Development/claude/mcp-server-ntopng/run_mcp_ntopng.py"
        ],
        "env": {
          "NTOPNG_HOST": "marcoeg-nod004.ntoplink.com",
          "NTOPNG_DBPORT": "9000",
          "NTOPNG_DBUSER": "default",
          "NTOPNG_DBPASSWORD": "",
          "NTOPNG_SECURE": "false",
          "NTOPNG_VERIFY": "false",
          "NTOPNG_CONNECT_TIMEOUT": "30",
          "NTOPNG_SEND_RECEIVE_TIMEOUT": "300",
          "SELECT_QUERY_TIMEOUT_SECS": "30",
          "NTOPNG_API_KEY": "NTOPNG_TOKEN"
        }
      }
    }
  }