ntp-mcp-server
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., "@ntp-mcp-serverwhat's the current time in Tokyo?"
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.
NTP MCP Server ๐
A Model Context Protocol (MCP) server that provides accurate time information from Network Time Protocol (NTP) servers with timezone support and structured output formatting.
Add NTP MCP Server to LM Studio
Add NTP MCP Server Docker to LM Studio
โจ Features
๐ Multiple NTP Server Support: Connect to any NTP server worldwide
๐ฐ๏ธ Timezone Conversion: Automatic timezone conversion with pytz
๐ Structured Output Format: Clean, parseable time format with separate date, time, and timezone components
๐ Fallback Mechanism: Falls back to local time if NTP is unavailable
๐ณ Ultra-Lightweight Docker: Alpine Linux base image (~50MB) for minimal footprint
โก Retry Logic: Automatic retry with exponential backoff
๐ง Configurable: Environment variable configuration
๐ MCP Compatible: Works with Claude Desktop and other MCP clients
๐งช Comprehensive Testing: Full test suite with format validation
Related MCP server: chuk-mcp-time
๐ Time Output Format
The NTP server now outputs time in a structured, easy-to-parse format:
Date:YYYY-MM-DD
Time:HH:mm:ss
Timezone:timezone_nameExample Outputs
Successful NTP Response:
Date:2025-07-25
Time:14:30:25
Timezone:UTCFallback Response (when NTP unavailable):
Date:2025-07-25
Time:14:30:25
Timezone:UTC (local fallback)Benefits of the New Format
โ More structured and easier to parse
โ Separate date and time components
โ Clear timezone information
โ Consistent formatting across all responses
โ Machine-readable and human-friendly
๐ Quick Start
Using Docker (Recommended)
# Build the Docker image
docker build -t ntp-mcp-server .
# Run with default settings
docker run --rm -i ntp-mcp-server
# Run with custom NTP server and timezone
docker run --rm -i \
-e NTP_SERVER=time.google.com \
-e TZ=America/New_York \
ntp-mcp-serverUsing Docker Compose
# Start the service
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the service
docker-compose downDirect Python Installation
# Install dependencies
pip install -r requirements.txt
# Run the server
python app.py๐ฆ Installation
Prerequisites
Docker (recommended) or Python 3.11+
MCP Client (Claude Desktop, etc.)
Method 1: Docker Installation
Clone the repository:
git clone <your-repo-url> cd ntp-mcp-serverBuild the Docker image:
docker build -t ntp-mcp-server .Configure your MCP client using
mcp-docker.json
Method 2: Python Installation
Clone and setup:
git clone <your-repo-url> cd ntp-mcp-server pip install -r requirements.txtConfigure your MCP client using
mcp.json
โ๏ธ Configuration
Environment Variables
Variable | Default | Description |
|
| NTP server hostname |
| System local | Target timezone (e.g., |
Supported NTP Servers
pool.ntp.org(default)time.google.comtime.cloudflare.comtime.apple.comtime.nist.govAny RFC 5905 compliant NTP server
Supported Timezones
Any timezone supported by the pytz library:
UTCAmerica/New_YorkEurope/LondonAsia/TokyoAustralia/SydneyAnd many more...
๐ง MCP Client Configuration
For Claude Desktop
Add to your Claude Desktop configuration:
Docker Version (Recommended)
{
"mcpServers": {
"ntp-server-docker": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "NTP_SERVER", "-e", "TZ", "ntp-mcp-server"],
"env": {
"NTP_SERVER": "pool.ntp.org",
"TZ": "UTC"
}
}
}
}Python Version
{
"mcpServers": {
"ntp-server": {
"command": "python",
"args": ["app.py"],
"cwd": "/path/to/your/ntp/project",
"env": {
"NTP_SERVER": "pool.ntp.org",
"TZ": "UTC"
}
}
}
}๐ ๏ธ Available Tools
get_current_time
Retrieves the current time from the configured NTP server in structured format.
Parameters: None
Returns: Current time in structured format with separate date, time, and timezone components
Example Response:
Date:2025-07-25
Time:14:30:25
Timezone:UTCFallback Behavior:
If NTP server is unreachable, falls back to local system time
Fallback responses include "(local fallback)" indicator
Returns error message if all time sources fail
๐งช Testing
The project includes a comprehensive test suite with format validation:
Available Test Scripts
test/simple_test.py- Windows-compatible direct testingtest/test_mcp.py- Basic MCP protocol testing with format validationtest/test_mcp_proper.py- Advanced MCP protocol testingtest/test_mcp_docker.py- Comprehensive Docker testingtest/test_direct_docker.py- Direct Docker container testingtest/run_all_tests.py- Comprehensive test runner
Run All Tests
# Run comprehensive test suite
python test/run_all_tests.py
# Run individual tests
python test/simple_test.py # Simple direct testing
python test/test_mcp_docker.py # Docker functionality
python test/test_mcp_proper.py # MCP protocol testing
python test/test_mcp.py # Basic functionalityTest Coverage
The test suite validates:
โ Time format structure (Date:YYYY-MM-DD, Time:HH:mm:ss, Timezone:name)
โ Multiple NTP servers (pool.ntp.org, time.google.com, time.cloudflare.com)
โ Different timezones (UTC, America/New_York, Europe/London, Asia/Tokyo)
โ Docker containerization with full MCP protocol
โ Environment variable configuration
โ Fallback behavior when NTP is unavailable
โ MCP protocol compliance (initialization, tools list, tool calls)
Manual Testing
# Test direct function call
python -c "import app, asyncio; result = asyncio.run(app.handle_call_tool('get_current_time', {})); print(result[0].text)"
# Start a container for testing
docker run --rm -i -e NTP_SERVER=time.google.com -e TZ=America/New_York ntp-mcp-server
# Send MCP requests (in another terminal)
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"}}}' | docker exec -i <container-id> cat๐ณ Docker Details
Image Information
Base Image:
python:3.11-alpineSize: ~50MB (significantly reduced from previous slim image)
Architecture: Multi-platform support
Benefits: Ultra-lightweight Alpine Linux base for minimal footprint
Build Arguments
# Build with custom tag
docker build -t my-ntp-server .
# Build for specific platform
docker build --platform linux/amd64 -t ntp-mcp-server .
# Build for ARM64 architecture
docker build --platform linux/arm64 -t ntp-mcp-server:arm64 .
# Build for multiple architectures (requires Docker Buildx)
docker buildx create --name multiarch-builder --use
docker buildx build --platform linux/amd64,linux/arm64 -t username/ntp-mcp-server:latest --push .Volume Mounts
No persistent volumes required - this is a stateless service.
๐ Project Structure
ntp-mcp-server/
โโโ app.py # Main MCP server implementation
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Docker build configuration
โโโ docker-compose.yml # Docker Compose setup
โโโ .dockerignore # Docker build optimization
โโโ .gitignore # Git ignore configuration
โโโ LICENSE # License information
โโโ config/
โ โโโ mcp.json # MCP client config (Python)
โ โโโ mcp-docker.json # MCP client config (Docker)
โโโ test/
โ โโโ simple_test.py # Windows-compatible direct testing
โ โโโ test_mcp.py # Basic functionality tests with format validation
โ โโโ test_mcp_proper.py # Advanced MCP protocol tests
โ โโโ test_mcp_docker.py # Comprehensive Docker tests
โ โโโ test_direct_docker.py # Direct container tests
โ โโโ run_all_tests.py # Comprehensive test runner
โโโ README.md # This file๐ Troubleshooting
Common Issues
"Processing request of type ListToolsRequest" Error
This is NOT an error! This is normal debug logging. The message:
[ERROR] [Plugin(mcp/ntp-server-docker)] stderr: INFO:mcp.server.lowlevel.server:Processing request of type ListToolsRequestMeans your server is working correctly. The INFO: indicates it's just debug information.
Container Exits Immediately
MCP servers are designed to run as stdio servers. They exit when stdin is closed, which is normal behavior.
NTP Server Unreachable
The server will automatically fall back to local time if the NTP server is unreachable. Check your network connectivity and firewall settings.
Timezone Not Found
Ensure you're using a valid timezone identifier from the pytz documentation.
Time Format Issues
The new structured format should always return:
Date:YYYY-MM-DD
Time:HH:mm:ss
Timezone:timezone_nameIf you see different formatting, run the test suite to validate:
python test/simple_test.pyDebug Commands
# Check if container is running
docker ps --filter ancestor=ntp-mcp-server
# View container logs
docker logs <container-id>
# Test container responsiveness with new format
python test/test_direct_docker.py
# Run comprehensive test suite
python test/run_all_tests.py
# Check NTP connectivity
docker run --rm ntp-mcp-server python -c "import ntplib; print(ntplib.NTPClient().request('pool.ntp.org'))"
# Validate time format directly
python -c "import app, asyncio; result = asyncio.run(app.handle_call_tool('get_current_time', {})); print('Format:', repr(result[0].text))"๐ค Contributing
Fork the repository
Create a feature branch:
git checkout -b feature-nameMake your changes
Add tests for new functionality
Ensure all tests pass:
python test/run_all_tests.pyValidate time format:
python test/simple_test.pyCommit your changes:
git commit -m "Add feature"Push to the branch:
git push origin feature-nameSubmit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Related Links
๐ Support
If you encounter issues:
Check the Troubleshooting section
Run the test suite to verify functionality:
python test/run_all_tests.pyValidate time format:
python test/simple_test.pyCheck that your MCP client configuration is correct
Ensure Docker is running (for Docker deployment)
๐ท๏ธ Version History
v2.1.0 - DOCKER OPTIMIZATION
๐ณ Switched to Alpine Linux base image (
python:3.11-alpine)๐ฆ Significantly reduced image size from ~151MB to ~50MB (67% reduction)
โก Improved container startup time and resource efficiency
๐ Enhanced security with minimal attack surface
๐๏ธ Better for CI/CD pipelines due to faster pull times
v2.0.0 - NEW STRUCTURED TIME FORMAT
โจ New structured output format:
Date:YYYY-MM-DD\nTime:HH:mm:ss\nTimezone:timezone๐งช Enhanced test suite with comprehensive format validation
๐ง Improved Windows compatibility with dedicated test scripts
๐ Better error handling and fallback behavior
๐ณ Updated Docker tests with full MCP protocol validation
v1.0.0 - Initial release with NTP support and Docker containerization
Full timezone support with pytz
Comprehensive test suite
Docker and Python deployment options
MCP protocol compliance
Made with โค๏ธ for the MCP community
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/n3r0-b1n4ry/ntp-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server