MCP Time Server
Overview
The MCP Time Server is a sophisticated Python-based microservice designed to provide advanced time-related utilities across different timezones. It offers robust functionality for retrieving current times and converting times between various global timezones.
Project Details
- Version: 0.1.1
- Python Compatibility: Python 3.11+
Features
- Current Time Retrieval: Get the current time for any IANA timezone
- Time Zone Conversion: Convert times between different time zones
- Comprehensive Validation: Robust input validation using Pydantic models
- Async Server Architecture: Built with asyncio for efficient performance
- Flexible Configuration: Configurable through environment variables and config files
Dependencies
Core dependencies:
- mcp (>=1.6.0)
- pydantic (>=2.11.2)
- PyYAML (>=6.0.2)
- pyz (>=0.4.3)
Development dependencies:
- pytest (>=8.3.5)
Installation
Prerequisites
- Python 3.11 or higher
- pip
- (Optional) Virtual environment recommended
Install from PyPI
Install from Source
- Clone the repository:
- Create a virtual environment:
- Install the package:
Development Installation
To set up for development:
Running the Server
Command-Line Interface
Programmatic Usage
Environment Variables
NO_BOOTSTRAP
: Set to disable component bootstrapping- Other configuration options can be set in the configuration files
Available Tools
1. Get Current Time
Input:
timezone
: IANA timezone name (e.g., 'America/New_York')
Example:
Returns:
- Current time in the specified timezone
- Timezone details
- Daylight Saving Time (DST) status
2. Convert Time
Input:
source_timezone
: Source timezone (IANA format)time
: Time in HH (24-hour) formattarget_timezone
: Target timezone (IANA format)
Example:
Returns:
- Source time details
- Target time details
- Time difference between zones
Development
Code Formatting
- Black is used for code formatting
- isort is used for import sorting
- Line length is set to 88 characters
Running Tests
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Ensure code passes formatting and testing
- Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Related MCP Servers
- -securityFlicense-qualityAn MCP server providing timezone conversions and time-related operations via RESTful API endpoints, featuring comprehensive error handling and timezone database integration.Last updated -Python
- -securityAlicense-qualityA TypeScript server that provides time-related tools through the Model Context Protocol, allowing users to get current time in various timezones and convert times between different IANA timezones.Last updated -TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that allows users to get global time information via Interzoid's GetGlobalTime API, enabling access to time data across different regions through natural language.Last updated -Python
- -securityAlicense-qualityA Model Context Protocol server that provides the current time in any timezone with customizable formatting, allowing AI assistants to access accurate time information.Last updated -PythonMIT License