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

使用

启动服务器

time-server-mcp

使用示例

服务器启动后,可以通过 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-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-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: time_server_mcp-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-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c55b6d0f6e3f37f241e63399ddd79b1ed71ef2c785f1129840bbc132cf636129
MD5 7169ef629f9d08e606208b7105ed0da3
BLAKE2b-256 61b699c1b3f279315fa70c24ff642f227f30365bc5948bf15cac0963885f3db3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for time_server_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c79a1b1aa430e6e6e6e5c34383269b506fa90effd892265ce7049cc17562989
MD5 883fed9434096cd66346aed30cd176ec
BLAKE2b-256 3c503314f689b2cd373b9a987d2457514fc880bd05938ea45a31206e5e42d8aa

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