A canonical, high-reliability, developer-first modular common component for handling timezones and time in Python.
Project description
TimeMaster MCP
中文文档 | API Reference | Release Notes
A powerful MCP (Model Context Protocol) service for time management and timezone operations. TimeMaster provides AI applications with comprehensive time, timezone, and holiday query capabilities through a standardized MCP interface.
Core MCP Features
- Unified Time Operations - Get current time, convert between timezones with single interface
- Smart Timezone Management - Automatic detection, search, and conversion capabilities
- Comprehensive Holiday Support - Query holidays by name, country, and date ranges
- AI-Ready Integration - Standardized MCP protocol for seamless AI application integration
- Flexible Configuration - Environment variables and configuration files support
- Offline Mode Support - Works without internet connection using system data
- Multi-language Support - Consistent functionality across different locales
Quick Start
Installation
pip install time-master
MCP Service Setup
# Start MCP service
uv run -m time_master.mcp_service
# Or with custom configuration
TIMEMASTER_OFFLINE_MODE=true uv run -m time_master.mcp_service
What's New in v0.1.2
- 🔄 Unified Time Interface: New
get_timeMCP tool replacesget_current_timeandconvert_timewith optional parameters - 🌐 Auto Timezone Detection: MCP service automatically detects timezone (network-first, system fallback)
- 🔧 Environment Variable Control: Use
TIMEMASTER_OFFLINE_MODE=truefor offline mode configuration - 🔍 Enhanced Search:
search_timezonestool now supports empty queries to list all timezones - 🎉 Holiday Search: New
search_holidaytool for finding holidays by name - 📋 Unified Holiday Format: All holiday tools now return consistent dictionary format
- ⚠️ Backward Compatibility: Deprecated tools still work but show migration warnings
Usage
MCP Service for AI Integration
TimeMaster provides an MCP (Model Context Protocol) service for AI integration using the standard STDIO transport.
# Start MCP service
uv run -m time_master.mcp_service
# Or with custom configuration
TIMEMASTER_OFFLINE_MODE=true uv run -m time_master.mcp_service
Available MCP Tools
Core Time Tools (v0.1.2+)
get_time- Unified time interface for getting current time or timezone conversionget_local_timezone- Get local system timezonesearch_timezones- Search for matching timezones, supports empty query to list all timezonescalculate_time_difference- Calculate time difference between two times in different timezones
Holiday Tools (v0.1.2+)
search_holiday- Search holidays by name, returns date, days until, and holiday durationlist_holidays- List all holidays for a specific country and year
Deprecated Tools
get_next_holiday- ⚠️ Usesearch_holiday("")insteadcalculate_days_to_holiday- ⚠️ Usesearch_holiday(holiday_name)insteadget_current_time- ⚠️ Useget_time()insteadconvert_time- ⚠️ Useget_time()with parameters instead
MCP Tool Parameters
get_time
timezone(optional): Target timezone, defaults to local timezonetime_str(optional): Time string to convert, if not provided gets current timefrom_tz(optional): Source timezone, required when time_str is providedformat(optional): Output format, 'iso' or 'friendly_cn', defaults to 'iso'
search_timezones
query(optional): Timezone name search query, empty string returns all timezoneslimit(optional): Maximum number of results to return, defaults to 20
search_holiday
query(optional): Holiday name search query, empty string returns next holidaycountry(optional): ISO country code (e.g. 'US', 'GB', 'FR')timezone(optional): Timezone to infer country fromyear(optional): Year, defaults to current yearlimit(optional): Maximum number of results to return, defaults to 10
list_holidays
country(optional): ISO country codetimezone(optional): Timezone to infer country fromyear(optional): Year, defaults to current year
calculate_time_difference
time1(required): First time stringtz1(required): Timezone for first timetime2(required): Second time stringtz2(required): Timezone for second time
Integration with MCP Clients
{
"mcpServers": {
"time-master": {
"command": "uv",
"args": ["run", "-m", "time_master.mcp_service"],
"cwd": "/path/to/time-master"
}
}
}
Example MCP Tool Usage
{
"method": "tools/call",
"params": {
"name": "get_time",
"arguments": {
"timezone": "America/New_York",
"format": "iso"
}
}
}
Configuration
TimeMaster MCP service supports flexible configuration through environment variables:
Environment Variables
# Force offline mode
export TIMEMASTER_OFFLINE_MODE=true
# Custom API endpoint
export TIMEMASTER_API_ENDPOINT="https://custom-api.example.com/api"
# Request timeout in seconds
export TIMEMASTER_TIMEOUT=10
# Enable debug logging
export TIMEMASTER_DEBUG=true
MCP Service Configuration
# Start with offline mode
TIMEMASTER_OFFLINE_MODE=true uv run -m time_master.mcp_service
# Start with custom timeout
TIMEMASTER_TIMEOUT=15 uv run -m time_master.mcp_service
# Start with debug logging
TIMEMASTER_DEBUG=true uv run -m time_master.mcp_service
Migration from v0.1.1
Environment Variable Configuration
# Old way: force_offline() method (deprecated)
# New way: Environment variable
export TIMEMASTER_OFFLINE_MODE=true
MCP Tool Migration
get_current_time→get_timeconvert_time→get_timewith parametersget_next_holiday→search_holidaywith empty querycalculate_days_to_holiday→search_holidaywith holiday name
Development Setup
# Install dependencies
pip install -e ".[dev]"
# Format code
black time-master/
ruff check time-master/
# Run MCP service for testing
uv run -m time_master.mcp_service
License
This project is licensed under the Apache 2.0 License - see the LICENSE .
Note: This project is part of a monorepo, and the license file is located in the repository root directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file time_master-0.1.2.tar.gz.
File metadata
- Download URL: time_master-0.1.2.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5d73dd12ca6d703c7ada4b76c0d4475d17e59bfcd4de232846f6f288c64e760
|
|
| MD5 |
5cba39932150c2e6b363f5fb990b1b93
|
|
| BLAKE2b-256 |
b24b1c7058097b03f78f30af70e4c08af25712b30c2564cacabd78ce2b302a41
|
Provenance
The following attestation bundles were made for time_master-0.1.2.tar.gz:
Publisher:
publish-to-pypi-time_master.yml on Kirky-X/mcps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
time_master-0.1.2.tar.gz -
Subject digest:
b5d73dd12ca6d703c7ada4b76c0d4475d17e59bfcd4de232846f6f288c64e760 - Sigstore transparency entry: 462635179
- Sigstore integration time:
-
Permalink:
Kirky-X/mcps@799c665358f192122f34da0837136d8b3b65680b -
Branch / Tag:
refs/tags/time_master/v0.1.2 - Owner: https://github.com/Kirky-X
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi-time_master.yml@799c665358f192122f34da0837136d8b3b65680b -
Trigger Event:
push
-
Statement type:
File details
Details for the file time_master-0.1.2-py3-none-any.whl.
File metadata
- Download URL: time_master-0.1.2-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
564f738da3b4e34f2dd34be836062abe9182301880678b8e64e7c8f870720d04
|
|
| MD5 |
005b1a9394454232b85a6e10d5a74283
|
|
| BLAKE2b-256 |
5bd00f63b0be474f392ee8f093a06dcdc26815beb1af058fec6fc456d8def4fc
|
Provenance
The following attestation bundles were made for time_master-0.1.2-py3-none-any.whl:
Publisher:
publish-to-pypi-time_master.yml on Kirky-X/mcps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
time_master-0.1.2-py3-none-any.whl -
Subject digest:
564f738da3b4e34f2dd34be836062abe9182301880678b8e64e7c8f870720d04 - Sigstore transparency entry: 462635182
- Sigstore integration time:
-
Permalink:
Kirky-X/mcps@799c665358f192122f34da0837136d8b3b65680b -
Branch / Tag:
refs/tags/time_master/v0.1.2 - Owner: https://github.com/Kirky-X
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi-time_master.yml@799c665358f192122f34da0837136d8b3b65680b -
Trigger Event:
push
-
Statement type: