MCP 时间服务器
概述
MCP 时间服务器是一个基于 Python 的复杂微服务,旨在提供跨不同时区的高级时间相关实用程序。它提供了强大的功能,可以检索当前时间并在各个全球时区之间转换时间。
项目详情
版本:0.1.1
Python 兼容性:Python 3.11+
特征
当前时间检索:获取任何 IANA 时区的当前时间
时区转换:不同时区之间的时间转换
全面验证:使用 Pydantic 模型进行强大的输入验证
异步服务器架构:使用 asyncio 构建,性能高效
灵活配置:可通过环境变量和配置文件进行配置
依赖项
核心依赖项:
mcp(>=1.6.0)
pydantic(>=2.11.2)
PyYAML(>=6.0.2)
pyz(>=0.4.3)
开发依赖项:
pytest(>=8.3.5)
安装
先决条件
Python 3.11 或更高版本
点子
(可选)建议使用虚拟环境
从 PyPI 安装
从源安装
克隆存储库:
创建虚拟环境:
安装软件包:
开发安装
为开发进行设置:
运行服务器
命令行界面
程序化使用
环境变量
NO_BOOTSTRAP
:设置为禁用组件引导其他配置选项可以在配置文件中设置
可用工具
1.获取当前时间
输入:
timezone
:IANA 时区名称(例如,“America/New_York”)
例子:
返回:
指定时区的当前时间
时区详情
夏令时 (DST) 状态
2. 转换时间
输入:
source_timezone
:源时区(IANA 格式)time
:HH:MM(24 小时)格式的时间target_timezone
:目标时区(IANA 格式)
例子:
返回:
源时间详细信息
目标时间详情
区域间时差
发展
代码格式化
黑色用于代码格式
isort 用于导入排序
行长度设置为 88 个字符
运行测试
贡献
分叉存储库
创建你的功能分支(
git checkout -b feature/AmazingFeature
)确保代码通过格式化和测试
提交您的更改(
git commit -m 'Add some AmazingFeature'
)推送到分支(
git push origin feature/AmazingFeature
)打开拉取请求
执照
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
一个 Python 微服务,提供用于检索当前时间并在不同的全球时区之间进行转换的实用程序,并具有强大的验证功能。
Related Resources
Related MCP Servers
- -securityFlicense-qualityAn MCP server providing timezone conversions and time-related operations via RESTful API endpoints, featuring comprehensive error handling and timezone database integration.Last updated -
- -securityAlicense-qualityA TypeScript server that provides time-related tools through the Model Context Protocol, allowing users to get current time in various timezones and convert times between different IANA timezones.Last updated -MIT License
- -securityFlicense-qualityAn MCP server that allows users to get global time information via Interzoid's GetGlobalTime API, enabling access to time data across different regions through natural language.Last updated -
- -securityAlicense-qualityA Model Context Protocol server that provides the current time in any timezone with customizable formatting, allowing AI assistants to access accurate time information.