Back to MCP directory
publicPublicdnsLocal runtime

Time Converter

一个基于Swift实现的时间MCP服务器,提供时区转换和时间查询功能

article

README

🚀 MCP时间服务器:AI助手的时间管理专家

MCP时间服务器是一款用Swift语言实现的开源工具,它能为AI助手提供时间信息与时区转换功能。借助模型上下文协议(MCP),该项目让AI助手可获取当前时间、进行时区转换,还能助力用户协调不同地区的会议安排。

🚀 快速开始

标准输入输出模式(默认)

time-mcp-server

Web界面模式

指定端口启动Web界面:

time-mcp-server --port 8080

✨ 主要特性

获取当前时间

可提供目标时区的当前时间信息,涵盖日期、时间和夏令时状态。

请求示例:

{
  "timezone": "America/New_York"
}

响应结果:

{
  "timezone": "America/New_York",
  "datetime": "2024-11-05T14:30:45-05:00",
  "is_dst": false
}

时间转换

支持将指定时间从源时区转换为目标时区。

请求示例:

{
  "source_timezone": "America/Los_Angeles",
  "time": "15:30",
  "target_timezone": "Asia/Tokyo"
}

响应结果:

{
  "source": {
    "timezone": "America/Los_Angeles",
    "datetime": "2024-11-05T15:30:00-08:00",
    "is_dst": false
  },
  "target": {
    "timezone": "Asia/Tokyo",
    "datetime": "2024-11-06T08:30:00+09:00",
    "is_dst": false
  },
  "time_difference": "+17h"
}

📦 安装指南

兼容性要求

  • 操作系统:macOS 14.0 或更高版本
  • Swift 版本:6.0 或更高版本
  • MCP SDK:0.2.0 或更高版本

安装步骤

  1. 克隆仓库
    git clone https://github.com/okooo5km/time-mcp-server.git
    cd time-mcp-server
    
  2. 构建项目 使用Xcode打开time-mcp-server.xcworkspace,选择目标设备并点击“构建”。
  3. 运行服务器 成功构建后,在终端中运行:
    ./time-mcp-server
    

📚 详细文档

配置示例

集成到Claude.app

在Claude设置中添加以下内容:

"mcpServers": {
  "RealTime": {
    "command": "time-mcp-server",
    "args": ["--port", "8080"]
  }
}

集成到Cursor编辑器

在配置文件中添加:

export MCP_TIME_SERVER=~/path/to/time-mcp-server

使用场景

  • 会议协调:帮助用户安排跨国会议,自动处理时区差异。
  • 旅行计划:提供目的地的当地时间信息,方便行程规划。
  • 自动化脚本:在需要时间同步的自动化任务中使用。

📄 许可证

该项目遵循MIT许可证,具体条款见LICENSE文件。

👥 项目支持

贡献代码

欢迎通过GitHub提交问题和拉取请求: GitHub仓库

赞助

如果你喜欢这个项目,可以通过以下方式支持:

  • GitHub Sponsors
  • 打赏比特币:bc1qrp33uhr9vpy8jguxxev0xj2wr6xl4xhzt7vmuqc

🖼️ 项目截图

界面示例

📞 联系方式

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