关于 Time Tools Mcp Server
Time Tools Mcp Server 为 AI Agent 和其他 MCP 客户端提供时间与日期处理工具,涵盖时区查询、时间戳与日期转换、当前时间获取及时间差计算。
主要功能
- 01获取服务器时区
- 02读取当前 Unix 时间戳
- 03转换 Unix 时间戳与日期时间
- 04以常规或 ISO 格式获取当前时间
- 05按指定单位计算时间差
适用场景
- 01转换指定时区的时间戳
- 02在 Agent 工作流中加入当前日期和时间
- 03计算两个日期时间之间的时长
MCP 相关
通过 MCP 提供时间处理工具,包括时区和当前时间查询、Unix 时间戳转换以及时间差计算。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
暂未收录安装方式
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
用于时间操作的 MCP 服务
用于时间操作的动态 MCP 服务管理服务。
MCP 工具
此服务通过 Model Context Protocol (MCP) 提供多种与时间相关的工具。
get_timezone
获取服务的当前时区。
- 返回:
text:时区字符串。- 例如:
Asia/Tokyo
- 例如:
get_unixtime
获取当前 Unix 时间戳(自纪元起的秒数)。
- 返回:
text:以字符串形式表示的 Unix 时间戳。- 例如:
1746627290
- 例如:
convert_unix_to_datetime
将 Unix 时间戳转换为格式化的日期时间字符串。
-
参数:
unixtime(number,必填):要转换的 Unix 时间戳。- 例如:
1746627290
- 例如:
timezone(string,可选):要使用的时区(默认:服务的时区)。- 例如:
Asia/Tokyo
- 例如:
isISO(boolean,可选):如果为 true,则返回 ISO 8601 格式;否则,返回YYYY-MM-DD HH:mm:ss。- 例如:
true
- 例如:
-
返回:
text:格式化的日期时间字符串。- 例如:
2025-01-01 01:01:01或2025-01-01T01:01:01+09:00
- 例如:
convert_datetime_to_unix
将日期时间字符串转换为 Unix 时间戳(自纪元起的毫秒数)。
-
参数:
time(string,必填):要转换的日期时间字符串。- 例如:
2025-01-01 01:01:01
- 例如:
timezone(string,可选):要使用的时区(默认:服务的时区)。- 例如:
Asia/Tokyo
- 例如:
-
返回:
text:以字符串形式表示的 Unix 时间戳。- 例如:
1746627290000
- 例如:
get_current_date_time
以 YYYY-MM-DD HH:mm:ss 格式获取当前日期和时间。
-
参数:
timezone(string,可选):要使用的时区(默认:服务的时区)。- 例如:
Asia/Tokyo
- 例如:
-
返回:
text:格式化后的当前日期和时间。- 例如:
2025-01-01 01:01:01
- 例如:
get_current_date_time_iso
以 ISO 8601 格式获取当前日期和时间。
-
参数:
timezone(string,可选):要使用的时区(默认:服务的时区)。- 例如:
Asia/Tokyo
- 例如:
-
返回:
text:格式化为 ISO 8601 的当前日期和时间。- 例如:
2025-05-07T23:03:27+09:00
- 例如:
get_elapsed_time
计算两个日期时间字符串之间的差值。
-
参数:
from(string,必填):开始日期时间。- 例如:
2025-01-01 01:01:01
- 例如:
to(string,必填):结束日期时间。- 例如:
2025-01-02 02:02:02
- 例如:
unit("millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "year",可选,默认值:"second"):差值的单位。- 例如:
"hour"
- 例如:
-
返回:
text:以指定单位表示的两个日期时间之间的差值。- 例如:
3600
- 例如:
准备 MCP 服务应用
1. 安装软件包
pnpm install
2. 构建
pnpm build
MCP 检查器
pnpm inspect
get_current_date_time
get_elapsed_time
VS Code
在项目中管理时
.vscode/mcp.json
{
"servers": {
"time-tools": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/PARENT/FOLDER/build/index.js"]
}
}
}
个人全局管理
~/Library/Application Support/Code/User/settings.json
{
"mcp": {
"servers": {
"time-tools": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/PARENT/FOLDER/build/index.js"]
}
}
}
}
提示词示例
英文
## Overview
- Please perform the following tasks
- Perform the following tasks and measure the time it takes to perform the tasks.
- Please follow the time tracking requirements for the measurement method
## Tasks
- Create the src directory
- Create an empty file in it
- Name the file index.ts
## Time tracking requirements
1. retrieve and display the current time before the task starts 2.
2. retrieve and display the current time after the task is completed 3.
3. retrieve and display the elapsed time from the start and end time of the task 4. finally display the following table
4. finally display in the following table format
|item|record|
|:---|:---|
|start time|<enter result>|
|end time|<enter result>|
|elapsed time|<enter result>|
日文
## 概要
- 以下のタスクを実行してください
- タスク実行に要した時間も計測します
- 計測の方法はタイムトラッキング要件にしたがってください
## タスク
- src ディレクトリを作成する
- その中に空のファイルを作成する
- 作成するファイル名は index.ts とする
## タイムトラッキング要件
1. タスク開始前の現在時間を取得して表示する
2. タスク終了後の現在時間を取得して表示する
3. タスクの開始時と終了時の時間から経過時間を取得して表示する
4. 最終的に以下の表形式で表示してください
|項目|記録|
|:---|:---|
|開始時間|<結果を入力>|
|終了時間|<結果を入力>|
|経過時間|<結果を入力>|
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。