MCP Time Server
MCP Server for getting current time with timezone support.
Features
- Get current time
- Support custom timezone (optional parameter)
- Default timezone is UTC
Installation
pip install mcp-time-server
Usage
CLI
mcp-time-server
As a Python module
from mcp.server.fastmcp import FastMCP
from datetime import datetime
import pytz
mcp = FastMCP("time_server")
@mcp.tool()
def get_current_time(timezone: str = "UTC") -> str:
"""获取当前时间,支持指定时区。"""
try:
if timezone.upper() == "UTC":
current_time = datetime.now(pytz.UTC)
else:
tz = pytz.timezone(timezone)
current_time = datetime.now(tz)
return f"当前时间 ({timezone}): {current_time.strftime('%Y-%m-%d %H:%M:%S %Z')}"
except pytz.UnknownTimeZoneError:
return f"错误: 无效的时区 '{timezone}'"
if __name__ == "__main__":
mcp.run()
Development
# Install development dependencies
pip install -e .
# Run tests
pytest
# Build package
python -m build
# Publish to PyPI
twine upload dist/*
License
MIT
Metadata
Release files for mcp-cuc-king 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_cuc_king-0.1.0.tar.gz | 27.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_cuc_king-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.5 kB
Release files / mcp_cuc_king-0.1.0.tar.gz
| Download URL | mcp_cuc_king-0.1.0.tar.gz |
|---|---|
| Size | 27.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bfe399812f9cd4c12cd0dd3757e6ddf656ffe7f72db2474e55c90d0808395ad
|
|
BLAKE2b-256 checksum How to use checksums |
a77274f61dfe217c2d4275194aa5f747977913b281e3c962ed2adea1cdcb62b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.0 Windows/11
|
Release files / mcp_cuc_king-0.1.0-py3-none-any.whl
| Download URL | mcp_cuc_king-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32d36c62081e5e33a78658ca75ddf8b8ec7f411c25e9c1660bc0ff161d14e1ef
|
|
BLAKE2b-256 checksum How to use checksums |
0c917ecb4f88fede2be85526e8b7821b6415d47faa95d7b679da732fc964158e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.0 Windows/11
|
Security for mcp-cuc-king 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.