
Date and Time
STDIOMCP server providing current date and time information in various formats and timezones.
MCP server providing current date and time information in various formats and timezones.
A Model Context Protocol (MCP) server that provides current date and time information to AI agents. This server allows AI agents to access the current date and time in various formats and timezones.
To install date-and-time-mcp-server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @chirag127/date-and-time-mcp-server --client claude
git clone https://github.com/chirag127/date-and-time-mcp-server.git cd date-and-time-mcp-server
npm install
npm run build
To start the server with default settings:
npm start
With custom configuration:
npm start -- --timezone "America/New_York" --format "yyyy-MM-dd HH:mm:ss" --locale "en-US" --debug true
The server can be configured with the following options:
timezone
: Default timezone (IANA timezone identifier, e.g., "UTC", "America/New_York")format
: Default date format (ISO, UNIX, RFC2822, HTTP, SQL, or a custom format string)locale
: Default locale for formatting (e.g., "en-US", "fr-FR")debug
: Enable debug logging (true/false)getCurrentDateTime
Gets the current date and time in the specified format and timezone.
Parameters:
format
(optional): Format to return the date/time in (ISO, UNIX, RFC2822, HTTP, SQL, or a custom format string)timezone
(optional): Timezone to convert to (IANA timezone identifier)locale
(optional): Locale to use for formattingResponse:
{ "currentDateTime": "2023-05-15T12:30:45.000Z", "timestamp": 1684154445, "timezone": "UTC", "format": "ISO", "utcOffset": "+00:00" }
getTimezoneInfo
Gets information about a timezone.
Parameters:
timezone
: Timezone to get information about (IANA timezone identifier)Response:
{ "name": "America/New_York", "offset": "-04:00", "abbreviation": "EDT", "currentTime": "2023-05-15T08:30:45.000-04:00", "isDST": true }
To use this MCP server with Claude for Desktop, add the following to your Claude for Desktop configuration file:
{ "mcpServers": { "dateTime": { "command": "node", "args": ["/path/to/date-and-time-mcp-server/dist/index.js"] } } }
Here are some example prompts that an AI agent can use to interact with this MCP server:
date-and-time-mcp-server/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # MCP server implementation
│ ├── config.ts # Configuration options
│ ├── types.ts # TypeScript type definitions
│ ├── tools/
│ │ └── dateTime.ts # Date and time tool implementation
│ └── utils/
│ ├── formatters.ts # Date formatting utilities
│ └── timezones.ts # Timezone utilities
├── tests/
│ └── dateTime.test.ts # Tests for date and time functionality
├── dist/ # Compiled JavaScript files
├── tsconfig.json # TypeScript configuration
├── jest.config.js # Jest configuration
├── package.json # Project metadata and dependencies
└── README.md # Documentation
To run the tests:
npm test
To build the project:
npm run build
ISC
Chirag Singhal (@chirag127)