MCP Time Server
MCP 时间服务器 ( mcp-time-srv )
用 TypeScript 实现的简单模型上下文协议 (MCP) 服务器,提供与时间相关的查询工具,包括获取各个时区的当前时间以及在时区之间转换时间。
该服务器支持现代 Streamable HTTP 和传统 HTTP+SSE MCP 传输协议。
特征
提供以下 MCP 工具:
get_current_time:返回指定 IANA 时区的当前时间。convert_time:将给定时间从源 IANA 时区转换为目标 IANA 时区。
Related MCP server: Time Tools MCP Server
先决条件
设置
克隆存储库(如果还没有):
# git clone <your-repo-url> # cd mcp-time-srv安装依赖项:
npm install
本地运行
构建 TypeScript 代码:
npm run build这会将
src/中的 TypeScript 源编译为dist/中的 JavaScript。**运行服务器:**您可以使用
ts-node(用于开发)运行服务器,或者在构建后直接使用node运行服务器。使用
ts-node:npx ts-node src/server.ts使用
node(构建后):node dist/server.js
服务器将启动,通常监听端口 3000。
MCP Time server listening on http://localhost:3000使用 Docker 运行(可选)
提供了Dockerfile用于在容器中构建和运行服务器。
构建 Docker 镜像:
docker build -t mcp-time-srv .运行容器:
docker run -d -p 3000:3000 --name my-mcp-server mcp-time-srv-d:以分离模式运行(在后台)。-p 3000:3000:将主机上的端口 3000 映射到容器中的端口 3000。--name my-mcp-server:为容器分配一个名称,以便于管理。
服务器将在容器内运行,可通过http://localhost:3000访问。
要停止容器:
docker stop my-mcp-server查看日志:
docker logs my-mcp-server与客户端一起测试
包含一个简单的测试客户端脚本( src/client.ts )来演示与服务器工具的交互。
确保服务器正在运行(本地或在 Docker 中)。
运行客户端:
npx ts-node src/client.ts
客户端将连接到服务器(默认使用 SSE 传输),列出可用的工具,使用示例参数调用每个工具(包括一些用于测试错误处理的参数),并打印结果。
工具详细信息
get_current_time
返回指定时区的当前时间。
输入参数:
timezone(字符串,可选):IANA 时区名称 (例如,America/New_York、Europe/London)。如果省略,则默认为服务器本地时区。
**输出:**一个 JSON 对象,包含以下内容:
timezone(字符串):使用的有效时区。datetime(字符串):带有偏移量的 ISO 8601 格式的当前时间(例如,2025-04-26T01:39:15Z)。
convert_time
将时间从源时区转换为目标时区。
输入参数:
source_timezone(字符串,可选):源 IANA 时区名称。如果省略,则默认为服务器本地时区。time(字符串,必需):以 24 小时 HH:MM 格式转换的时间(例如14:30)。target_timezone(字符串,可选):目标 IANA 时区名称。如果省略,则默认为服务器本地时区。
**输出:**一个 JSON 对象,包含以下内容:
source(对象):源时区中的时间详细信息(timezone,datetime)。target(对象):目标时区(timezone,datetime)中转换时间的详细信息。time_difference(字符串):目标时区和源时区偏移之间的差异(例如+8h、-5h、+5.75h)。
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceA TypeScript server implementing the Model Context Protocol (MCP) that provides datetime and timezone information to AI agents and chat interfaces, allowing them to access current time in various timezones.49,8874Mozilla Public 2.0
- AlicenseAqualityDmaintenanceA Model Context Protocol server for time manipulation tasks, enabling AI models to get the current date/time and calculate duration between timestamps.72MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides tools to get the current date and time in various formats, supporting different timezones and custom formatting options.1381MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides time and timezone conversion capabilities, enabling LLMs to get current time information and perform timezone conversions using IANA timezone names.2MIT
Related MCP Connectors
A real clock for AI agents: current time, timezone conversion, and DST facts from the IANA tzdb.
A time server that keeps your AI honest about time. Real clock + drift guard, zero dependencies.
A Model Context Protocol server for Wix AI tools
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jharkins/mcp-time-srv'
If you have feedback or need assistance with the MCP directory API, please join our Discord server