Skip to main content
Glama
MCP DateTime

MCP DateTime

by odgrim

MCP 日期时间

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

概述

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

  • 获取本地系统时区的当前时间

  • 获取任何有效时区的当前时间

  • 列出所有可用的时区

  • 通过 URI 资源访问时区信息

Related MCP server: Time Tools MCP Server

安装

来自 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文件。

Available Tools

4 tools
get-current-timeB

Get the current time in the configured local timezone

Inputs: no named parameters.

get-current-timezoneB

Get the current system timezone

Inputs: no named parameters.

get-time-in-timezoneC

Get the current time in a specific timezone

Inputs: timezone (required).

list-timezonesB

List all available timezones

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 4 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity: get-current-time retrieves local time, get-current-timezone returns the system timezone, get-time-in-timezone fetches time for a specified zone, and list-timezones enumerates available zones. The descriptions make it impossible to confuse these tools.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with hyphens (e.g., get-current-time, list-timezones). This predictable naming scheme enhances readability and agent usability without any deviations.

    Tool Count5/5

    With 4 tools, the server is well-scoped for handling date/time operations. Each tool earns its place by covering core functionalities: retrieving time, managing timezones, and listing options, making the count appropriate for the domain.

    Completeness5/5

    The tool surface provides complete coverage for basic date/time operations: it supports getting current time (locally and in specific zones), accessing timezone information, and listing all available zones. There are no obvious gaps for this focused purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A 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.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that provides time and timezone conversion capabilities, enabling LLMs to get current time information and perform timezone conversions using IANA timezone names.
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      The Time MCP Server is a Model Context Protocol (MCP) server that provides AI assistants and other MCP clients with standardized tools to perform time and date-related operations. This server acts as a bridge between AI tools and a robust time-handling back
      72 npm
      25
      MIT