网络观测协议服务器

Kentik网络观测平台的模型上下文协议(MCP)服务器,提供8种整合工具,包括流量查询、设备库存、DDoS警报、BGP路由、合成监控、AI分析等,可通过Claude Code、Claude Desktop或任何MCP兼容客户端访问。

  • by hervehildenbrand
  • Go
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 hervehildenbrand/kentik-mcp

使用说明

kentik-mcp

模型上下文协议(MCP)服务器 肯特克 网络可观测性平台。提供8个整合的工具,涵盖流量查询、设备清单、DDoS警报、BGP路由、综合监控、人工智能分析等,所有这些工具都可以从Claude Code、Claude Desktop或任何兼容MCP的客户端访问。

安装

先决条件

  • 去 1.21或更高版本
  • A. 肯特克 具有API访问权限的帐户

从源代码构建

git clone https://github.com/hervehildenbrand/kentik-mcp.git
cd kentik-mcp
go build -o kentik-mcp .

获取您的Kentik API代币

  1. 登录 portal.kentik.com (美国)或 portal.kentik.eu (欧盟)
  2. 首选 用户档案 (右上菜单)> API访问
  3. 复制您的 API代币 (如果你没有,也可以创建一个)
  4. 注意你的 账户邮箱 --你两者都需要

在Claude桌面上安装

  1. 构建二进制文件(见上文)

  2. 打开您的Claude Desktop配置文件:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • 窗户: %APPDATA%\Claude\claude_desktop_config.json
  3. 添加 kentik 服务器到 mcpServers 章节:

{
  "mcpServers": {
    "kentik": {
      "command": "/absolute/path/to/kentik-mcp",
      "env": {
        "KENTIK_EMAIL": "your-email@company.com",
        "KENTIK_API_TOKEN": "your-api-token-here",
        "KENTIK_REGION": "EU"
      }
    }
  }
}
  1. 重新启动克劳德桌面 --你应该看到一个带有8个Kentik工具的锤子图标

  2. 试着问: “我现在最大的流量来源是什么?” 或 “显示任何活动的DDoS警报”

在Claude代码上安装

添加到您的项目 .mcp.json:

{
  "mcpServers": {
    "kentik": {
      "command": "/absolute/path/to/kentik-mcp",
      "env": {
        "KENTIK_EMAIL": "your-email@company.com",
        "KENTIK_API_TOKEN": "your-api-token-here",
        "KENTIK_REGION": "EU"
      }
    }
  }
}

快速测试

# Verify it works (should list 8 tools)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | \
  KENTIK_EMAIL=your-email KENTIK_API_TOKEN=your-token KENTIK_REGION=EU \
  ./kentik-mcp

配置

环境变量

变量 必填 描述
KENTIK_EMAIL 是* Kentik帐户电子邮件
KENTIK_API_TOKEN 是* Kentik门户网站的API令牌(用户配置文件>API)
KENTIK_REGION 没有 EU (默认)或 US -选择API终结点
KENTIK_PROFILE 否 配置文件中的命名配置文件(默认值: default)
KENTIK_V5_URL 否 覆盖V5 REST API基础URL
KENTIK_V6_URL 否 覆盖V6 gRPC网关基本URL

*除非通过配置文件提供,否则为必填项。

配置文件(~/.kentik mcp.json)

对于多用户或多区域设置,请创建 ~/.kentik-mcp.json:

{
  "profiles": {
    "default": {
      "email": "user@company.com",
      "api_token": "your-eu-token",
      "region": "EU"
    },
    "us-prod": {
      "email": "user@company.com",
      "api_token": "your-us-token",
      "region": "US"
    }
  }
}

交换机配置文件: export KENTIK_PROFILE=us-prod

环境变量始终优先于配置文件值。

区域终点

区域 V5 REST API V6 gRPC网关
欧盟 https://api.kentik.eu/api/v5 https://grpc.api.kentik.eu
美国 https://api.kentik.com/api/v5 https://grpc.api.kentik.com

工具(8)

