SuperAPI AI Directory

mcp-datetime

Date and time functions in various formats.

Open website

About this tool

Purpose

mcp-datetime is a date-time formatting service implemented as an MCP server, designed specifically for the Claude Desktop application. It solves the problem of enabling the model to obtain the current date and time and return it in a desired format, supports multiple formats, and is specially optimized for formats used to generate filenames.

Main Capabilities

  • Supports multiple date-time formats: standard format, Japanese format, ISO format, etc.
  • Supports the Japanese language.
  • Provides formats optimized for filename generation.
  • Accurate time zone handling.
  • Seamless integration with the Claude Desktop application.

The server implements one tool:

  • get_datetime: Gets the current date and time, supporting multiple formats. It accepts the required string parameter "format" and returns a date-time string based on the specified format. Supported format types include standard, Japanese, and ISO formats.

Command format examples:

  • Standard date-time format: call datetime-service.get_datetime {"format": "datetime"}, example result: 2024-12-10 00:54:01
  • Japanese format: call datetime-service.get_datetime {"format": "datetime_jp"}, example result: 2024年12月10日 00時54分01秒
  • Filename format: call datetime-service.get_datetime {"format": "filename_md"}, example result: 20241210005401.md

Usage

Prerequisites

Before using mcp-datetime, ensure the following tools are installed:

  • Python 3.12 or later
  • uv (Python package installer)
  • uvx (Python package runner)

Use with the Claude Desktop application

Add the corresponding configuration to the configuration file. Configuration file location (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json

Manual installation

If you need to install the package directly (for example, for development or to view the source code), you can use one of the following methods:

  • From PyPI installation: pip install mcp-datetime
  • Installation from GitHub source code: git clone https://github.com/ZeparHyfar/mcp-datetime.git cd mcp-datetime pip install -e .

Example claude_desktop_config.json for manual installation: { "mcpServers": { "mcp-datetime": { "command": "python", "args": ["-m", "mcp_datetime"], "env": { "PYTHON": "/path/to/your/python" } } } } Replace "/path/to/your/python" with the actual Python interpreter path, for example "/usr/local/bin/python3" or "/Users/username/.pyenv/versions/3.12.0/bin/python3".

Example prompt for the Claude Desktop application

User: Please tell me the current time in date_slash format Claude: I will get the current date in date_slash format. The current date is 2024/12/12

Debugging

Because the MCP server runs via stdio, debugging can be difficult. MCP Inspector is recommended:

  • Using the PyPI package: npx @modelcontextprotocol/inspector uvx mcp-datetime
  • Using source code downloaded from GitHub: git clone https://github.com/ZeparHyfar/mcp-datetime.git npx @modelcontextprotocol/inspector uvx --directory ./mcp-datetime run mcp-datetime

Applicable scenarios and limitations

Suitable for scenarios such as needing to obtain formatted date-time strings in Claude Desktop and generating filenames with timestamps. Limitation: this package has only been tested on macOS, and Windows compatibility has not been verified. The specific list of supported formats is not fully listed in the provided materials. This project uses the MIT License.