hyue95/mcp_server_01
3.2
If you are the rightful owner of mcp_server_01 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
MCP Time Server is a tool based on the Model Context Protocol (MCP) that provides time-related services, including current time retrieval and timezone conversion, and is written in TypeScript.
Tools
2
Resources
0
Prompts
0
MCP 时间服务器
基于 Model Context Protocol (MCP) 的时间服务工具。
功能
- 提供获取当前时间的工具
- 支持时区转换功能
- 使用 TypeScript 编写
- 基于 MCP 协议,可与 LLM 应用集成
安装
# 克隆项目
git clone <repository-url>
cd mcp-time-server
# 安装依赖
npm install
# 构建项目
npm run build
使用方法
启动服务器:
npm start
服务器默认运行在 3000 端口,可通过环境变量 PORT 修改。
API 端点
GET /- 服务器主页和文档POST /mcp- MCP 消息处理端点GET /mcp- SSE 服务器事件DELETE /mcp- 会话终止
MCP 工具说明
1. getCurrentTime
获取当前时间,可指定时区。
参数:
timezone(可选): 时区标识(例如: 'Asia/Shanghai', 'America/New_York')
2. convertTimezone
在不同时区之间转换时间。
参数:
datetime(可选): ISO 8601 格式的日期时间字符串,不提供则使用当前时间sourceTimezone: 源时区,默认为 'UTC'targetTimezone: 目标时区,默认为 'UTC'
配置为 MCP 服务
可以通过以下方式配置为 MCP 服务:
"mcpServers": {
"time-server-local": {
"type": "sse",
"url": "http://localhost:3000/mcp"
}
}
开发
# 启动开发模式
npm run dev
许可证
MIT