Skip to main content

MCP-NTP Time Service

An MCP (Model Context Protocol) NTP time service that gives language models accurate network time.

Features

  • Fetch accurate network time from an NTP server
  • Support both stdio and sse transports
  • Expose a get_current_time tool for models to query the current time
  • Configure the NTP server via environment variable or request header
  • Return detailed time information and NTP protocol metrics

Install

Requires Python 3.10 through 3.14. The service pins MCP Python SDK 2.2.0.

# Install dependencies with uv
uv sync

Configuration

Environment variable (stdio)

Set NTP_DOMAIN_URL:

export NTP_DOMAIN_URL="pool.ntp.org"

Regional option (China): ntp.aliyun.com.

Request header (sse)

Include the ntp_url header:

ntp_url: pool.ntp.org

Usage

stdio

export NTP_DOMAIN_URL="pool.ntp.org"
python -m app

Or use the helper scripts: start-ntp-stdio.sh / start-ntp-stdio.ps1.

sse

python -m app --transport sse --port 8080

# Smoke-test the SSE endpoint
curl -H "ntp_url: pool.ntp.org" http://localhost:8080/sse

Or use: start-ntp-sse.sh / start-ntp-sse.ps1.

MCP client settings

See mcp_settings.template.json for Cursor/compatible MCP client examples (uv local debug, SSE debug, and uvx production).

Tool: get_current_time

Get the current time from an NTP server.

Parameters:

  • ntp_server (optional): NTP server address. If omitted, uses the environment variable or request header.

Example response:

{
  "ntp_server": "pool.ntp.org",
  "ntp_timestamp": 1703123456.789,
  "ntp_time": "2023-12-21T10:30:56.789",
  "local_system_time": "2023-12-21T10:30:56.789",
  "time_offset": 0.123,
  "response_delay": 0.045
}

Debugging

export NTP_DOMAIN_URL="pool.ntp.org"
python -m app -v

Agent Skill

This repo ships a project skill at .agents/skills/mcp-ntp/ so agents that load skills can set up a local mcp-ntp instance and call get_current_time.

Cursor and other agentskills-compatible runtimes discover project skills under .agents/skills/ automatically. Example prompt:

Set up mcp-ntp locally and get the current server time.

Development

Project layout

mcp-ntp/
├── app/
│   ├── __init__.py      # CLI entry
│   ├── server.py        # MCP server
│   ├── client.py        # NTP client
│   └── config.py        # Configuration
├── .agents/skills/mcp-ntp/  # Agent Skill
├── pyproject.toml
└── README.md

Extending NTP configuration

get_current_time in client.py can be extended for additional NTP server selection logic.

License

MIT License

Metadata

Release files for mcp-ntp 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-ntp 0.3.1
File Size Uploaded Provenance Actions
mcp_ntp-0.3.1.tar.gz 78.6 kB With provenance Details for mcp_ntp-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-ntp 0.3.1
File Interpreter ABI Platform Actions
mcp_ntp-0.3.1-py3-none-any.whl Python 3 none any Details for mcp_ntp-0.3.1-py3-none-any.whl

Total release size: 87.3 kB

Release files / mcp_ntp-0.3.1.tar.gz

Download URL mcp_ntp-0.3.1.tar.gz
Size 78.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c02e80d14c24c247dafc89f7536907f70be1dd99be8ee44b408233adcc4774a0
BLAKE2b-256 checksum
How to use checksums
a220ced120894182f71716f028d01b2324542b821328eac35f50762bde82b19e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / mcp_ntp-0.3.1-py3-none-any.whl

Download URL mcp_ntp-0.3.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39f2321bb325338bedac08a33385bbdf0eb3893235b527efa7151450986c7960
BLAKE2b-256 checksum
How to use checksums
bc1343d7bf061db1d9dd3065bfa6c6b03ae39078a2e2964e16e5eb8369939af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for mcp-ntp 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_ntp-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page