MCP Time Server

by chrishayuk
Verified

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.

Integrations

  • Includes component bootstrapping functionality that can be disabled via the NO_BOOTSTRAP environment variable

  • Supports development workflows through Git with contribution guidelines for feature branches and pull requests

  • Utilizes Pydantic for robust input validation using Pydantic models to ensure data integrity for time-related operations

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 安装

pip install chuk-mcp-time-server

从源安装

  1. 克隆存储库:
git clone <repository-url> cd chuk-mcp-time-server
  1. 创建虚拟环境:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
  1. 安装软件包:
pip install . # Installs the package in editable mode

开发安装

为开发进行设置:

pip install .[dev] # Installs package with development dependencies

运行服务器

命令行界面

chuk-mcp-time-server

程序化使用

from chuk_mcp_time_server.main import main if __name__ == "__main__": main()

环境变量

  • NO_BOOTSTRAP :设置为禁用组件引导
  • 其他配置选项可以在配置文件中设置

可用工具

1.获取当前时间

输入

  • timezone :IANA 时区名称(例如,“America/New_York”)

例子

get_current_time('Europe/London')

返回

  • 指定时区的当前时间
  • 时区详情
  • 夏令时 (DST) 状态

2. 转换时间

输入

  • source_timezone :源时区(IANA 格式)
  • time :HH:MM(24 小时)格式的时间
  • target_timezone :目标时区(IANA 格式)

例子

convert_time('America/New_York', '14:30', 'Europe/Paris')

返回

  • 源时间详细信息
  • 目标时间详情
  • 区域间时差

发展

代码格式化

  • 黑色用于代码格式
  • isort 用于导入排序
  • 行长度设置为 88 个字符

运行测试

pytest

贡献

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/AmazingFeature
  3. 确保代码通过格式化和测试
  4. 提交您的更改( git commit -m 'Add some AmazingFeature'
  5. 推送到分支( git push origin feature/AmazingFeature
  6. 打开拉取请求

执照

MIT 许可证

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

一个 Python 微服务,提供用于检索当前时间并在不同的全球时区之间进行转换的实用程序,并具有强大的验证功能。

  1. Overview
    1. Project Details
      1. Features
        1. Dependencies
          1. Installation
            1. Prerequisites
            2. Install from PyPI
            3. Install from Source
            4. Development Installation
          2. Running the Server
            1. Command-Line Interface
            2. Programmatic Usage
          3. Environment Variables
            1. Available Tools
              1. 1. Get Current Time
              2. 2. Convert Time
            2. Development
              1. Code Formatting
              2. Running Tests
            3. Contributing
              1. License
                ID: ilrn5h088x