Datetime MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add datetime-mcp-server -- npx -y datetime-mcp-server
README.md

Get the current date and time with customizable format.

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.

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

Tools (1)

get_current_datetimeGet the current date and time with custom format.

Environment Variables

TRANSPORTSets the transport mode (stdio or http)
PORTSets the port for HTTP transport mode

Configuration

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

Try it

What is the current date in YYYY-MM-DD format?
Get the current time including seconds.
Show me the current date and time formatted as YYYY/MM/DD HH:mm.
What is the current date?

Frequently Asked Questions

What are the key features of Datetime MCP Server?

Get current datetime with customizable format. Supports format placeholders for year, month, day, hour, minute, and second. Supports both stdio and HTTP transport modes. Default format support for yyyy-MM-dd.

What can I use Datetime MCP Server for?

Injecting accurate timestamps into generated logs or reports. Standardizing date formats across different AI-assisted documentation tasks. Providing real-time context for time-sensitive data processing requests.

How do I install Datetime MCP Server?

Install Datetime MCP Server by running: npx datetime-mcp-server

What MCP clients work with Datetime MCP Server?

Datetime MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Datetime MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare