Skip to main content
Glama
lvdaxianer

datetime-mcp-server

by lvdaxianer

datetime-mcp-server

中文版

Overview

datetime-mcp-server is a Model Context Protocol (MCP) server that provides a tool for getting the current date and time with customizable format.

Related MCP server: Utility MCP Server

Features

  • Get current datetime with customizable format

  • Default format: yyyy-MM-dd (e.g., "2026-03-11")

  • Supports various format placeholders: yyyy, MM, dd, HH, mm, ss

  • Supports both stdio and HTTP transport modes

Installation

# Install globally
npm install -g datetime-mcp-server

# Or run directly with npx
npx datetime-mcp-server

Usage

Command Line (stdio)

# Run with stdio (default)
npx datetime-mcp-server

HTTP Server

# Run HTTP server on port 3000
TRANSPORT=http npx datetime-mcp-server

# Custom port
PORT=8080 TRANSPORT=http npx datetime-mcp-server

Claude Code Integration

Add to your ~/.claude.json:

{
  "mcpServers": {
    "datetime": {
      "command": "npx",
      "args": ["-y", "datetime-mcp-server"]
    }
  }
}

Available Tool

get_current_datetime

Get the current date and time with custom format.

Parameters:

Parameter

Type

Required

Default

Description

format

string

No

yyyy-MM-dd

Date format string

Format Placeholders:

Placeholder

Description

Example

yyyy

4-digit year

2026

MM

2-digit month

01-12

dd

2-digit day

01-31

HH

24-hour hour

00-23

mm

2-digit minute

00-59

ss

2-digit second

00-59

Examples:

{
  "name": "get_current_datetime",
  "arguments": {}
}
// Returns: "2026-03-11"

{
  "name": "get_current_datetime",
  "arguments": {
    "format": "yyyy-MM-dd HH:mm:ss"
  }
}
// Returns: "2026-03-11 14:30:45"

{
  "name": "get_current_datetime",
  "arguments": {
    "format": "yyyy/MM/dd HH:mm"
  }
}
// Returns: "2026/03/11 14:30"

Development

# Install dependencies
npm install

# Run tests
npm test

# Build
npm run build

License

MIT

Available Tools

1 tool
get_current_datetimeGet Current DateTimeA
Read-only

获取当前日期和时间,支持自定义格式化。

该工具返回当前的日期时间,可以指定返回的格式。如果不指定格式,默认返回 "yyyy-MM-dd" 格式。

支持的格式占位符:

  • yyyy: 4位年份 (例如: 2026)

  • MM: 2位月份 (01-12)

  • dd: 2位日期 (01-31)

  • HH: 24小时制小时 (00-23)

  • mm: 2位分钟 (00-59)

  • ss: 2位秒数 (00-59)

使用示例:

  • format="yyyy-MM-dd" -> "2026-03-11"

  • format="yyyy-MM-dd HH:mm:ss" -> "2026-03-11 14:30:00"

  • format="yyyy/MM/dd HH:mm" -> "2026/03/11 14:30"

注意事项:

  • 该工具始终返回当前时间,每次调用结果可能不同

  • 返回的是服务器本地时间

ParametersJSON Schema
NameRequiredDescriptionDefault
formatNo日期时间格式,支持的占位符: yyyy(年份), MM(月份), dd(日期), HH(小时), mm(分钟), ss(秒). 例如: 'yyyy-MM-dd' 或 'yyyy-MM-dd HH:mm:ss'yyyy-MM-dd

TDQS

A4.8/5.0
Behavior5/5

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

The description adds valuable behavioral context beyond annotations. Annotations indicate read-only, non-destructive, non-idempotent, and closed-world hints, but the description elaborates with specific traits: '该工具始终返回当前时间,每次调用结果可能不同' (always returns current time, results may differ per call) and '返回的是服务器本地时间' (returns server local time). This clarifies the non-idempotent nature and time source, enhancing transparency without contradicting annotations.

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 well-structured and appropriately sized. It starts with a clear purpose statement, followed by sections on format placeholders, usage examples, and notes. Each sentence adds value: no redundancy with schema or annotations, and information is front-loaded for quick understanding. The length is justified by the detailed formatting instructions and examples.

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

Completeness5/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 (1 optional parameter, no output schema), the description is complete. It covers purpose, usage, parameters with examples, and behavioral notes. Annotations provide safety context, and the description fills in gaps like time variability and server specifics. No output schema exists, but the description implies string return values through examples, which is sufficient for this simple tool.

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

Parameters5/5

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

The description significantly enhances parameter semantics beyond the input schema. Schema coverage is 100% with a clear description of the 'format' parameter, but the description adds detailed format placeholders (e.g., yyyy, MM, dd), usage examples (e.g., 'yyyy-MM-dd' -> '2026-03-11'), and default behavior ('如果不指定格式,默认返回 "yyyy-MM-dd" 格式' - if no format specified, defaults to 'yyyy-MM-dd'). This provides practical guidance that complements the schema.

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

Purpose5/5

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

The description clearly states the tool's purpose: '获取当前日期和时间,支持自定义格式化' (Get current date and time, supports custom formatting). It specifies the verb ('获取' - get), resource ('当前日期和时间' - current date and time), and distinguishes it from potential siblings by mentioning formatting support. No siblings exist, but the description is specific enough to stand alone.

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

Usage Guidelines4/5

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

The description provides clear context for usage: it explains when to use the tool (to get current datetime with optional formatting) and includes a '注意事项' (notes) section clarifying that it returns server local time and results vary per call. However, it lacks explicit alternatives or exclusions (e.g., when not to use it), as there are no sibling tools, so it doesn't need sibling differentiation but could mention use cases more broadly.

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. 1 tool updatev1.0.0
    • First observedget_current_datetime

TDQS

A4.4/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tools. The single tool 'get_current_datetime' has a clear, distinct purpose that cannot be mistaken for any other functionality.

Naming Consistency5/5

The naming is trivially consistent as there is only one tool. The tool name 'get_current_datetime' follows a clear verb_noun pattern (get + current_datetime), which would be appropriate if more tools were added.

Tool Count2/5

A single tool is too few for a server named 'datetime-mcp-server', which suggests a broader scope for date and time operations. While the tool is functional, the server lacks operations like date parsing, timezone conversion, or date arithmetic, making it feel incomplete and under-scoped.

Completeness2/5

The server is severely incomplete for a datetime domain. It only provides current datetime retrieval with formatting, missing essential operations such as date manipulation, comparison, parsing from strings, or handling different timezones. This creates significant gaps that would limit agent capabilities in datetime-related tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that provides tools to get the current date and time in various formats, supporting different timezones and custom formatting options.
    1
    14 npm
    1
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    A general-purpose MCP server providing time-related utilities such as fetching current time, Unix timestamps, and formatting services. It supports both local stdio and remote SSE communication modes for versatile AI client integration.
    3
    -
  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server built with FastMCP that provides tools for retrieving the current local date and time. It allows LLMs to access precise temporal information directly from the host environment.
    9
    MIT
  • A
    license
    D
    quality
    C
    maintenance
    A lightweight MCP server that provides date and time tools, including the ability to retrieve current timestamps and parse date strings with IANA timezone support. It enables AI models to interact with the host OS clock and perform temporal calculations via stdio transport.
    3
    8 npm
    7
    MIT