Skip to main content
Glama
aneeshkp

PTP MCP Server

by aneeshkp

PTP MCP Server

A Model Context Protocol (MCP) server for monitoring and analyzing Precision Time Protocol (PTP) systems in OpenShift clusters.

πŸš€ Features

  • PTP Configuration Analysis: Parse and validate PTP configurations from OpenShift

  • Real-time Log Monitoring: Access linuxptp daemon logs with intelligent parsing

  • Natural Language Queries: Ask questions about PTP status in plain English

  • Health Monitoring: Comprehensive PTP system health checks

  • Synchronization Analysis: Monitor sync status, offsets, and BMCA state

  • Clock Hierarchy: Track grandmaster and clock hierarchy information

  • ITU-T Compliance: Validate configurations against ITU-T G.8275.1 standards

Related MCP server: Kubectl MCP Tool

πŸ“‹ Prerequisites

  • Python 3.8 or higher

  • OpenShift CLI (oc) installed and configured

  • Access to OpenShift cluster with PTP operator installed

  • PTP namespace (openshift-ptp) exists

πŸ› οΈ Installation

  1. Clone the repository:

    git clone https://github.com/aneeshkp/ptp-mcp-server.git
    cd ptp-mcp-server
  2. Install dependencies:

    pip install -r requirements.txt
  3. Verify OpenShift access:

    oc whoami
    oc get namespace openshift-ptp

πŸ§ͺ Quick Testing

Run the comprehensive test suite:

python quick_test.py

Expected output:

πŸ” 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 Endpoints

1. Configuration API

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

2. Logs API

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

3. Search API

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

4. Health API

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

5. Natural Language API

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

6. Grandmaster Status API

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

7. Sync Status API

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

8. Clock Hierarchy API

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

πŸš€ Usage Examples

Basic Health Check

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())

Natural Language Query

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())

Log Analysis

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 Server

Start the MCP server for integration with MCP-compatible clients:

python ptp_mcp_server.py

The server provides the following MCP tools:

  • get_ptp_config - Get PTP configuration

  • get_ptp_logs - Get linuxptp daemon logs

  • search_logs - Search logs for patterns

  • get_grandmaster_status - Get grandmaster info

  • analyze_sync_status - Analyze sync status

  • get_clock_hierarchy - Get clock hierarchy

  • check_ptp_health - Comprehensive health check

  • query_ptp - Natural language interface

πŸ“Š Performance

  • Average Response Time: 0.78s

  • Fastest API: Configuration API (0.22s)

  • Concurrent Operations: 4/4 successful in 2.45s

  • Success Rate: 100% (8/8 endpoints)

πŸ—οΈ Architecture

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 Concepts Supported

  • BMCA (Best Master Clock Algorithm): Clock selection and hierarchy

  • Clock Types: OC (Ordinary Clock), BC (Boundary Clock), TC (Transparent Clock)

  • ITU-T G.8275.1: Profile compliance and validation

  • Synchronization: Offset tracking, frequency adjustment, sync status

  • Grandmaster: Primary time source identification and status

  • Clock Class: Quality and traceability indicators

  • Domain Numbers: PTP domain configuration (24-43 for ITU-T)

πŸ§ͺ Testing

Run All Tests

python quick_test.py

Performance Testing

python performance_test.py

Individual Component Testing

# 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())"

πŸ“– Documentation

🀝 Contributing

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • OpenShift PTP Operator team

  • Linuxptp project

  • Model Context Protocol (MCP) community

πŸ“ž Support

For issues and questions:


Status: βœ… Production Ready
Last Updated: January 2025
Version: 1.0.0

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • The Google GKE MCP server is a managed Model Context Protocol server that provides AI applications with tools to manage Google Kubernetes Engine (GKE) clusters and Kubernetes resources. It exposes a structured, discoverable interface that allows AI agents to interact with GKE and Kubernetes APIs, enabling them to inspect cluster configurations, retrieve Kubernetes resource YAMLs, monitor operations like cluster upgrades, diagnose issues, and optimize costsβ€”all without needing to parse text output or use complex kubectl commands.

  • The Buildkite MCP server exposes Buildkite product data (pipelines, builds, jobs, and test data) to AI tools, editors, and agents through the Model Context Protocol. It provides capabilities including pipeline creation and management, build monitoring with specialized tools like 'wait_for_build', efficient log querying using Apache Parquet conversion and caching, and OAuth-based authentication for both read-write and read-only access to Buildkite's REST API.

  • The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze dataβ€”enabling direct access to enterprise analytics data without requiring manual SQL coding.

  • The Telnyx MCP server is an official implementation of the Model Context Protocol that enables AI clients (like Claude Desktop, Cursor, and OpenAI Agents) to interact with Telnyx's telephony, messaging, and AI assistant APIs. It provides comprehensive capabilities including making and managing phone calls, sending SMS/MMS messages, purchasing and configuring phone numbers, creating AI assistants with custom instructions, managing cloud storage buckets, scraping and embedding website content, and handling integration secrets. The server exists as both a local implementation and a remotely hosted version, allowing developers to integrate real-world communication infrastructure directly into AI applications.

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    A Model Context Protocol server that connects to Google Cloud services, allowing users to query logs, interact with Spanner databases, and analyze Cloud Monitoring metrics through natural language interaction.
    40
    54
    82
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants to interact with Kubernetes clusters through natural language, supporting core Kubernetes operations, monitoring, security, and diagnostics.
    94
    956
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    A Model Context Protocol server that connects to Google Cloud services, allowing users to query logs, interact with Spanner databases, and analyze monitoring metrics through natural language.
    54
    MIT
  • A
    license
    B
    quality
    F
    maintenance
    A Model Context Protocol server that enables AI assistants to query Prometheus metrics, discover available data, and analyze system performance through natural language interactions.
    5
    85
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aneeshkp/ptp-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server