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

PTP MCP Server

MCP Server

用于监控和分析OpenShift集群中精确时间协议(PTP)系统的模型上下文协议(MCP)服务器,提供配置分析、实时日志监控、自然语言查询和健康检查等功能。

工具数

8

提示词数

0

GitHub Stars

1

资源数

0
Python网络监控云端部署

安装说明

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

作者 / 组织

aneeshkp

提供方

aneeshkp

最后核验

2026/5/17 20:21

运行时

Python

快速接入

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

命令预览

pip install -r requirements.txt

详细介绍

PTP MCP服务器

模型上下文协议(MCP)服务器,用于监控和分析OpenShift集群中的精确时间协议(PTP)系统。

🚀 特性

  • PTP配置分析:从OpenShift解析和验证PTP配置
  • 实时日志监控:使用智能解析访问linuxptp守护进程日志
  • 自然语言查询:用简单的英语询问有关PTP状态的问题
  • 健康监测:全面的PTP系统健康检查
  • 同步分析:监视同步状态、偏移和BMCA状态
  • 时钟层次结构:跟踪特级大师和时钟层次信息
  • ITU-T合规性:根据ITU-T G.8275.1标准验证配置

📋 先决条件

  • Python 3.8或更高版本
  • OpenShift命令行界面(oc)已安装并配置
  • 在安装了PTP操作员的情况下访问OpenShift集群
  • PTP命名空间(openshift-ptp)存在

🛠️ 安装

  1. 克隆存储库:
   git clone https://github.com/aneeshkp/ptp-mcp-server.git
   cd ptp-mcp-server
  1. 安装依赖项:
   pip install -r requirements.txt
  1. 验证OpenShift访问权限:
   oc whoami
   oc get namespace openshift-ptp

🧪 快速测试

运行综合测试套件:

python quick_test.py

预期产量:

🔍 PTP MCP Server API Quick Test
==================================================
Tests Passed: 8/8
Success Rate: 100.0%
🎉 ALL TESTS PASSED! Your API is ready for agent integration.

📚 API终点

1.配置API

from ptp_tools import PTPTools
tools = PTPTools()
result = await tools.get_ptp_config({"namespace": "openshift-ptp"})

2.日志API

result = await tools.get_ptp_logs({"lines": 1000})

3.搜索API

result = await tools.search_logs({"query": "dpll", "time_range": "last_hour"})

4.卫生API

result = await tools.check_ptp_health({"check_config": True, "check_sync": True})

5.自然语言API

result = await tools.query_ptp({"question": "What is the current grandmaster?"})

6、特级大师状态API

result = await tools.get_grandmaster_status({"detailed": True})

7.同步状态API

result = await tools.analyze_sync_status({"include_offsets": True})

8.时钟层次结构API

result = await tools.get_clock_hierarchy({"include_ports": True})

🚀 使用示例

基本健康检查

import asyncio
from ptp_tools import PTPTools

async def check_health():
    tools = PTPTools()
    health = await tools.check_ptp_health({})
    
    if health["success"]:
        print(f"Status: {health['overall_status']}")
        for check_name, result in health["checks"].items():
            print(f"{check_name}: {result}")
    else:
        print(f"Error: {health.get('error')}")

asyncio.run(check_health())

自然语言查询

async def ask_question():
    tools = PTPTools()
    response = await tools.query_ptp({
        "question": "What is the current grandmaster?"
    })
    
    if response["success"]:
        print(f"Answer: {response['response']}")
    else:
        print(f"Error: {response.get('error')}")

asyncio.run(ask_question())

日志分析

async def analyze_logs():
    tools = PTPTools()
    
    # Get recent logs
    logs = await tools.get_ptp_logs({"lines": 500})
    
    # Search for specific events
    sync_loss = await tools.search_logs({"query": "sync loss"})
    clock_changes = await tools.search_logs({"query": "clockClass change"})
    
    print(f"Total logs: {logs['logs_count']}")
    print(f"Sync loss events: {sync_loss['matching_logs']}")
    print(f"Clock changes: {clock_changes['matching_logs']}")

asyncio.run(analyze_logs())

🔧 MCP服务器

启动MCP服务器以与MCP兼容客户端集成:

python ptp_mcp_server.py

服务器提供以下MCP工具:

  • get_ptp_config -获取PTP配置
  • get_ptp_logs -获取linuxptp守护进程日志
  • search_logs -在日志中搜索模式
  • get_grandmaster_status -获取特级大师信息
  • analyze_sync_status -分析同步状态
  • get_clock_hierarchy -获取时钟层次结构
  • check_ptp_health -全面健康检查
  • query_ptp -自然语言界面

📊 演出

  • 平均响应时间:0.78秒
  • API最快:配置API(0.22s)
  • 并行操作:2.45秒成功4/4
  • 成功率:100%(8/8个终点)

🏗️ 建筑

ptp-mcp-server/
├── ptp_mcp_server.py      # Main MCP server
├── ptp_config_parser.py   # PTP configuration parser
├── ptp_log_parser.py      # Linuxptp log parser
├── ptp_model.py           # PTP data models
├── ptp_query_engine.py    # Natural language query engine
├── ptp_tools.py           # API endpoint implementations
├── quick_test.py          # Quick test suite
├── performance_test.py    # Performance benchmarking
└── requirements.txt       # Python dependencies

🔍 支持PTP概念

  • BMCA(最佳主时钟算法):时钟选择和层次结构
  • 时钟类型:OC(普通时钟)、BC(边界时钟)、TC(透明时钟)
  • 国际电联第8275.1号:配置文件合规性和验证
  • 同步:偏移跟踪、频率调整、同步状态
  • 国际象棋特级大师:主要时间源标识和状态
  • 时钟类:质量和可追溯性指标
  • 域名:PTP域配置(ITU-T为24-43)

🧪 测试

运行所有测试

python quick_test.py

性能测试

python performance_test.py

单个组件测试

# Test configuration parser
python -c "from ptp_config_parser import PTPConfigParser; import asyncio; asyncio.run(PTPConfigParser().get_ptp_configs())"

# Test log parser
python -c "from ptp_log_parser import PTPLogParser; import asyncio; asyncio.run(PTPLogParser().get_ptp_logs())"

📖 文档

🤝 贡献

  1. 分叉存储库
  2. 创建要素分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

📄 许可证

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

🙏 致谢

  • OpenShift PTP操作员团队
  • Linuxptp项目
  • 模型上下文协议(MCP)社区

📞 支持

对于问题和疑问:

______________________________________________________________________

状态: ✅ 生产就绪\ 最后更新:2025年1月\ 版本: 1.0.0

目录标签

目录标签

Python网络监控云端部署时间同步本地部署OpenShift工具PTP分析日志解析

接入字段

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

stdio

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

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

8

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdionone部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP