Skip to main content

A time server implementation using MCP (Model Context Protocol)

Project description

Time Server MCP

一个使用 MCP (Model Context Protocol) 实现的时间服务器。

功能

  • 获取当前时间
  • 支持指定时区
  • 使用 stdio 传输方式运行服务器

安装

pip install time-server-mcp-ver.pcc

使用

启动服务器

time-server-mcp-ver.pcc

使用示例

服务器启动后,可以通过 MCP 协议与之通信,调用 get_current_time 工具来获取当前时间。

from mcp.client import MCPClient

# 创建客户端实例
client = MCPClient(transport="stdio")

# 调用 get_current_time 工具获取当前时间
result = client.get_current_time()
print(f"当前时间: {result}")

# 调用 get_current_time 工具获取指定时区的当前时间
result = client.get_current_time(timezone="Asia/Shanghai")
print(f"上海时间: {result}")

依赖

  • Python 3.7+
  • pytz
  • mcp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

time_server_mcp_ver_pcc-0.1.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

time_server_mcp_ver_pcc-0.1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file time_server_mcp_ver_pcc-0.1.1.tar.gz.

File metadata

  • Download URL: time_server_mcp_ver_pcc-0.1.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for time_server_mcp_ver_pcc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d382b67a9d390d6d2ed6f547f81e91f1319c617d984e3dc4627a0a22fa9d99dc
MD5 e88563db4bdbd8480bb2e3c0e44f11b2
BLAKE2b-256 5d4a6345083aa2fdb89e7a3fd3228e6dd697710f17d7caaa6797f1ca3ab8d7a0

See more details on using hashes here.

File details

Details for the file time_server_mcp_ver_pcc-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for time_server_mcp_ver_pcc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 772276ac5888e4cd1c66a7610a5fe24cff8a1e1fac125558f6dee8a32a45ebe1
MD5 c3ae0777ffdcc1b82a86a8c2b878f0d4
BLAKE2b-256 285ff0ef3afe0760db92d5bf34fc675ea869a1a77517409b072702d2bb14dd42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page