关于 Time MCP Server
Time MCP Server 是面向需要当前时间和时区操作的 LLM 与应用的 Swift 实现。它可查询当地时间、转换时间、识别夏令时状态并计算时区时差。
主要功能
- 01查询 IANA 时区的当前时间
- 02转换不同时区的时间
- 03查看夏令时状态
- 04计算时区时差
- 05支持 stdio 和 SSE 传输
适用场景
- 01规划跨时区会议
- 02查询旅行目的地当地时间
- 03协调国际团队工作时间
- 04安排全球活动
MCP 相关
该 MCP 服务提供查询当前时间和转换时区时间的工具,并包含夏令时信息及时差计算。它支持 stdio 和 SSE 传输。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Time MCP Server
一个提供时间相关功能的模型上下文协议服务器。该服务器使大模型能够获取当前时间信息,并在不同时区之间转换时间。这是一个使用 MCP Swift SDK 实现的 Swift 时间 MCP 服务。
✨ 功能
- 查询当前时间:获取任意时区的当前时间
- 时区转换:在不同时区之间转换时间
- 夏令时信息:检查某个时区当前是否处于夏令时
- 时差计算:转换时获取时区之间的时差
可用工具
-
get_current_time- 获取指定时区的当前时间timezone(字符串,必需):IANA 时区名称(例如,'America/New_York'、'Europe/London')。如果为空或未提供,则使用系统时区。
-
convert_time- 在不同时区之间转换时间source_timezone(字符串,必需):源 IANA 时区名称。如果为空或未提供,则使用系统时区。time(字符串,必需):要转换的时间,采用 24 小时制(HH:MM)target_timezone(字符串,必需):目标 IANA 时区名称。如果为空或未提供,则使用系统时区。
安装
选项 1:下载预构建二进制文件
从 GitHub Releases 页面下载适用于您平台的最新预构建二进制文件:
从 GitHub Releases 页面下载适用于您平台的二进制文件,并按照以下安装说明操作。
macOS 安装
Apple Silicon(M1/M2/M3)macOS:
# Download the arm64 version
curl -L https://github.com/okooo5km/time-mcp-server/releases/latest/download/time-mcp-server-macos-arm64.zip -o time-mcp-server.zip
unzip time-mcp-server.zip
chmod +x time-mcp-server
# Remove quarantine attribute to avoid security warnings
xattr -d com.apple.quarantine time-mcp-server
# Install to your local bin directory
mkdir -p ~/.local/bin
mv time-mcp-server ~/.local/bin/
rm time-mcp-server.zip
Intel 处理器 macOS:
# Download the x86_64 version
curl -L https://github.com/okooo5km/time-mcp-server/releases/latest/download/time-mcp-server-macos-x86_64.zip -o time-mcp-server.zip
unzip time-mcp-server.zip
chmod +x time-mcp-server
# Remove quarantine attribute to avoid security warnings
xattr -d com.apple.quarantine time-mcp-server
# Install to your local bin directory
mkdir -p ~/.local/bin
mv time-mcp-server ~/.local/bin/
rm time-mcp-server.zip
macOS 通用二进制文件(兼容 Apple Silicon 和 Intel):
# Download the universal version
curl -L https://github.com/okooo5km/time-mcp-server/releases/latest/download/time-mcp-server-macos-universal.zip -o time-mcp-server.zip
unzip time-mcp-server.zip
chmod +x time-mcp-server
# Remove quarantine attribute to avoid security warnings
xattr -d com.apple.quarantine time-mcp-server
# Install to your local bin directory
mkdir -p ~/.local/bin
mv time-mcp-server ~/.local/bin/
rm time-mcp-server.zip
Linux 安装
x86_64 Linux(最常见):
# Download the amd64 version
curl -L https://github.com/okooo5km/time-mcp-server/releases/latest/download/time-mcp-server-linux-amd64.tar.gz -o time-mcp-server.tar.gz
tar -xzf time-mcp-server.tar.gz
chmod +x time-mcp-server
# Install to your local bin directory
mkdir -p ~/.local/bin
mv time-mcp-server ~/.local/bin/
rm time-mcp-server.tar.gz
ARM64 Linux(例如,Raspberry Pi 4、AWS Graviton):
# Download the arm64 version
curl -L https://github.com/okooo5km/time-mcp-server/releases/latest/download/time-mcp-server-linux-arm64.tar.gz -o time-mcp-server.tar.gz
tar -xzf time-mcp-server.tar.gz
chmod +x time-mcp-server
# Install to your local bin directory
mkdir -p ~/.local/bin
mv time-mcp-server ~/.local/bin/
rm time-mcp-server.tar.gz
Windows 安装
x86_64 Windows(最常见):
- 下载 Windows AMD64 版本
- 解压 ZIP 文件
- 将
time-mcp-server.exe移动到 PATH 中的某个位置
ARM64 Windows(例如,ARM 设备上的 Windows):
- 下载 Windows ARM64 版本
- 解压 ZIP 文件
- 将
time-mcp-server.exe移动到 PATH 中的某个位置
确保安装目录位于 PATH 中:
- macOS/Linux:将
export PATH="$HOME/.local/bin:$PATH"添加到 shell 配置文件(.bashrc、.zshrc等)中 - Windows:通过“系统属性”>“环境变量”对话框将该目录添加到系统 PATH 中
选项 2:从源代码构建
-
克隆代码库:
git clone https://github.com/okooo5km/time-mcp-server.git cd time-mcp-server -
构建项目:
使用 Make(推荐):
# Build for your current platform make # Or build for a specific platform make build-darwin-universal # macOS Universal Binary make build-darwin-arm64 # macOS Apple Silicon make build-darwin-amd64 # macOS Intel make build-linux-amd64 # Linux x86_64 make build-linux-arm64 # Linux ARM64 make build-windows-amd64 # Windows x86_64 # Or build for all platforms at once make build-all # Create distribution packages for all platforms make dist二进制文件将放置在
.build目录中。直接使用 Swift:
swift build -c release -
安装二进制文件:
# Install to user directory (recommended, no sudo required) mkdir -p ~/.local/bin cp time-mcp-server ~/.local/bin/请将
~/.local/bin添加到 shell 配置文件中,确保其位于 PATH 中:echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc source ~/.zshrc # or source ~/.bashrc
命令行参数
该服务支持以下命令行参数:
-h, --help:显示有关服务、用法和可用选项的帮助信息-v, --version:显示 time-mcp-server 的版本号-t, --transport <string>:要使用的传输类型(默认值:"stdio")stdio:用于直接集成大模型的标准输入/输出模式sse:用于 Web 连接的服务器发送事件模式
-p, --port <int>:以 SSE 模式运行时使用的端口(默认值:8080)-l, --local-timezone <string>:使用指定的 IANA 时区名称覆盖自动检测到的本地时区
用法示例:
# Display help information
time-mcp-server --help
# Display version information
time-mcp-server --version
# Start server with default settings (stdio mode)
time-mcp-server
# Start server in SSE mode on the default port (8080)
time-mcp-server --transport sse
# Start server in SSE mode on a custom port
time-mcp-server --transport sse --port 9090
# Start server with a specific local timezone
time-mcp-server --local-timezone Europe/London
以 SSE 模式运行时,可通过指定端口使用 HTTP 访问该服务,方便基于 Web 的客户端连接。在 stdio 模式(默认)下,服务通过标准输入/输出进行通信,非常适合直接集成到大模型应用中。
为 Claude.app 配置
添加到 Claude 设置中:
"mcpServers": {
"RealTime": {
"command": "time-mcp-server",
"args": ["-l", "Asia/Shanghai"]
}
}
为 Cursor 配置
将以下配置添加到 Cursor 编辑器的 Settings - mcp.json 中:
{
"mcpServers": {
"RealTime": {
"command": "time-mcp-server",
"args": ["-l", "Asia/Shanghai"]
}
}
}
为 ChatWise 配置
将 memory MCP 服务添加到 Chatwise Settings - Tools 中。

