Skip to main content
Glama
odgrim

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

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool gets current time but doesn't disclose behavioral traits like whether it's read-only, requires permissions, has rate limits, or what the output format is. This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose with zero waste. Every word earns its place, making it appropriately sized for this simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters, no output schema), the description is minimally adequate but lacks details on behavioral aspects like output format or usage context. It doesn't fully compensate for the absence of annotations and output schema, leaving gaps in understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description adds no parameter information, which is acceptable since there are no parameters to document.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('current time'), specifying it returns time in the configured local timezone. It distinguishes from siblings like get-time-in-timezone by focusing on local time, but doesn't explicitly contrast with get-current-timezone or list-timezones.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like get-current-timezone or get-time-in-timezone. The description implies usage for local time retrieval but lacks context on exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-current-timezoneB

Get the current system timezone

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states what the tool does without behavioral details. It doesn't disclose whether this is a read-only operation, if it requires permissions, how it handles errors, or what format the timezone is returned in (e.g., IANA code, offset).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core purpose and efficiently conveys the essential information without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that returns data. It doesn't specify what the output looks like (e.g., timezone name, offset, or structured object), which is critical for an agent to use the tool effectively. The simplicity of the tool mitigates this somewhat, but key behavioral context is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't mention parameters, aligning with the schema. A baseline of 4 is applied since no parameters exist.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('current system timezone'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-current-time' or 'list-timezones', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get-current-time' (which might return time without timezone) or 'list-timezones' (which lists available timezones). The description lacks context about use cases or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-time-in-timezoneC

Get the current time in a specific timezone

ParametersJSON Schema
NameRequiredDescriptionDefault
timezoneYesThe timezone to get the current time for

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe how it behaves—for example, it doesn't mention error handling for invalid timezones, whether it returns formatted time or raw data, or any rate limits. This leaves significant gaps in understanding the tool's operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that performs a read operation. It doesn't explain what the return value looks like (e.g., formatted string, timestamp), error conditions, or how to handle invalid inputs. This leaves the agent with insufficient context to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'timezone' fully documented in the schema. The description adds no additional meaning beyond what the schema provides, such as examples of valid timezone formats (e.g., 'America/New_York') or constraints. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'get' and the resource 'current time in a specific timezone', making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-current-time' (which might return time without timezone specification) or 'list-timezones' (which lists available timezones rather than getting time for one).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings. It doesn't mention alternatives like 'get-current-time' for time without timezone or 'list-timezones' for browsing timezones, nor does it specify prerequisites such as needing a valid timezone identifier.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-timezonesB

List all available timezones

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List') but doesn't describe return format, pagination, rate limits, or error handling. This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple tool, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the return value looks like (e.g., list format, timezone identifiers), which is critical for a tool that lists data. This gap reduces usability for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't mention parameters, earning a high baseline score for not adding unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all available timezones'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get-current-timezone' or 'get-time-in-timezone', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get-current-timezone' or 'get-time-in-timezone'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 4 tool updatesv1.0.0
    • Addedget-current-time
    • Addedget-current-timezone
    • Addedget-time-in-timezone
    • Addedlist-timezones

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 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
    C
    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
    43 npm
    25
    MIT