每个工具都使用 action 参数以选择特定操作。

工具 操作 描述
kentik_query flows, time_series, top_ddos 流量数据分析——按维度、时间趋势、DDoS排名前X
kentik_inventory list_devices, get_device, list_interfaces, get_interface, list_sites, get_site, list_labels, get_label 网络基础设施清单
kentik_alerts list_policies, get_policy, active_alarms, alert_history, top_attacks DDoS保护和警报
kentik_synthetics list_tests, get_test, get_results, list_agents 综合监测试验和结果
kentik_config list_saved_filters, get_saved_filter, list_custom_dimensions, get_custom_dimension, list_users, get_user, list_cloud_exports, get_cloud_export, list_notification_channels, get_notification_channel 配置和管理对象
kentik_bgp list_monitors, get_routes BGP路由数据和前缀监控
kentik_ai (直接提问) 通过Kentik AI Advisor进行自然语言查询(15-60s)
kentik_market as_info, as_relationships AS号码查找和网络关系(KMI)

示例用法

kentik_query(action="flows", metric="bytes", dimension="AS_dst", topx=10)
kentik_query(action="time_series", metric="bytes", dimension="i_device_site_name", lookback_seconds=604800)
kentik_inventory(action="list_devices")
kentik_inventory(action="get_device", device_id="12345")
kentik_alerts(action="top_attacks", sort_by="bps", top=5)
kentik_alerts(action="active_alarms")
kentik_synthetics(action="get_results", test_ids="70933", start_time="2026-03-28T12:00:00Z", end_time="2026-03-28T13:00:00Z")
kentik_ai(question="Which interfaces are near capacity?")

流查询参考

维度(按字段分组 kentik_query 动作=流)

尺寸 描述
AS_src, AS_dst 源/目标自治系统
IP_src, IP_dst 源/目标IP地址
Port_src, Port_dst 源/目标端口
Proto IP协议(TCP、UDP、ICMP、ESP等)
tcp_flags TCP标志(ACK、SYN、PSH+ACK、RST等)
Geography_src, Geography_dst 来源国/目的地国
InterfaceID_src, InterfaceID_dst 入口/出口接口
i_device_site_name 设备站点名称
i_device_name, i_device_id 设备名称或ID
IP_dst_cidr_24_64 目的地/24前缀
TopFlow 单个流记录(原型src:port->dst:port)

可以组合多个维度: "AS_src,Port_dst" 或 "tcp_flags,Port_dst".

指标

度量 描述
bytes 总字节数(返回avg_bits_per_sec)
in_bytes, out_bytes 定向字节
packets 数据包总数(返回avg_pkts_per_sec)
in_packets, out_packets 定向数据包
fps 每秒流量
unique_src_ip, unique_dst_ip 唯一IP计数

过滤字段(用于 filters_json)

字段 描述 示例值
dst_as, src_as 目的地/源AS编号 "15169"
inet_dst_addr, inet_src_addr 目标/源IP或CIDR "198.51.100.0/24"
l4_dst_port, l4_src_port 目标/源端口 "443"
protocol IP协议号 "6" (TCP)
tcp_flags TCP标志位掩码 "2" (SYN)
i_device_name 设备名称 "edge-router-1"
i_src_network_bndry_name 网络边界 "external"
i_output_snmp_alias 输出接口说明 "INT:IX:FRANCE-IX:100G"
i_trf_profile 交通概况 "from outside, terminated inside"

筛选器运算符: =, !=, contains, not_contains.

速率限制

API类型 并发 每分钟 每小时
非查询(设备、BGP等) 1 20-60 3750
查询(流量数据) 4 30-100 1500
AI顾问 -- 4创建 --

贡献

# Clone and build
git clone https://github.com/hervehildenbrand/kentik-mcp.git
cd kentik-mcp
go build -o kentik-mcp .

# Run tests (no Kentik account needed — all tests use mocks)
go test ./... -v

欢迎拉取请求。请包括新工具的测试。

许可证

麻省理工学院——见 许可证