Token导航 LogoToken导航TokenDH.com
Ptp Operator MCP Server logo
运维云端stdio官方级别未说明来源级核验

Ptp Operator MCP Server

MCP Server

一个专用于监控和管理OpenShift PTP Operator部署的模型上下文协议(MCP)服务器,提供PTP守护进程监控、日志分析、指标检查和配置管理功能。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
JavaScriptClaude网络管理Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

aneeshkp

提供方

aneeshkp

最后核验

2026/5/17 20:19

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python3 -m venv .venv

详细介绍

PTP运营商MCP服务器

](https://nodejs.org/) ![License](LICENSE) ![OpenShift](https://docs.openshift.com/container-platform/latest/networking/ptp/about-ptp.html)

用于监控和管理的专用模型上下文协议(MCP)服务器 OpenShift PTP操作员 部署。此服务器为Claude提供了全面的工具来监视PTP守护进程、分析日志、检查指标和管理PTP配置。

PTP MCP Server Demo

✨ 特性

🔍 智能PTP监控

  • 故障状态检测:自动统计和分析守护进程日志中出现的故障
  • 实时度量:从以下位置获取并解析Prometheus指标 localhost:9091/metrics
  • 日志模式匹配:通过智能分析在日志中搜索从属、主、监听状态
  • 健康评估:综合健康评分(健康/轻微/中等/危急)

🏗️ 集装箱特定分析

  • linuxptp-daemon-container:主PTP守护进程监控和故障分析
  • cloud-event-proxy:事件代理日志分析和监控
  • 灵活的吊舱选择:自动发现Pod或目标特定实例

⚙️ 配置管理

  • PtpConfig CR:查询和分析PtpConfig自定义资源
  • NodePtp设备:检查群集节点之间的PTP硬件可用性
  • 配置文件访问:阅读 ptp4l.confphc2sys.conf 来自跑步舱
  • 过程监控:查看正在运行的PTP进程及其状态

📊 高级分析

  • 指标解析:界面角色、时钟状态、偏移度量的人类可读解释
  • 故障模式检测:检测超时、不可达状态、高偏移
  • 事件关联:链接pod问题与Kubernetes事件
  • 状态转换跟踪:监控PTP状态随时间的变化

🚀 快速开始

先决条件

  • Node.js 18+
  • 部署PTP Operator的OpenShift/Kubernetes集群访问
  • 具有openshift ptp命名空间权限的现有KUBECONFIG

安装

# Clone the repository
git clone https://github.com/aneeshkp/ptp-operator-mcp-server.git
cd ptp-operator-mcp-server

# Run the installation script
chmod +x scripts/install.sh
./scripts/install.sh

配置Claude桌面

添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Linux: ~/.config/claude-desktop/claude_desktop_config.json

{
  "mcpServers": {
    "ptp-operator": {
      "command": "node",
      "args": ["/path/to/ptp-operator-mcp-server/index.js"]
    }
  }
}

验证安装(节点)

# Test cluster access
kubectl get pods -n openshift-ptp -l app=linuxptp-daemon

# Test the MCP server
node index.js
# Should show: "PTP Operator MCP Server running on stdio"

Python替代品(实验)

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python server.py

更新Claude配置以使用Python服务器:

{
  "mcpServers": {
    "ptp-operator": {
      "command": "/usr/bin/python3",
      "args": ["/home/aputtur/github.com/aneeshkp/ptp-operator-mcp-server/server.py"],
      "env": { "KUBECONFIG": "/home/aputtur/.kube/config" }
    }
  }
}

🛠️ 可用工具

堆芯监测工具

工具描述主要功能
list_ptp_pods列出所有PTP守护进程PodPod状态、容器运行状况、节点位置
get_daemon_logs分析守护进程容器日志故障检测、模式搜索、自动分析
get_proxy_logs监控云事件代理日志事件分析、错误检测
analyze_ptp_faults综合故障分析多模式故障检测、严重性评估
get_ptp_metrics获取Prometheus指标解析指标、接口角色、时钟状态
check_ptp_status总体健康评估Pod健康、日志摘要、指标概述

配置工具

工具描述主要功能
get_ptp_configs查询PtpConfig CR配置规范、状态信息
get_node_ptp_configs检查NodePtpDevice CR硬件发现、设备功能
get_ptp_config访问配置文件ptp4l.conf、phc2sys.conf、进程状态

执行和事件

工具描述主要功能
exec_ptp_command在容器中执行命令curl度量、过程检查、调试
monitor_ptp_events跟踪Kubernetes事件PTP相关事件,错误相关性

💬 克劳德互动示例

基础监控

"How many PTP pods are running and what's their status?"
"Show me any FAULTY states in daemon logs from the last hour"
"Get interface_role metrics from all PTP daemon pods"

故障分析

"Analyze PTP faults in the last 2 hours and tell me how many FAULTY states occurred"
"Search daemon logs for SLAVE keyword and count occurrences"
"Check if there are any high offset values in the metrics"

故障排除

"Execute 'curl localhost:9091/metrics | grep clock_state' in daemon containers"
"Show me recent Kubernetes events related to PTP pods"
"Get comprehensive health report of entire PTP deployment"

配置分析

"Show me all PtpConfig resources and their specifications"
"What PTP hardware devices are available on each node?"
"Get ptp4l and phc2sys configuration from running daemon pods"

📋 工具参考

get_daemon_logs

使用智能模式匹配分析linuxptp守护进程容器日志。

参数:

  • namespace:PTP命名空间(默认值: openshift-ptp)
  • podName:特定吊舱(可选-自动选择第一个可用吊舱)
  • tailLines:要检索的行数(默认值:500)
  • searchPattern:搜索词(例如,“缺陷”、“奴隶”、“主人”)
  • sinceMinutes:时间窗口(默认值:30分钟)

输出示例:

=== SEARCH ANALYSIS for "FAULTY" ===
Found 15 occurrences
Matched lines:
2024-01-15T10:30:25.123Z ptp4l[1234]: [port] FAULTY to LISTENING on FAULT_DETECTED
2024-01-15T10:31:30.456Z ptp4l[1234]: [port] FAULTY to LISTENING on FAULT_CLEARED

=== AUTOMATIC PTP LOG ANALYSIS ===
FAULTY states: 15
SLAVE states: 45
MASTER states: 0
LISTENING states: 30
Errors found: 3
Warnings found: 8
State changes: 12

get_ptp_metrics

从守护进程容器中获取并解析Prometheus指标。

参数:

  • namespace:PTP命名空间(默认值: openshift-ptp)
  • podName:特定吊舱(可选)
  • filterMetric:筛选特定指标(例如,“interface_role”、“clock_state”)
  • format:输出格式- raw, parsed,或 summary (默认值: parsed)

输出示例:

=== INTERFACE ROLES ===
{interface="ens8f0",node="worker-1"} = ACTIVE
{interface="ens8f1",node="worker-1"} = INACTIVE

=== CLOCK STATES ===
{interface="ens8f0",node="worker-1"} = SLAVE
{interface="ens8f1",node="worker-1"} = LISTENING

=== OFFSET FROM MASTER (nanoseconds) ===
{interface="ens8f0",node="worker-1"} = 45ns (Normal)

analyze_ptp_faults

进行全面的故障分析和严重性评估。

参数:

  • namespace:PTP命名空间(默认值: openshift-ptp)
  • podName:特定吊舱(可选)
  • sinceHours:分析窗口(默认值:2小时)

输出示例:

=== DETAILED FAULT ANALYSIS ===
FAULTY: 15 occurrences
  Examples:
  2024-01-15T10:30:25Z ptp4l[1234]: port 1: FAULTY to LISTENING on FAULT_DETECTED

TIMEOUT: 3 occurrences
  Examples:
  2024-01-15T10:25:10Z ptp4l[1234]: timed out while polling for tx timestamp

OFFSET_HIGH: 2 occurrences
  Examples:
  2024-01-15T10:20:15Z ptp4l[1234]: master offset 1500000 s2 freq -22000

OVERALL FAULT COUNT: 20
STATUS: MODERATE ISSUES - Several faults detected

🔧 开发与扩展

添加自定义工具

  1. 添加工具定义 到中的工具列表 setupHandlers():
{
  name: 'my_custom_tool',
  description: 'Custom PTP monitoring tool',
  inputSchema: {
    type: 'object',
    properties: {
      // Define parameters
    }
  }
}
  1. 添加处理程序 在switch语句中:
case 'my_custom_tool':
  return await this.myCustomTool(args);
  1. 实施该方法:
async myCustomTool(args) {
  // Your implementation
  return {
    content: [{
      type: 'text',
      text: 'Tool output'
    }]
  };
}

扩展日志分析

在中添加新的故障模式 performFaultAnalysis():

const faultPatterns = {
  // Existing patterns...
  custom_error: /my custom error pattern/i,
  performance_issue: /performance.*degraded/i,
};

自定义指标解析

扩展 summarizeMetrics() 对于新的度量类型:

if (metrics['my_custom_metric']) {
  summary += '\n=== MY CUSTOM METRICS ===\n';
  // Custom parsing logic
}

🔒 安全和权限

所需的KUBECONFIG权限

您的群集凭据需要以下权限:

  • 容器组: get, list (发现PTP吊舱)
  • Pods/log: get (读取容器日志)
  • Pods/exec: create (执行指标命令)
  • 事件: get, list (监视群集事件)
  • 自定义资源: get, list 为了 ptpconfigs, nodeptpdevices

权限验证

# Test required permissions
kubectl auth can-i get pods -n openshift-ptp
kubectl auth can-i get pods/log -n openshift-ptp
kubectl auth can-i create pods/exec -n openshift-ptp
kubectl auth can-i get ptpconfigs -n openshift-ptp
kubectl auth can-i get nodeptpdevices

生产部署

有关集群内的生产部署,请参阅 examples/production-rbac.yaml 用于服务帐户配置。

🚨 故障排除

常见问题

问题原因解决方案
“未找到PTP吊舱”未部署PTP操作员kubectl get pods -n openshift-ptp
“指标不可用”端口9091不可访问检查守护程序容器运行状况
“权限被拒绝”RBAC不足验证KUBECONFIG权限
“找不到自定义资源”未安装PTP CRD确保部署了PTP操作员

调试模式

# Run with debugging
node --inspect index.js

# Check MCP protocol communication
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node index.js

日志分析

服务器将错误记录到stderr(不会干扰MCP协议):

# Check for issues
node index.js 2>debug.log

🤝 贡献

我们欢迎捐款!以下是如何提供帮助:

  1. 复刻仓库
  2. 创建特征分支: git checkout -b feature/amazing-feature
  3. 进行更改和测试 通过PTP部署
  4. 提交更改: git commit -m 'Add amazing feature'
  5. 推送到分支: git push origin feature/amazing-feature
  6. 打开拉取请求

开发设置

git clone https://github.com/aneeshkp/ptp-operator-mcp-server.git
cd ptp-operator-mcp-server
npm install
# Make changes and test with: node index.js

📚 文档

🔗 相关项目

📈 路线图

  • \[ \] Web仪表板 -PTP监控的可选web界面
  • \[ \] 警报集成 -关键PTP事件的Webhook通知
  • \[ \] 历史分析 -长期PTP性能趋势
  • \[ \] 多集群支持 -跨多个集群监控PTP
  • \[ \] 自定义仪表板 -可配置的监控视图

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🙏 致谢

  • OpenShift PTP团队 -对于优秀的PTP运营商
  • Anthropic -对于模型上下文协议和Claude
  • LinuxPTP社区 -为了实现稳健的PTP实施
  • Kubernetes社区 -对于客户端库

📞 支持

______________________________________________________________________

由...制作❤️ OpenShift PTP社区

*星⭐ 如果你觉得这个仓库有用的话!*

目录标签

目录标签

JavaScriptClaude网络管理PTP监控本地部署OpenShift时间同步Kubernetes

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP