MCP Time Server
一个基于 MCP (Model Context Protocol) 的时间服务器,提供当前时间获取功能。
特性
- 🎯 基于 MCP 协议的时间服务
- 🌍 支持全球时区查询
- 🚀 基于 FastMCP 的高性能实现
- 📦 易于安装和集成
- 🔧 支持命令行和编程接口
安装
使用 pip 安装
pip install mcp-time-server
开发环境安装
git clone https://github.com/example/mcp-time-server.git
cd mcp-time-server
pip install -e .
快速开始
命令行使用
# 启动服务器(使用默认时区)
mcp-time-server
# 服务器将通过 stdio 启动,等待 MCP 客户端连接
Python 编程接口
from mcp_time_server import get_current_time
# 获取当前时间(使用系统默认时区)
current_time = get_current_time()
print(current_time)
# 获取指定时区的当前时间
beijing_time = get_current_time("Asia/Shanghai")
print(beijing_time)
# 获取纽约时间
ny_time = get_current_time("America/New_York")
print(ny_time)
MCP 工具
get_current_time
获取当前时间的 MCP 工具函数。
参数:
timezone(可选): 时区字符串,例如 "Asia/Shanghai"、"America/New_York"- 如果不提供,将使用系统默认时区
返回值:
- 格式化的当前时间字符串,格式:YYYY-MM-DD HH:MM:SS.SSSSSS 时区名称
支持的时区示例:
Asia/Shanghai- 中国标准时间America/New_York- 纽约时间Europe/London- 伦敦时间UTC- 协调世界时Asia/Tokyo- 日本标准时间
示例输出
2025-12-30 19:54:32.123456 CST
2025-12-30 07:54:32.123456 EST
2025-12-30 12:54:32.123456 UTC
依赖项
pytz- 时区处理库mcp- Model Context Protocol 库
兼容性
- Python 3.8+
- 支持所有主要操作系统(Windows、macOS、Linux)
开发
本地开发设置
# 克隆仓库
git clone https://github.com/example/mcp-time-server.git
cd mcp-time-server
# 安装开发依赖
pip install -e ".[dev]"
# 运行测试
python -m pytest
构建包
# 构建分发包
python -m build
# 检查构建结果
python -m twine check dist/*
贡献
欢迎贡献!请阅读 CONTRIBUTING.md 了解详情。
许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
更新日志
v0.1.0
- 初始版本发布
- 支持基本的时间获取功能
- 支持时区参数
- MCP 协议集成
Metadata
Release files for mcp_cuc_myx 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_myx-0.1.0.tar.gz | 4.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_cuc_myx-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / mcp_cuc_myx-0.1.0.tar.gz
| Download URL | mcp_cuc_myx-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dc36d0003fc23b12535d28db8186ec5689fc9b91b8760b74e5805b11019c602
|
|
BLAKE2b-256 checksum How to use checksums |
45cc9eb8b56ebf614880ae7c9e3fa54321184c7c6a4ebc14d97650d705653af9
|
| 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_myx-0.1.0-py3-none-any.whl
| Download URL | mcp_cuc_myx-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
addef72b1250d3addfa3f4d54d4845c23b09e85c1e4fd45f425060adcdd0d505
|
|
BLAKE2b-256 checksum How to use checksums |
39982377c663d51b6c8f137fe28975843688385956b76840b7e23279f59ab0c7
|
| 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_myx 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.