系统提示词示例
你可以使用以下系统提示词,帮助 Claude 有效地使用 time-mcp-server:
You have access to time-related tools through MCP. Use these to help users:
- Get the current time in any timezone
- Convert times between timezones
- Calculate time differences between locations
- Plan meetings across different timezones
Use the following tools appropriately:
- `get_current_time` for checking the current time in a specific timezone
- `convert_time` when the user needs to convert between timezones
Always use proper IANA timezone names (e.g., 'America/New_York', 'Europe/London', 'Asia/Tokyo')
rather than abbreviations or common names.
开发要求
- Swift 6.0 或更高版本
- macOS 14.0 或更高版本
- MCP Swift SDK 0.2.0 或更高版本
使用示例
获取当前时间
{
"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"
}
使用场景
- 国际会议规划:安排跨不同时区的会议
- 旅行规划:查询目的地的当地时间
- 远程办公协作:与国际团队协调工作时间
- 活动安排:以正确的当地时间安排全球活动
- 时效性操作:确保操作在正确的当地时间进行
版本历史
请参阅 GitHub Releases,了解版本历史和更新日志。
☕️ 支持项目
如果你觉得 time-mcp-server 有帮助,请考虑支持其开发:
- ⭐️ 在 GitHub 上为项目点星
- 🐛 报告错误或提出功能建议
- 💝 通过以下方式支持:
许可证
time-mcp-server 采用 MIT 许可证。这意味着你可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。
关于
这是一个基于 Swift 实现的时间服务,用于模型上下文协议(MCP),可让 AI 助手获取当前时间信息并在不同时区之间转换。本项目使用 MCP Swift SDK 构建。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。