mcp-ntopng

by marcoeg
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables querying the ntopng Clickhouse database to access historical network flows and alerts for network monitoring data analysis.

mcp-服务器-ntopng

NTOPNG 模型上下文协议服务器

NTOPNG模型上下文协议服务器实现,使 AI 代理能够使用 NTOPNG 数据库查询网络监控数据。

此 MCP 服务器假设ntopng使用 ClickHouse 来存储历史流量和警报。请查看ntopng 的 ClickHouse

工具

  • fetch_ntopng_all_ifids
  • 从 ntopng 中检索所有可用的接口 ID。
  • get_ntopng_hosts_location
  • 获取主机的地理位置和附加信息。
  • fetch_ntopng_top_local_talkers
  • 检索指定接口的前 10 个本地对话者。
  • fetch_ntopng_top_remote_talkers
  • 检索指定接口的前 10 个远程对话者。
  • get_ntopng_all_alert_stats
  • 检索所有警报的统计信息。
  • get_ntopng_flow_alert_stats
  • 检索流量警报的统计数据。
  • get_ntopng_host_alert_stats
  • 检索主机警报的统计数据。
  • get_ntopng_interface_alert_stats
  • 检索接口警报的统计数据。
  • get_ntopng_mac_alert_stats
  • 检索 MAC 警报的统计数据。
  • get_ntopng_network_alert_stats
  • 检索网络警报的统计数据。
  • get_ntopng_snmp_device_alert_list
  • 检索 SNMP 设备警报列表。
  • get_ntopng_snmp_device_alert_stats
  • 检索 SNMP 设备警报的统计信息。
  • get_ntopng_system_alert_stats
  • 检索系统警报的统计数据。
  • query_ntopng_flows_data
  • 从 ntopng 流量数据库中检索详细的流量数据。
  • get_ntopng_top-k_flows
  • 从 ntopng 流数据库中检索前 k 个流数据。
  • get_ntopng_user_alert_stats
  • 检索用户警报的统计数据。
  • get_ntopng_flow_devices_stats
  • 检索所有流设备的统计数据。
  • get_ntopng_sflow_devices_stats
  • 检索所有 sFlow 设备的统计信息。
  • list_tables_ntopng_database
  • 列出 ntopng 数据库的表结构。
  • query_ntopng_database
  • 查询 ntopng Clickhouse 数据库。

地位

可与 Claude Desktop 应用程序和其他符合 MCP 的主机和客户端配合使用。

尚不支持 MCP资源提示

配置

  1. 创建或编辑位于以下位置的 Claude Desktop 配置文件:
    • 在 macOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
    • 在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
  2. 添加以下内容:
{ "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" } } } }
  1. /path/to/your/uv-binary替换为uv可执行文件的绝对路径。使用which uv查找路径。这可确保启动服务器时使用正确版本的uv
  2. 重新启动 Claude Desktop 以应用更改。

发展

  1. claude_desktop_config.json文件或存储库根目录中的.env文件中设置环境变量。
NTOPNG_HOST=localhost NTOPNG_PORT=9000 NTOPNG_USER=default NTOPNG_PASSWORD=
  1. 运行uv sync来安装依赖项。要安装uv ,请按照此处的说明操作。然后执行source .venv/bin/activate
  2. 使用uv pip install -e .从项目主目录安装mcp-ntopng包。
  3. 为了方便测试,您可以运行mcp dev mcp_ntopng/mcp_server.py来启动 MCP 服务器。请使用合适的聊天客户端进行更改

环境变量

以下环境变量用于配置数据库连接:

  • NTOPNG_HOSTntopng服务器的主机名
  • NTOPNG_DBUSER :Clickhouse DB 身份验证的用户名
  • NTOPNG_DBPASSWORD :Clickhouse DB 身份验证的密码
  • NTOPNG_API_KEYntopng身份验证令牌。

选修的

  • NTOPNG_DBPORTntopng服务器中 Clickhouse DB 的端口号
    • 默认值:如果启用 HTTPS, 9000 ;如果禁用, 8123
    • 通常不需要设置,除非使用非标准端口
  • NTOPNG_SECURE :启用/禁用 TLS 连接
    • 默认值: false
    • 设置为true以实现安全的 TLS 连接
  • NTOPNG_VERIFY :启用/禁用 SSL 证书验证
    • 默认值: true
    • 设置为 `false 以禁用证书验证(不建议用于生产)
  • NTOPNG_CONNECT_TIMEOUT :连接超时(秒)
    • 默认值:`30
    • 如果遇到连接超时,请增加此值
  • NTOPNG_SEND_RECEIVE_TIMEOUT :发送/接收超时(秒)
    • 默认值: 300
    • 对于长时间运行的查询,请增加此值

有关设置与 Clickhouse 的 TLS 连接的详细信息,请查看ntopng文档中的TLS 设置

发展

在本地机器上安装包:

$ uv sync $ uv pip install -e .

运行 MCP 检查器

$ 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

使用 Claude Desktop 中的本地库。

查找:/Users/marco/Library/Application\Support/Claude/claude_desktop_config.json

编辑 claude_desktop_config.json 更改本地路径:

{ "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" } } } }
-
security - not tested
A
license - permissive license
-
quality - not tested

网络监控软件 ntopng 的 MCP 服务器。

  1. Tools
    1. Status
      1. Configuration
        1. Development
          1. Environment Variables
          2. Development
        ID: bahb2ut908