Integrates with GitHub for version control, release management, and hosting the repository, with support for automated releases through personal access tokens.
Includes automated NPM publishing workflow via GitHub Actions that triggers on new tags to build the project and publish it to NPM.
Provides a Model Context Protocol server implementation in Node.js for retrieving current date and time in various formats with timezone support and custom formatting options.
Provides packaging and distribution through NPM, enabling installation via the npx command with configurable environment variables for customizing date/time output.
Implements a Model Context Protocol server in TypeScript that demonstrates how to build MCP servers using the TypeScript SDK, with tools for date and time operations.
DateTime MCP Server
A Model Context Protocol (MCP) server that provides tools to get the current date and time in various formats. This is a TypeScript implementation of the datetime MCP server, demonstrating how to build MCP servers using the TypeScript SDK.
Features
- Get current date and time in multiple formats (ISO, Unix timestamp, human-readable, etc.)
- Configurable output format via environment variables
- Timezone support
- Custom date format support
- Simple tool:
get_current_time
Usage
Choose one of these examples based on your needs:
Basic usage (ISO format):
Human-readable format with timezone:
Unix timestamp format:
Custom format:
Configuration
The server can be configured using environment variables:
DATETIME_FORMAT
Controls the default output format of the datetime (default: "iso")
Supported formats:
iso
: ISO 8601 format (2024-01-01T12:00:00.000Z)unix
: Unix timestamp in secondsunix_ms
: Unix timestamp in millisecondshuman
: Human-readable format (Mon, Jan 1, 2024 12:00:00 PM)date
: Date only (2024-01-01)time
: Time only (12:00:00)custom
: Custom format using DATE_FORMAT_STRING environment variable
DATE_FORMAT_STRING
Custom date format string (only used when DATETIME_FORMAT="custom") Default: "YYYY-MM-DD HH"
Supported tokens:
YYYY
: 4-digit yearYY
: 2-digit yearMM
: 2-digit monthDD
: 2-digit dayHH
: 2-digit hour (24-hour)mm
: 2-digit minutess
: 2-digit second
TIMEZONE
Timezone to use (default: system timezone) Examples: "UTC", "America/New_York", "Asia/Tokyo"
Available Tools
get_current_time
Get the current date and time
Parameters:
format
(optional): Output format, overrides DATETIME_FORMAT env vartimezone
(optional): Timezone to use, overrides TIMEZONE env var
Development
- Clone this repository
- Install dependencies
- Build the project
- Test with MCP Inspector (optional)
Publishing to NPM
This project includes automated NPM publishing via GitHub Actions. To set up publishing:
1. Create NPM Access Token
- Log in to NPM (create account if needed)
- Create Access Token
- Go to https://www.npmjs.com/settings/tokens
- Click "Generate New Token"
- Select "Automation" (for CI/CD usage)
- Choose "Publish" permission level
- Copy the generated token (starts with
npm_
)
2. Add Token to GitHub Repository
- Navigate to Repository Settings
- Go to your GitHub repository
- Click "Settings" tab
- Go to "Secrets and variables" → "Actions"
- Add NPM Token
- Click "New repository secret"
- Name:
NPM_TOKEN
- Value: Paste your NPM token from step 1
- Click "Add secret"
3. Setup GitHub Personal Access Token (for release script)
The release script needs to push to GitHub, so you'll need a GitHub token:
- Create GitHub Personal Access Token
- Go to https://github.com/settings/tokens
- Click "Generate new token" → "Generate new token (classic)"
- Set expiration (recommended: 90 days or custom)
- Select scopes:
- ✅
repo
(Full control of private repositories)
- ✅
- Click "Generate token"
- Copy the generated token (starts with
ghp_
)
- Configure Git with Token
4. Release New Version
Use the included release script to automatically version, tag, and trigger publishing:
5. Verify Publication
- Check GitHub Actions
- Go to "Actions" tab in your repository
- Verify the "Publish to npm" workflow completed successfully
- Verify NPM Package
- Visit: https://www.npmjs.com/package/@takanarishimbo/datetime-mcp-server
- Or run:
npm view @takanarishimbo/datetime-mcp-server
Release Process Flow
release.sh
script updates version in all files- Creates git commit and tag
- Pushes to GitHub
- GitHub Actions workflow triggers on new tag
- Workflow builds project and publishes to NPM
- Package becomes available globally via
npm install
Creating Desktop Extension (DXT)
Desktop Extensions (.dxt) enable one-click installation of MCP servers in Claude Desktop. To create a DXT file for this server:
1. Initialize DXT Manifest
Run this command in the project root directory:
This will guide you through creating a manifest.json
file. Here are the answers for this project:
2. Create DXT Package
This creates a .dxt
file that users can install in Claude Desktop with a single click.
Project Structure
License
MIT
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Model Context Protocol server that provides tools to get the current date and time in various formats, supporting different timezones and custom formatting options.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that provides time and timezone conversion capabilities, enabling LLMs to get current time information and perform timezone conversions using IANA timezone names.Last updated -21Python
- AsecurityAlicenseAqualityA Model Context Protocol server for time manipulation tasks, enabling AI models to get the current date/time and calculate duration between timestamps.Last updated -2TypeScriptMIT License
- -securityFlicense-qualityA simple Model Context Protocol (MCP) server that provides date and time functionality in any timezone, along with user profiles and personalized greeting resources.Last updated -Python
- AsecurityFlicenseAqualityA Model Context Protocol server that provides time and timezone conversion capabilities, enabling LLMs to get current time information and perform timezone conversions using IANA timezone names.Last updated -2Python