A time server tool built with FastMCP that provides current time information
Project description
Time Server MCP
A time server tool built with FastMCP that provides current time information.
Features
- Get current time with optional timezone support
- Simple command-line interface
- Easy to integrate as a library
- Built with FastMCP for efficient communication
Installation
You can install Time Server MCP using pip:
pip install time-server-mcp
Usage
Command Line Interface
After installation, you can run the time server directly from the command line:
time-server
This will start the FastMCP server, which will be ready to accept requests for current time information.
As a Library
You can also use the time server functionality in your own Python code:
from time_server import get_current_time
# Get current time in system default timezone
time_now = get_current_time()
print(f"Current time: {time_now}")
# Get current time in a specific timezone
time_shanghai = get_current_time(timezone="Asia/Shanghai")
print(f"Current time in Shanghai: {time_shanghai}")
time_new_york = get_current_time(timezone="America/New_York")
print(f"Current time in New York: {time_new_york}")
API Documentation
get_current_time(timezone: Optional[str] = None) -> str
Get the current time in a specified timezone.
Parameters:
timezone: Optional timezone string, e.g., "Asia/Shanghai", "America/New_York". If not provided, system default timezone will be used.
Returns:
- Formatted current time string in the format "YYYY-MM-DD HH:MM:SS.SSSSSS Timezone Name".
Example:
time = get_current_time("Europe/London")
# Output: 2023-12-25 15:30:45.123456 GMT
Dependencies
- Python >= 3.8
- pytz >= 2023.3
- mcp-server >= 0.1.0
License
MIT License
Project Links
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_server_mcp_ww-0.1.0.tar.gz.
File metadata
- Download URL: time_server_mcp_ww-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d43e3734d14082a9f28bf78deaf268dfbedee509a0cad3997c508422cbe6e506
|
|
| MD5 |
a9628608892f4b212b00b0f9099ed8ca
|
|
| BLAKE2b-256 |
72b3e7e703e6fca6c9505de68e238ad90f452c2c61bab09173e08fa73d580afd
|
File details
Details for the file time_server_mcp_ww-0.1.0-py3-none-any.whl.
File metadata
- Download URL: time_server_mcp_ww-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
964482ba99cd9430bc695548440813e3c67c17bd5215bc164bbae141660f156c
|
|
| MD5 |
a11d4b72b1be0e12f8ef03104291da2c
|
|
| BLAKE2b-256 |
b810e5bef6d365307f03473687156436fbf012b64c42dc77a54cde82c92cab07
|