Back to MCP directory
publicPublicdnsLocal runtime

time-server

一个基于MCP协议标准构建的时区转换和时间操作服务器,提供多时区当前时间查询和时区转换功能。

article

README

🚀 时间服务器

这是一个基于Model Context Protocol(MCP)协议的标准时间区转换和时间相关操作服务器,使用Python编写,可实现获取特定时区的当前时间、时区转换等功能。

🚀 快速开始

本时间服务器可通过Smithery自动安装,也能手动安装。安装完成后,即可启动服务器并使用其提供的API进行时间相关操作。

✨ 主要特性

  • ⏰ 获取特定时区的当前时间
  • 🌍 在时区之间转换时间
  • 🛠️ 基于MCP协议标准构建
  • 🐍 类型安全的Python实现
  • 🌐 RESTful API端点
  • 🛡️ 全面错误处理
  • 📅 时区数据库集成

📦 安装指南

使用Smithery安装

通过Smithery自动安装Claude桌面的时间服务器:

npx -y @smithery/cli install @clssck/mcp-time-server --client claude

手动安装

pip install .

💻 使用示例

基础用法

启动服务器:

python -m time_server

📚 详细文档

API文档

工具

get_current_time

获取特定时区的当前时间。 参数

  • timezone:字符串 - IANA时区标识符(例如“America/New_York”) 返回
  • ISO 8601格式的当前时间
convert_time

在时区之间转换时间。 参数

  • time:字符串 - 要转换的时间,ISO 8601格式
  • from_timezone:字符串 - 源时区
  • to_timezone:字符串 - 目标时区 返回
  • ISO 8601格式的转换后时间

🔧 技术细节

开发

安装开发依赖

pip install -e .[dev]

运行测试

pytest

检查代码质量

ruff check .
mypy src

📄 许可证

本项目采用MIT许可证。

👥 贡献指南

本项目遵循Contributor Covenant的行为准则。参与本项目意味着您应遵守此准则。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client