NTP
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"jdez427-ntp-mcp": {
"command": "wsl",
"args": [
"-e",
"bash",
"-c",
"cd /path/to/ntp-mcp && uv run python -m ntp_mcp"
],
"env": {
"TZ": "America/New_York",
"NTP_SERVER": "time.cloudflare.com"
}
}
}
}You run a specialized MCP server that provides precise time information sourced from NTP servers, with timezone support, security filtering, and a clean, parseable output format. This enables clients to obtain accurate timestamps in a consistent, secure way across different time zones and network environments.
How to use
You integrate the NTP MCP Server with an MCP client to obtain synchronized time information for your sessions. The server focuses on accuracy, security, and predictable formatting so your applications can rely on consistent timestamps across time zones. Start by ensuring your client can reach a whitelisted NTP source, and configure the MCP to return the time in a structured output that includes the date, time, timezone, and the NTP source used.
How to install
Prerequisites you need before installing the NTP MCP Server include Python 3.11 or newer and a modern package manager for Python environments. You will also use the UV package manager for fast dependency resolution.
# 1) Prerequisites
python --version
# If you need Python, install it from the official site
# 2) Install UV package manager
# Windows/Mac/Linux: install via pip
pip install uv
# Or install via a script for all platforms
curl -LsSf https://astral.sh/uv/install.sh | sh
# 3) Prepare the NTP MCP project
# Clone the repository or download the ZIP, then open the project folder
# 4) Install dependencies and activate the environment
uv sync
# 5) Optional: configure timezone (UTC is default)
./setup_timezone.sh
# or: python3 setup_timezone.py
# 6) Add MCP to Claude (global installation) for use across instances
claude mcp add --scope user ntp bash /path/to/ntp-mcp/launch_ntpmcp.sh
Configuration and startup notes
To run the MCP server from different environments, you can use several stdio-based configurations shown below. Each config starts the same underlying server but via different runtimes or wrappers. Pick the one that matches your deployment environment.
# Example 1: Windows Subsystem for Linux (WSL) wrapper
{
"type": "stdio",
"name": "ntp_mcp_windows",
"command": "wsl",
"args": ["-e", "bash", "-c", "cd /path/to/ntp-mcp && uv run python -m ntp_mcp"],
"env": {
"NTP_SERVER": "time.cloudflare.com",
"TZ": "UTC"
}
}
# Example 2: Direct Python venv invocation on Unix-like systems
{
"type": "stdio",
"name": "ntp_mcp_unix",
"command": "/path/to/ntp-mcp/.venv/bin/python",
"args": ["-m", "ntp_mcp"],
"env": {
"NTP_SERVER": "time.cloudflare.com",
"TZ": "UTC"
}
}
# Example 3: Generic UV runner from a project directory
{
"type": "stdio",
"name": "ntp_mcp_uvx",
"command": "uv",
"args": ["run", "python", "-m", "ntp_mcp"],
"cwd": "/path/to/ntp-mcp",
"env": {
"NTP_SERVER": "time.cloudflare.com",
"TZ": "UTC"
}
}
Security and output
Time output is produced in a structured, parseable format that includes the date, time, timezone, and the NTP server used. Security filters ensure only approved sources are queried and direct IP usage is blocked. You should see outputs like Date, Time, Timezone, and NTP Server in a predictable layout.
If a server is blocked by the security policy, you will receive a clear error indicating the reason and listing the approved servers to use instead.
Environment variables
The server uses environment variables to configure its time source and display. The primary variables shown are:
NTP_SERVER: time.cloudflare.com
TZ: UTC
Troubleshooting
If you encounter issues during startup or operation, check that UV is installed and available in your environment. Ensure the chosen runtime command in the MCP configuration is correct and that the working directory points to the ntp-mcp project location. If time appears in the wrong timezone, re-run the timezone configuration or set TZ explicitly in your MCP environment.
Notes on tools and usage
This MCP server exposes time-related functionality via its time-provisioning endpoints. You can request the current time and query for the list of approved NTP servers that are whitelisted for security.
Available tools
get_current_time
Get the current time from an approved NTP server.
list_approved_servers
List all approved NTP servers that can be used.