dohdalabs/datetime-mcp
If you are the rightful owner of datetime-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server that provides tools for retrieving the current datetime in various formats, with a focus on ISO8601 format.
Datetime MCP Server
A Model Context Protocol (MCP) server that provides tools for retrieving the current datetime in various formats, with a focus on ISO8601 format.
Features
- ISO8601 Format: Returns datetime in standard ISO8601 format (default)
- Multiple Formats: Support for ISO8601, Unix timestamp, and human-readable formats
- Timezone Support: UTC (default) or local system timezone
- Microsecond Precision: Optional microsecond precision for ISO8601 format
- Single Binary: Compiled Go binary - no dependencies or runtime needed
Installation
Building from Source
-
Install Go (version 1.21 or later)
-
Build the binary:
go build -o datetime-mcp main.go
This creates a single datetime-mcp binary that you can run anywhere.
- (Optional) Install to a directory in your PATH:
sudo mv datetime-mcp /usr/local/bin/
Usage
Running the Server
Run the server directly:
./datetime-mcp
Or if installed in PATH:
datetime-mcp
Available Tool
The server provides one tool:
get_current_datetime
Get the current datetime in the specified format and timezone.
Parameters:
timezone(optional): Either"UTC"(default) or"local"format(optional): One of:"iso8601"(default) - ISO8601 format (e.g.,2025-10-30T14:23:45.123456+00:00)"unix_timestamp"- Unix timestamp (e.g.,1730301825.123456)"human_readable"- Human-friendly format (e.g.,October 30, 2025 at 2:23:45 PM UTC)
include_microseconds(optional): Whether to include microseconds in ISO8601 format (default:true)
Examples:
- Get current time in ISO8601 UTC (default):
{}
or
{
"timezone": "UTC",
"format": "iso8601",
"include_microseconds": true
}
- Get current local time in ISO8601:
{
"timezone": "local",
"format": "iso8601"
}
- Get Unix timestamp:
{
"format": "unix_timestamp"
}
- Get human-readable format:
{
"timezone": "UTC",
"format": "human_readable"
}
- Get ISO8601 without microseconds:
{
"format": "iso8601",
"include_microseconds": false
}
Configuration
Using with Claude Desktop
Add this server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"datetime": {
"command": "/path/to/datetime-mcp"
}
}
}
Replace /path/to/datetime-mcp with the actual path to your binary.
Using with Cursor
Add this server to your Cursor MCP configuration file:
macOS/Linux: ~/.cursor/mcp.json
Windows: %APPDATA%\Cursor\mcp.json
{
"mcpServers": {
"datetime": {
"command": "/path/to/datetime-mcp"
}
}
}
Replace /path/to/datetime-mcp with the actual path to your binary.
Design Decisions
This MCP server follows best practices:
- Clear Naming: Server named
datetime-mcpfollowing conventions - Input Validation: Validates input parameters and provides sensible defaults
- Comprehensive Documentation: Detailed descriptions and examples
- Single Binary: No dependencies - just one executable file
- Sensible Defaults: Defaults to ISO8601 UTC format as the most standard option
Architecture
The server is built in Go using the MCP JSON-RPC protocol over stdio, providing:
- Simple, dependency-free deployment
- Fast startup and execution
- Cross-platform binary support
- No runtime environment required
Cross-Platform Builds
To build for different platforms:
# macOS (Intel)
GOOS=darwin GOARCH=amd64 go build -o datetime-mcp-darwin-amd64 main.go
# macOS (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o datetime-mcp-darwin-arm64 main.go
# Linux (64-bit)
GOOS=linux GOARCH=amd64 go build -o datetime-mcp-linux-amd64 main.go
# Windows
GOOS=windows GOARCH=amd64 go build -o datetime-mcp-windows-amd64.exe main.go
License
This project is licensed under the MIT License - see the file for details.
This server implements the Model Context Protocol (MCP) specification.