Interfaces with linuxptp daemon to monitor logs, track synchronization status, and analyze PTP configuration on Linux systems
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PTP MCP Servercheck PTP health in the openshift-ptp namespace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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: Time Tools MCP Server
๐ Prerequisites
Python 3.8 or higher
OpenShift CLI (
oc) installed and configuredAccess to OpenShift cluster with PTP operator installed
PTP namespace (
openshift-ptp) exists
๐ ๏ธ Installation
Clone the repository:
git clone https://github.com/aneeshkp/ptp-mcp-server.git cd ptp-mcp-serverInstall dependencies:
pip install -r requirements.txtVerify OpenShift access:
oc whoami oc get namespace openshift-ptp
๐งช Quick Testing
Run the comprehensive test suite:
python quick_test.pyExpected 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.pyThe server provides the following MCP tools:
get_ptp_config- Get PTP configurationget_ptp_logs- Get linuxptp daemon logssearch_logs- Search logs for patternsget_grandmaster_status- Get grandmaster infoanalyze_sync_status- Analyze sync statusget_clock_hierarchy- Get clock hierarchycheck_ptp_health- Comprehensive health checkquery_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.pyPerformance Testing
python performance_test.pyIndividual 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
Testing Guide - Comprehensive testing instructions
Agent Integration Guide - Integration examples for agents
Testing Steps - Step-by-step testing process
Testing Results - Complete test results
๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)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:
Create an issue on GitHub
Check the testing documentation
Review the agent integration guide
Status: โ
Production Ready
Last Updated: January 2025
Version: 1.0.0
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.