时区时间服务

一个基于Claude模型配置协议(MCP)的服务器,提供实时、时区感知的日期和时间信息。

  • by samay58
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 samay58/time-mcp

使用说明

时间mcp

克劳德模型配置协议(MCP)服务器,提供实时时区感知日期和时间信息。

特性

  • 获取任何IANA时区的当前时间
  • 通过MCP与Claude AI轻松集成
  • 使用Python的zoneinfo模块提供全面的时区支持
  • ISO格式的简单JSON响应

安装

# Clone the repository
git clone https://github.com/yourusername/time-mcp.git
cd time-mcp

# Set up virtual environment (using uv)
uv venv
source .venv/bin/activate

# Install the package
pip install -e .

用法

运行服务器

python -m src.time_mcp.server

这将在本地启动MCP服务器,使Claude可以使用时间工具。

可用工具

  • get_current_time:返回指定时区的当前时间
    • 参数: timezone (string)-任何有效的IANA时区(例如,“美洲/纽约”、“欧洲/伦敦”、“亚洲/东京”)
    • 默认值:如果未指定时区,则为“UTC”

发展

# Run tests
pytest tests/

# Lint code
ruff check .

# Format code
ruff format .

需求

  • Python 3.10+
  • MCP库

许可证

麻省理工学院