Datetime Formatter MCP server

Provides flexible, timezone-aware date and time formatting across various locales.
Back to servers
Provider
ZeparHyfar
Release date
Dec 12, 2024
Language
Python
Package
Stats
4.9K downloads
11 stars

The MCP DateTime server provides date and time formatting capabilities that integrate with the Claude Desktop Application. It offers various datetime formats, including standard formats, Japanese language support, and optimized formats for filenames.

Installation

Prerequisites

Before using the MCP DateTime server, ensure you have:

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

Installation Methods

You can install the package using one of these methods:

From PyPI:

pip install mcp-datetime

From GitHub Source:

git clone https://github.com/ZeparHyfar/mcp-datetime.git
cd mcp-datetime
pip install -e .

Integration with Claude Desktop App

To integrate with the Claude Desktop App, add the following to your configuration file:

Config file location (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mcp-datetime": {
      "command": "uvx",
      "args": ["mcp-datetime"]
    }
  }
}

For manual installation, you can use the following configuration:

{
  "mcpServers": {
    "mcp-datetime": {
      "command": "python",
      "args": ["-m", "mcp_datetime"],
      "env": {
        "PYTHON": "/path/to/your/python"
      }
    }
  }
}

Replace "/path/to/your/python" with your actual Python interpreter path (e.g., "/usr/local/bin/python3").

Usage

Basic Examples

Command Format:

# Standard datetime format
call datetime-service.get_datetime {"format": "datetime"}
# Result: 2024-12-10 00:54:01

# Japanese format
call datetime-service.get_datetime {"format": "datetime_jp"}
# Result: 2024年12月10日 00時54分01秒

# Filename format
call datetime-service.get_datetime {"format": "filename_md"}
# Result: 20241210005401.md

Claude Desktop App Prompt Example:

  • User:

    Please tell me the current time in date_slash format
    
  • Claude:

    I'll get the current date in date_slash format.
    
    The current date is 2024/12/12
    

Supported Formats

Format Name Example Description
date 2024-12-10 Standard date format
date_slash 2024/12/10 Date with slashes
date_jp 2024年12月10日 Japanese date format
datetime 2024-12-10 00:54:01 Standard datetime
datetime_jp 2024年12月10日 00時54分01秒 Japanese datetime
datetime_t 2024-12-10T00:54:01 DateTime with T separator
compact 20241210005401 Compact format for IDs
compact_date 20241210 Compact date only
compact_time 005401 Compact time only
filename_md 20241210005401.md Markdown filename
filename_txt 20241210005401.txt Text filename
filename_log 20241210005401.log Log filename
iso 2024-12-10T00:54:01+0900 ISO 8601 format
iso_basic 20241210T005401+0900 Basic ISO format
log 2024-12-10 00:54:01.123456 Log format with microseconds
log_compact 20241210_005401 Compact log format
time 00:54:01 Time only
time_jp 00時54分01秒 Japanese time format

Debugging

Since MCP servers run over stdio, you can use the MCP Inspector for debugging:

npx @modelcontextprotocol/inspector uvx mcp-datetime

Or with downloaded source code:

git clone https://github.com/ZeparHyfar/mcp-datetime.git
npx @modelcontextprotocol/inspector uvx --directory ./mcp-datetime run mcp-datetime

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later