Skip to main content

MCP Time Server

一个简单易用的 MCP (Model Context Protocol) 服务器,提供时间查询功能。

功能特性

  • 🕐 获取当前本地时间
  • 🌍 支持任意时区的时间查询
  • 🚀 简洁的 API 设计
  • 📦 易于安装和使用

安装

pip install mcp-time-server

使用方法

作为 MCP Server 运行

mcp-time-server

服务器将在 http://127.0.0.1:8000/sse 启动。

在代码中使用

from mcp_time_server import mcp

# 启动服务器
mcp.run(transport="sse")

工具说明

get_current_time

获取当前时间,支持可选的时区参数。

参数:

  • timezone (可选): 时区名称,如 "Asia/Shanghai", "UTC", "America/New_York"

返回:

  • 格式化的时间字符串

示例:

# 获取本地时间
get_current_time()
# 返回: "2026-01-29 14:30:45"

# 获取 UTC 时间
get_current_time("UTC")
# 返回: "2026-01-29 06:30:45 UTC"

# 获取上海时间
get_current_time("Asia/Shanghai")
# 返回: "2026-01-29 14:30:45 CST"

支持的时区

常用时区列表:

  • UTC - 世界标准时间
  • Asia/Shanghai - 上海时间
  • Asia/Tokyo - 东京时间
  • America/New_York - 纽约时间
  • Europe/London - 伦敦时间
  • Europe/Paris - 巴黎时间
  • Australia/Sydney - 悉尼时间

更多时区请参考 IANA 时区数据库。

在 Cherry Studio 中使用

  1. 启动服务器:

    mcp-time-server
    
  2. 在 Cherry Studio 中配置:

    • 名称: time-server
    • 类型: SSE
    • URL: http://127.0.0.1:8000/sse
  3. 在对话中询问时间:

    • "现在几点了?"
    • "UTC 时间是多少?"
    • "纽约现在几点?"

开发

安装开发依赖

pip install -e ".[dev]"

运行测试

pytest

代码格式化

black mcp_time_server/

类型检查

mypy mcp_time_server/

依赖

  • mcp>=1.0.0 - Model Context Protocol SDK
  • pytz>=2024.0 - 时区支持

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

作者

Your Name - your.email@example.com

链接

Metadata

Release files for mcp-cuc-kkn 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-cuc-kkn 0.3.0
File Size Uploaded Provenance
mcp_cuc_kkn-0.3.0.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-cuc-kkn 0.3.0
File Interpreter ABI Platform
mcp_cuc_kkn-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / mcp_cuc_kkn-0.3.0.tar.gz

Download URL mcp_cuc_kkn-0.3.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b0ddc7d74d7790787a3c7c508605c41ea3015ced97e6872793e2164619603c32
BLAKE2b-256 checksum
How to use checksums
0eb2740ca60c375c7879c6004a1c0abd0e0115f648a635317e3cb869b45b27c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / mcp_cuc_kkn-0.3.0-py3-none-any.whl

Download URL mcp_cuc_kkn-0.3.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
395c2ce7c5bdcbe04005a781ff05444ec3c36b842982efc4372976053c8b5e98
BLAKE2b-256 checksum
How to use checksums
ad260738cba8d6aa040d52f1e3ea7fced828bfaf23d182912ca228043e2d977a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for mcp-cuc-kkn 0.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page