Implement network monitoring with NTOPNG using MCP Server for AI-driven data queries
The ntopng MCP Server is an implementation of the Model Context Protocol (MCP) designed to enable AI applications such as Claude Desktop, Continue, and Cursor to interact with network monitoring data stored in an ntopng instance. This server acts as a bridge between AI applications and the rich datasets available from ntopng, transforming raw monitoring information into actionable insights for AI-driven tools.
The core capabilities of the ntopng MCP Server include:
fetch_ntopng_all_ifids
command retrieves all available interface IDs from an ntopng server, providing a comprehensive view of network interfaces.get_ntopng_hosts_location
tool fetches location and additional information for hosts using their IP addresses or MAC addresses.fetch_ntopng_top_local_talkers
and fetch_ntopng_top_remote_talkers
provide insights into the top local talkers on a specified interface, helping to identify critical communications.get_ntopng_host_alert_stats
, get_ntopng_flow_alert_stats
, and get_ntopng_interface_alert_stats
gather detailed statistics about various types of alerts, ensuring that the AI application has a complete understanding of network events.query_ntopng_flows_data
and get_ntopng_top-k_flows
retrieve detailed data on network flows, allowing for in-depth analysis.The ntopng MCP Server follows the Model Context Protocol (MCP) architecture to ensure seamless integration with various AI applications. The core components include:
The protocol flow for interactions is as follows:
The following Mermaid diagram illustrates this flow:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[ntopng Database]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
The server supports integration with the ntopng database, which uses ClickHouse for historical flow and alert data storage. This ensures that the AI application can leverage powerful analytics capabilities.
To set up and run the ntopng
MCP Server on your local machine, follow these steps:
Ensure that you have all required software installed, including Python, pip, and the uv
framework. You can check if uv
is available by running:
which uv
If not, install it using:
npm install -g @modelcontextprotocol/uv
Edit the claude_desktop_config.json
file to configure the connection parameters for ntopng:
{
"mcpServers": {
"ntopng_mcp_server": {
"command": "/path/to/your/uv-binary",
"args": ["run", "--with", "ntopng_mcp_server", "--python", "3.13", "."],
"env": {
"NTOPNG_HOST": "<ntopng-host>",
"NTOPNG_DBPORT": "<ntopng-dbport>",
"NTOPNG_DBUSER": "<ntopng-dbuser>",
"NTOPNG_DBPASSWORD": "<ntopng-dbpassword>",
"NTOPNG_API_KEY": "NTOPNG_TOKEN",
"NTOPNG_SECURE": "true",
"NTOPNG_VERIFY": "true",
"NTOPNG_CONNECT_TIMEOUT": "30",
"NTOPNG_SEND_RECEIVE_TIMEOUT": "300"
}
}
}
}
Replace placeholders with actual values from your ntopng setup.
If you are developing the server, set up the environment variables and run the MCP Inspector:
cd mcp_ntopng
source .env
CLIENT_PORT=8077 SERVER_PORT=8078 uv dev mcp_server.py --with clickhouse-driver --with python-dotenv --with uvicorn --with pip-system-certs
Using the ntopng
MCP Server, an AI application like Continue can monitor real-time network anomalies and proactively notify security teams about potential threats. For example:
AI applications such as Cursor can generate detailed reports based on network flow data, providing insights into user behavior and application performance.
For instance, an engineer could use the fetch_ntopng_top-k_flows
command to identify bottlenecks in a large organization’s network. The resulting report can guide further optimization efforts.
The following AI applications are compatible with the ntopng MCP Server:
The following table outlines the compatibility of the ntopng
MCP Server with different MCP clients:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
The configuration of the ntopng
MCP Server is crucial for secure and efficient operation. Below is an example JSON snippet:
{
"mcpServers": {
"ntopng_mcp_server": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-ntopng"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Ensure that your environment variables are securely managed and not exposed. Use environment variable secrets management tools like Vault or HashiCorp Secrets to handle sensitive information.
Q: How can I ensure compatibility with different MCP clients? A: The ntopng MCP Server supports a range of AI applications, ensuring broad compatibility across various use cases.
Q: Can this server be used for real-time network monitoring?
A: Yes, the ntopng
MCP Server can be configured to stream real-time data, making it suitable for continuous monitoring and analysis.
Q: How do I update the protocol flow in case of new ntopng versions?
A: Keep your claude_desktop_config.json
file updated with the latest version details and ensure that all dependencies are compatible with ntopng.
Q: Are there performance trade-offs when using this server for large-scale implementations? A: For large-scale deployments, consider optimizing query performance by fine-tuning database queries and configuring caching mechanisms.
Q: How can I troubleshoot issues with the MCP Server not connecting to ntopng?
A: Check environment variables and network connectivity. Use logging and debug mode in uv
to identify any connection or configuration errors.
Contributions are welcome from developers who are passionate about integrating AI applications with network monitoring tools. To contribute, follow these steps:
npm install
to install dependenciesnpm test
For more information on the Model Context Protocol and its ecosystem, visit the official documentation and community forums:
The ntopng MCP Server is a powerful tool for integrating AI applications with network monitoring data. Its comprehensive feature set and compatibility ensure that it is well-suited for a wide range of use cases in the AI workflow.
This documentation aims to provide clear guidance on setting up, configuring, and optimizing the ntopng
MCP Server for seamless integration with various AI applications.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Explore community contributions to MCP including clients, servers, and projects for seamless integration
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Integrate AI with GitHub using MCP Server for profiles repos and issue creation
Python MCP client for testing servers avoid message limits and customize with API key
Explore MCP servers for weather data and DigitalOcean management with easy setup and API tools