DateTime MCP Server
A Model Context Protocol (MCP) server that provides date and time utilities
Features
Get current date and time in user's timezone
Get day of the week for any date
Calculate difference between two dates
Installation
Clone or download this repository
Install dependencies:
Build the server:
Testing and Debugging
1. MCP Inspector (Recommended)
The easiest way to test your MCP server interactively:
This will open a web interface where you can:
See all available tools
Test the
datetime,day_of_week, anddate_difftoolsInspect requests and responses
2. VSCode Debugging
Use the built-in VSCode debugger with the provided launch configurations:
Press
F5or go to Run → Start DebuggingChoose "Debug MCP with Inspector" to debug with the web interface
Choose "Debug MCP Server" to debug the server directly
Set breakpoints in your code to step through execution
3. Manual Testing
Run the test script:
4. Development Mode
Build automatically on file changes:
In another terminal, run the inspector:
Common Issues
Exit Code 1: Make sure to run
npm run buildfirstPort in use: Close other inspector instances
Module errors: Verify
"type": "module"is in package.json
Configuration
Add the server to your MCP configuration:
For VSCode (Claude Dev Extension):
For Claude Desktop:
Usage
The server provides the following tools:
1. datetime
Get the current date and time in the user's local timezone.
Parameters: None
Example usage:
Example response:
2. day_of_week
Get the day of the week for a given date in English.
Parameters:
date(string, required): Date in ISO format (YYYY-MM-DD) or DD/MM/YYYY format
Example usage:
Example response:
3. date_diff
Calculate the difference between two dates. Returns days, weeks, months, and years.
Parameters:
start_date(string, required): Start date in ISO format (YYYY-MM-DD) or DD/MM/YYYY formatend_date(string, optional): End date in ISO format (YYYY-MM-DD) or DD/MM/YYYY format. If omitted, uses current date.
Example usage:
Example response:
Contributing
Feel free to submit issues and enhancement requests!