Format dates and generate timestamped filenames via mcp-datetime (uvx)
How to use mcp-datetime to generate formatted timestamps and timestamped filenames from an agent, without writing any date-formatting code yourself.
Recipe: Format dates and generate timestamped filenames via mcp-datetime
Server: mcp-datetime v1.27.2 (PyPI) Launch: uvx mcp-datetime (stdio transport, zero config, no credentials) Tools: 1 — get_datetime
What it does
get_datetime takes a format string and returns the current timestamp in that pattern. 17 built-in formats covering:
- Standard dates:
date→2026-06-11,date_slash→2026/06/11 - Japanese locale:
date_jp→2026年06月11日,datetime_jp→2026年06月11日 07時14分52秒,time_jp→07時14分52秒 - ISO 8601:
iso→2026-06-11T07:14:52+0300,iso_basic→20260611T071452+0300,datetime_t→2026-06-11T07:14:52 - Compact numeric:
compact→20260611071453,compact_date→20260611,compact_time→071453 - Filename-safe with extension:
filename_md→20260611071452.md,filename_txt→…txt,filename_log→…log - Log format:
log→2026-06-11 07:14:54.246702(microseconds),log_compact→20260611_071454 - Standard:
datetime→2026-06-11 07:14:54,time→07:14:54
Edge case: invalid format
Passing an unknown format returns isError: true with message Unknown format type: <name> — clean error, no crash.
When to use
- Agent needs a timestamped filename for output (use
filename_md,filename_txt,filename_log) - Agent needs ISO 8601 for API calls or structured data
- Agent generates Japanese-locale documents
- Agent wants a log-compatible timestamp with microsecond precision
Why not just use mcp-server-time?
mcp-server-time (the Anthropic reference server) gives you timezone-aware current time and timezone conversion. mcp-datetime gives you formatted output in 17 patterns — filename-safe strings, Japanese locale, log format with microseconds. Different tools for different jobs; combine them when needed.
{ "server": "mcp-datetime", "version": "1.27.2", "transport": "stdio", "launch": "uvx mcp-datetime", "handshake": { "initialize": { "request": { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": { "name": "pathfinder", "version": "1.0" } } }, "response": { "jsonrpc": "2.0", "id": 1, "result": { "protocolVersion": "2024-11-05", "capabilities": { "experimental": {}, "tools": { "listChanged": false } }, "serverInfo": { "name": "mcp-datetime", "version": "1.27.2" } } } }, "tools_list": { "request": { "jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {} }, "response_tool_count": 1, "tools": ["get_datetime"] } }, "calls": [ { "request": { "jsonrpc": "2.0", "id": 10, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "iso" } } }, "result": "2026-06-11T07:14:52+0300" }, { "request": { "jsonrpc": "2.0", "id": 11, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "filename_md" } } }, "result": "20260611071452.md" }, { "request": { "jsonrpc": "2.0", "id": 12, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "date_jp" } } }, "result": "2026年06月11日" }, { "request": { "jsonrpc": "2.0", "id": 13, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "compact" } } }, "result": "20260611071453" }, { "request": { "jsonrpc": "2.0", "id": 14, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "log" } } }, "result": "2026-06-11 07:14:54.246702" }, { "request": { "jsonrpc": "2.0", "id": 15, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "datetime" } } }, "result": "2026-06-11 07:14:54" }, { "request": { "jsonrpc": "2.0", "id": 99, "method": "tools/call", "params": { "name": "get_datetime", "arguments": { "format": "nonexistent_format" } } }, "result_isError": true, "result_text": "Unknown format type: nonexistent_format" } ], "probed_at": "2026-06-11T04:15:00Z", "success_rate": "6/6 valid calls succeeded, 1/1 invalid call correctly errored" }