The NTOPNG Model Context Protocol (MCP) Server enables AI agents to query network monitoring data stored in NTOPNG's ClickHouse database. This server implementation bridges the gap between AI systems and network monitoring, allowing natural language queries about network traffic, alerts, and device statistics.
You can install the MCP NTOPNG server using pip:
pip install mcp-ntopng
For the most recent version, we recommend using uv
:
uv pip install mcp-ntopng
To use the MCP NTOPNG server with Claude Desktop, you'll need to configure the connection to your NTOPNG instance:
Locate your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add the NTOPNG MCP server configuration to this file:
{
"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 the placeholders:
/path/to/your/uv-binary
: Find with which uv
in your terminal<ntopng-host>
: Your NTOPNG server hostname<ntopng-dbport>
: ClickHouse database port (typically 9000)<ntopng-dbuser>
: ClickHouse database username<ntopng-dbpassword>
: ClickHouse database passwordRestart Claude Desktop to apply the changes.
The server uses these environment variables for configuration:
NTOPNG_HOST
: Hostname of the NTOPNG serverNTOPNG_DBUSER
: Username for ClickHouse DB authenticationNTOPNG_DBPASSWORD
: Password for ClickHouse DB authenticationNTOPNG_API_KEY
: NTOPNG authentication tokenNTOPNG_DBPORT
: Port number for ClickHouse (default: 9000 for HTTPS, 8123 otherwise)NTOPNG_SECURE
: Enable TLS connection (default: "false")NTOPNG_VERIFY
: Enable SSL certificate verification (default: "true")NTOPNG_CONNECT_TIMEOUT
: Connection timeout in seconds (default: 30)NTOPNG_SEND_RECEIVE_TIMEOUT
: Send/receive timeout in seconds (default: 300)The MCP NTOPNG server provides several tools to query network data:
fetch_ntopng_all_ifids
: Retrieve all available interface IDsfetch_ntopng_top_local_talkers
: Get top 10 local talkers for a specified interfacefetch_ntopng_top_remote_talkers
: Get top 10 remote talkers for a specified interfaceget_ntopng_hosts_location
: Fetch geographical location and additional info for hostsget_ntopng_all_alert_stats
: Retrieve statistics for all alertsget_ntopng_flow_alert_stats
: Get statistics for flow alertsget_ntopng_host_alert_stats
: Get statistics for host alertsget_ntopng_interface_alert_stats
: Get statistics for interface alertsget_ntopng_mac_alert_stats
: Get statistics for MAC alertsget_ntopng_network_alert_stats
: Get statistics for network alertsget_ntopng_snmp_device_alert_list
: Get list of SNMP device alertsget_ntopng_snmp_device_alert_stats
: Get statistics for SNMP device alertsget_ntopng_system_alert_stats
: Get statistics for system alertsget_ntopng_user_alert_stats
: Get statistics for user alertsquery_ntopng_flows_data
: Retrieve detailed flows dataget_ntopng_top-k_flows
: Get top-k flows dataget_ntopng_flow_devices_stats
: Get statistics for all flow devicesget_ntopng_sflow_devices_stats
: Get statistics for all sFlow deviceslist_tables_ntopng_database
: List tables structure of the NTOPNG databasequery_ntopng_database
: Execute custom queries against the NTOPNG ClickHouse databaseAfter configuring the MCP server in Claude Desktop, you can ask questions about your network monitoring data in natural language.
Example queries:
The AI assistant will use the appropriate tools to query your NTOPNG database and provide insights based on the data.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "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"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"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"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"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"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect