MCP DateTime

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides a Node.js runtime environment for the MCP server, enabling it to deliver datetime and timezone information to AI systems.

  • Allows installation and distribution of the MCP DateTime server through the npm package registry.

  • Implements the MCP server using TypeScript for type safety and modern JavaScript features.

MCP 日期时间

模型上下文协议 (MCP) 服务器的 TypeScript 实现,为代理系统和聊天 REPL 提供日期时间和时区信息。

概述

MCP DateTime 是一个简单的服务器,它实现了模型上下文协议 (MCP Protocol) ,用于向 AI 代理和聊天界面提供日期时间和时区信息。它允许 AI 系统:

  • 获取本地系统时区的当前时间
  • 获取任何有效时区的当前时间
  • 列出所有可用的时区
  • 通过 URI 资源访问时区信息

安装

来自 npm

npm install -g mcp-datetime

从源头

git clone https://github.com/odgrmi/mcp-datetime.git cd mcp-datetime npm install npm run build

用法

命令行

MCP DateTime 可以以两种模式运行:

1. 标准I/O模式(默认)

此模式非常适合通过标准输入/输出与支持 MCP 协议的 AI 系统集成:

mcp-datetime

2. 服务器发送事件(SSE)模式

此模式启动一个为 MCP 协议提供 SSE 传输的 HTTP 服务器:

mcp-datetime --sse

您还可以指定自定义端口和 URI 前缀:

mcp-datetime --sse --port=8080 --prefix=/api/datetime

环境变量

  • PORT :设置 SSE 模式的端口(默认值:3000)
  • URI_PREFIX :设置 SSE 模式的 URI 前缀(默认值:无)

可用工具

MCP DateTime 提供以下工具:

get-current-time

返回系统本地时区的当前时间。

get-current-timezone

返回当前系统时区。

get-time-in-timezone

返回指定时区的当前时间。

参数:

  • timezone :获取当前时间的时区(例如“America/New_York”)

list-timezones

返回所有可用时区的列表。

资源 URI

MCP DateTime 还通过资源 URI 提供对时区信息的访问:

datetime://{timezone}

返回指定时区的当前时间。

例如: datetime://America/New_York

datetime://list

返回所有可用时区的列表。

常见时区

以下常见时区始终可用:

  • 世界标准时间
  • 欧洲/伦敦
  • 欧洲/巴黎
  • 欧洲/柏林
  • 美国/纽约
  • 美国/芝加哥
  • 美国/丹佛
  • 美国/洛杉矶
  • 亚洲/东京
  • 亚洲/上海
  • 亚洲/加尔各答
  • 澳大利亚/悉尼
  • 太平洋/奥克兰

SSE 终端节点

在 SSE 模式下运行时,以下端点可用:

  • /sse :SSE 连接端点
  • /message :客户端到服务器通信的消息端点
  • /info :基本服务器信息

如果指定了 URI 前缀,它将被添加到所有端点的前面。

与人工智能系统集成

MCP DateTime 可以与支持模型上下文协议 (MCP Protocol) 的 AI 系统集成。这使得 AI 代理能够访问准确的时区和日期时间信息。

发展

先决条件

  • Node.js 14.16 或更高版本
  • npm

设置

git clone https://github.com/odgrim/mcp-datetime.git cd mcp-datetime npm install

建造

npm run build

以开发模式运行

npm run dev # Standard I/O mode npm run dev:sse # SSE mode

执照

该项目根据 Mozilla 公共许可证 2.0 获得许可 - 有关详细信息,请参阅LICENSE文件。

You must be authenticated.

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

实现模型上下文协议 (MCP) 的 TypeScript 服务器,为 AI 代理和聊天界面提供日期时间和时区信息,使它们能够访问各个时区的当前时间。

  1. Overview
    1. Installation
      1. From npm
      2. From source
    2. Usage
      1. Command Line
      2. Environment Variables
    3. Available Tools
      1. get-current-time
      2. get-current-timezone
      3. get-time-in-timezone
      4. list-timezones
    4. Resource URIs
      1. datetime://{timezone}
      2. datetime://list
    5. Common Timezones
      1. SSE Endpoints
        1. Integration with AI Systems
          1. Development
            1. Prerequisites
            2. Setup
            3. Build
            4. Run in Development Mode
          2. License
            ID: mqxvg1vgrg