chronotick-mcp

JaimeCernuda/chronotick-mcp

3.2

If you are the rightful owner of chronotick-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

ChronoTick MCP Server provides high-precision time corrections to AI agents using the Model Context Protocol (MCP).

Tools
3
Resources
0
Prompts
0

ChronoTick MCP Server

High-precision time services for AI agents via Model Context Protocol

Python 3.10+ License: MIT

ChronoTick MCP Server provides microsecond-precision time corrections to AI agents through the Model Context Protocol (MCP). It combines advanced time synchronization, machine learning inference, and fast IPC communication to deliver real-time clock corrections with uncertainty quantification.

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.10 or later
  • uv package manager
  • Network access for NTP synchronization
  • Linux/macOS (Windows support may require modifications)

Installation

git clone git@github.com:JaimeCernuda/chronotick-mcp.git
cd chronotick-mcp
uv sync

Start the MCP Server

# Basic start
uv run python chronotick_mcp.py

# With debug logging
uv run python chronotick_mcp.py --debug-trace --debug-log-file /tmp/chronotick-debug.log

Connect to Claude Code

claude mcp add chronotick --scope user \
  --env PYTHONPATH=$(pwd) \
  -- bash -c "cd $(pwd) && $(pwd)/.venv/bin/python chronotick_mcp.py"

๐ŸŽฏ Features

Core Capabilities

  • Microsecond Precision: Real-time clock corrections with uncertainty bounds
  • Fast IPC Communication: Optimized multiprocessing queues for minimal latency
  • Machine Learning Integration: TimesFM + Chronos models for predictive time corrections
  • Comprehensive Debug Logging: Function tracing, model I/O, and performance metrics

MCP Tools Available to AI Agents

  1. get_time - Get corrected time with uncertainty bounds
  2. get_daemon_status - Monitor daemon health and performance
  3. get_time_with_future_uncertainty - Project time uncertainty into the future

Advanced Features

  • Quality Control: Rejects poor NTP measurements (configurable thresholds)
  • Error Propagation: Proper uncertainty calculation and bounds
  • Service Deployment: systemd/launchd configurations included
  • Comprehensive Testing: 25+ tests covering all functionality

๐Ÿ“Š Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   AI Agents     โ”‚โ—„โ”€โ”€โ–บโ”‚  ChronoTick MCP  โ”‚โ—„โ”€โ”€โ–บโ”‚ ChronoTick      โ”‚
โ”‚  (Claude Code)  โ”‚    โ”‚     Server       โ”‚    โ”‚    Daemon       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚                          โ”‚
                              โ–ผ                          โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚ Fast IPC     โ”‚         โ”‚ ML Pipeline  โ”‚
                       โ”‚ (Queues)     โ”‚         โ”‚ (TimesFM +   โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚  Chronos)    โ”‚
                                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                         โ”‚
                                                         โ–ผ
                                                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                                โ”‚ NTP Client   โ”‚
                                                โ”‚ (4 servers)  โ”‚
                                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Configuration

The system uses YAML configuration files with comprehensive settings:

clock_measurement:
  ntp:
    servers: ['pool.ntp.org', 'time.google.com', 'time.cloudflare.com', 'time.nist.gov']
    timeout_seconds: 2.0
    max_acceptable_uncertainty: 0.010  # 10ms threshold
  timing:
    warm_up:
      duration_seconds: 180  # 3-minute warmup
      measurement_interval: 1.0

๐Ÿ“ Project Structure

chronotick-mcp/
โ”œโ”€โ”€ chronotick_inference/          # Core inference engine
โ”‚   โ”œโ”€โ”€ mcp_server.py              # MCP server implementation
โ”‚   โ”œโ”€โ”€ daemon.py                  # Background daemon process
โ”‚   โ”œโ”€โ”€ real_data_pipeline.py      # ML pipeline integration
โ”‚   โ””โ”€โ”€ configs/                   # Configuration files
โ”œโ”€โ”€ chronotick_mcp.py              # Main entry point
โ”œโ”€โ”€ tests/                         # Comprehensive test suite
โ”‚   โ””โ”€โ”€ chronotick/
โ”‚       โ”œโ”€โ”€ test_mcp_server.py     # MCP functionality tests
โ”‚       โ””โ”€โ”€ test_debug_logging.py  # Debug logging tests
โ”œโ”€โ”€ docs/                          # Documentation
โ”‚   โ”œโ”€โ”€ MCP_DEPLOYMENT_GUIDE.md    # Deployment instructions
โ”‚   โ”œโ”€โ”€ DEBUG_LOGGING_GUIDE.md     # Debug logging guide
โ”‚   โ””โ”€โ”€ ...                       # Additional guides
โ””โ”€โ”€ chronotick-5min-debug.log      # Example debug output

