ConechoAI
服务介绍
时间 MCP 服务器
一个提供时间和时区转换功能的模型上下文协议服务器。该服务器使 LLM 能够获取当前时间信息,并使用 IANA 时区名称进行时区转换,同时支持自动检测系统时区。
可用工具
-
get_current_time- 获取特定时区或系统时区的当前时间。- 必需参数:
timezone(字符串): IANA 时区名称(例如,America/New_York、Europe/London)
- 必需参数:
-
convert_time- 在不同时区之间转换时间。- 必需参数:
source_timezone(字符串): 源 IANA 时区名称time(字符串): 24小时制的时间格式 (HH:MM)target_timezone(字符串): 目标 IANA 时区名称
- 必需参数:
安装
使用 uv (推荐)
当使用 uv 时,无需特别安装。我们将使用 uvx 直接运行 mcp-server-time。
使用 PIP
或者,您可以通过 pip 安装 time-mcp-local:
bash
pip install time-mcp-local
安装完成后,可以使用以下命令作为脚本运行:
bash
python -m time_mcp_local
配置
为 Claude.app 配置
在您的 Claude 设置中添加:
json
"mcpServers": {
"time": {
"command": "uvx",
"args": ["time-mcp-local"]
}
}
json
"mcpServers": {
"time": {
"command": "python",
"args": ["-m", "time_mcp_local"]
}
}
为 Zed 配置
在您的 Zed settings.json 中添加:
json
"context_servers": [
"mcp-server-time": {
"command": "uvx",
"args": ["time-mcp-local"]
}
],
json
"context_servers": {
"mcp-server-time": {
"command": "python",
"args": ["-m", "time_mcp_local"]
}
},
自定义 - 系统时区
默认情况下,服务器会自动检测您的系统时区。您可以通过在配置中的 args 列表里添加 --local-timezone 参数来覆盖这一点。
示例:
json
{
"command": "python",
"args": ["-m", "time_mcp_local", "--local-timezone=America/New_York"]
}
示例交互
- 获取当前时间:
json
{
"name": "get_current_time",
"arguments": {
"timezone": "Europe/Warsaw"
}
}
响应:
json
{
"timezone": "Europe/Warsaw",
"datetime": "2024-01-01T13:00:00+01:00",
"is_dst": false
}
- 在不同时区之间转换时间:
json
{
"name": "convert_time",
"arguments": {
"source_timezone": "America/New_York",
"time": "16:30",
"target_timezone": "Asia/Tokyo"
}
}
响应:
json
{
"source": {
"timezone": "America/New_York",
"datetime": "2024-01-01T12:30:00-05:00",
"is_dst": false
},
"target": {
"timezone": "Asia/Tokyo",
"datetime": "2024-01-01T12:30:00+09:00",
"is_dst": false
},
"time_difference": "+13.0h",
}
调试
您可以使用 MCP 检查器来调试服务器。对于 uvx 安装:
bash
npx @modelcontextprotocol/inspector uvx time-mcp-local
如果您在特定目录中安装了包或正在开发它:
bash
cd path/to/servers/src/time
npx @modelcontextprotocol/inspector uv run time-mcp-local
Claude 的示例问题
- "现在几点?"(将使用系统时区)
- "东京现在几点?"
- "纽约下午4点时,伦敦是几点?"
- "将东京时间上午9:30转换为纽约时间"
构建
bash
uv build --wheel
uv publish --token xxx