@adia1223/mcp-datetime-tools
v1.1.0
Published
MCP server providing datetime utilities - get current time, format dates, calculate time differences
Downloads
21
Maintainers
Readme
MCP DateTime Tools
一个简单高效的 MCP 服务器,提供日期时间相关的实用工具。帮助 AI 获取当前时间、格式化日期、计算时间差等。
为什么需要这个工具?
AI 模型不知道"现在"是什么时候。这个 MCP 服务器让 AI 能够:
- 获取当前准确时间
- 进行时间计算和转换
- 处理不同时区的时间
工具列表
| 工具 | 描述 |
|------|------|
| get_current_time | 获取当前时间(时间戳 + 格式化字符串) |
| format_date | 格式化日期为指定格式 |
| time_diff | 计算两个时间之间的差值 |
| add_time | 对时间进行加减运算 |
| get_timestamp | 获取时间戳(秒/毫秒) |
| parse_timestamp | 将时间戳解析为日期时间 |
安装
npx -y @adia1223/mcp-datetime-tools配置
在 MCP 配置文件中添加:
{
"mcpServers": {
"datetime-tools": {
"command": "npx",
"args": ["-y", "@adia1223/mcp-datetime-tools"]
}
}
}使用示例
获取当前时间
工具: get_current_time
参数: { "timezone": "Asia/Shanghai" }格式化日期
工具: format_date
参数: { "date": "2024-12-25", "format": "relative" }
输出: "28天后"计算时间差
工具: time_diff
参数: { "start": "2024-01-01", "end": "2024-12-31" }时间加减
工具: add_time
参数: { "days": 7, "hours": 3 }
输出: 当前时间 + 7天3小时支持的时区
使用 IANA 时区名称,例如:
Asia/Shanghai- 中国America/New_York- 美东Europe/London- 伦敦Asia/Tokyo- 东京
License
MIT