๐Ÿงช Testing

Run the comprehensive test suite:

# All tests
uv run python -m pytest tests/ -v

# MCP server tests only
uv run python -m pytest tests/chronotick/test_mcp_server.py -v

# Debug logging tests
uv run python -m pytest tests/chronotick/test_debug_logging.py -v

Test Coverage: 25/25 tests passing

  • 17 MCP server functionality tests
  • 8 debug logging system tests

๐Ÿ” Debug Logging

Enable comprehensive debug tracing for troubleshooting:

# Full debug tracing
uv run python chronotick_mcp.py --debug-trace

# Save debug logs to file
uv run python chronotick_mcp.py --debug-trace --debug-log-file /tmp/debug.log

# Monitor debug output
tail -f /tmp/debug.log

Debug features include:

  • Function entry/exit with timing
  • Model I/O logging (NumPy arrays, predictions)
  • IPC communication monitoring
  • Performance metrics and latency tracking

๐Ÿš€ Deployment

Development

uv run python chronotick_mcp.py

Production (systemd)

sudo cp scripts/chronotick-mcp.service /etc/systemd/system/
sudo systemctl enable chronotick-mcp.service
sudo systemctl start chronotick-mcp.service

Production (launchd - macOS)

cp scripts/com.chronotick.mcp.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.chronotick.mcp.plist

๐Ÿ“ˆ Performance

  • Typical Response Time: <1ms for time requests
  • Warmup Period: 3 minutes for quality NTP measurements
  • Memory Usage: 50-200MB depending on model loading
  • CPU Usage: Low during normal operation, higher during ML inference

๐Ÿ›ก๏ธ Quality Assurance

The system implements strict quality controls:

  • NTP Quality Filtering: Rejects measurements >10ms uncertainty by default
  • Error Propagation: Proper uncertainty bounds through all calculations
  • Conservative Fallbacks: No predictions with insufficient data quality
  • Comprehensive Testing: All edge cases and error conditions covered

๐Ÿ“‹ Requirements

Runtime Dependencies

  • mcp>=1.0.0 - Model Context Protocol implementation
  • pydantic>=2.0.0 - Data validation and serialization
  • pydantic-settings - Configuration management
  • numpy - Numerical computations
  • PyYAML - Configuration file parsing

Development Dependencies

  • pytest>=7.0.0 - Testing framework
  • pytest-asyncio>=0.23.0 - Async testing support
  • pytest-mock - Mock testing utilities

๐Ÿค Usage with AI Agents

Once connected to Claude Code, you can request:

"Get me the current corrected time with uncertainty bounds"
"Show me the ChronoTick daemon status and performance metrics"  
"What will the time uncertainty be in 5 minutes?"

The MCP server will provide high-precision responses with detailed uncertainty quantification.

๐Ÿ”— Related Documentation

  • - Complete setup instructions
  • - Troubleshooting and monitoring
  • - Advanced usage patterns

๐Ÿ› Troubleshooting

Common Issues

Server fails to start:

  • Check Python version: python --version (requires 3.10+)
  • Verify dependencies: uv sync
  • Check network connectivity for NTP access

High latency/poor performance:

  • Enable debug logging: --debug-trace
  • Check system resources: top -p $(pgrep chronotick)
  • Verify NTP server connectivity: ntpdate -q pool.ntp.org

Claude Code connection issues:

  • Verify MCP configuration syntax
  • Check file permissions on scripts
  • Restart Claude Code after configuration changes

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • Built on the Model Context Protocol (MCP) specification
  • Integrates TimesFM and Chronos time series models
  • Uses high-precision NTP synchronization techniques

Need help? Check the or open an issue on GitHub.