Skip to main content
Glama
DateTime MCP Server

DateTime MCP Server

by ryddle

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

Related MCP server: DateTime MCP Server

Installation

  1. Clone or download this repository

  2. Install dependencies:

npm install
  1. Build the server:

npm run build

Testing and Debugging

The easiest way to test your MCP server interactively:

npm run inspector

This will open a web interface where you can:

  • See all available tools

  • Test the datetime, day_of_week, and date_diff tools

  • Inspect requests and responses

2. VSCode Debugging

Use the built-in VSCode debugger with the provided launch configurations:

  • Press F5 or go to Run → Start Debugging

  • Choose "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:

node test-server.js

4. Development Mode

Build automatically on file changes:

npm run watch

In another terminal, run the inspector:

npm run inspector

Common Issues

  • Exit Code 1: Make sure to run npm run build first

  • Port 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):

{
  "mcpServers": {
    "datetime": {
      "command": "node",
      "args": ["/path/to/datetime-mcp/build/index.js"]
    }
  }
}

For Claude Desktop:

{
  "mcpServers": {
    "datetime": {
      "command": "node",
      "args": ["/path/to/datetime-mcp/build/index.js"]
    }
  }
}

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:

use_mcp_tool({
  server_name: "datetime",
  tool_name: "datetime",
})

Example response:

{
  "content": [
    {
      "type": "text",
      "text": "Fri Dec 13 2025 10:30:45 GMT-0500 (Eastern Standard Time)"
    }
  ]
}

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:

use_mcp_tool({
  server_name: "datetime",
  tool_name: "day_of_week",
  arguments: {
    date: "2026-01-05"  // or "5/1/2026"
  }
})

Example response:

{
  "content": [
    {
      "type": "text",
      "text": "Monday"
    }
  ]
}

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 format

  • end_date (string, optional): End date in ISO format (YYYY-MM-DD) or DD/MM/YYYY format. If omitted, uses current date.

Example usage:

use_mcp_tool({
  server_name: "datetime",
  tool_name: "date_diff",
  arguments: {
    start_date: "2025-01-01",
    end_date: "2026-01-01"
  }
})

Example response:

{
  "content": [
    {
      "type": "text",
      "text": "{\n  \"days\": 365,\n  \"weeks\": 52,\n  \"months\": 12,\n  \"years\": 1,\n  \"start_date\": \"2025-01-01\",\n  \"end_date\": \"2026-01-01\"\n}"
    }
  ]
}

Contributing

Feel free to submit issues and enhancement requests!

Available Tools

3 tools
date_diffA

Calculate the difference between two dates. Returns the difference in days, weeks, months, and years.

Inputs: start_date (required), end_date.

datetimeA

Get the current date and time in the user's local timezone.

Inputs: no named parameters.

day_of_weekA

Get the day of the week for a given date. Returns the day name in English (e.g., Monday, Tuesday, etc.).

Inputs: date (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool targets a clearly distinct operation: current datetime retrieval, weekday lookup for a date, and date difference calculation. There is no meaningful overlap that would cause misselection.

    Naming Consistency4/5

    All names are noun/entity-style rather than verb-first, which is consistent enough for a read-only utility server. Minor inconsistency: 'datetime' lacks a separator while the others use snake_case compounds.

    Tool Count5/5

    Three tools is well-scoped for a small date/time utility server, and each tool has a clear, non-redundant purpose.

    Completeness3/5

    The surface covers current time, weekday lookup, and date differences, but notable date/time operations such as date arithmetic (add/subtract), timezone conversion, and formatting/parsing are absent. These gaps could require agents to work around the server for common datetime tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Provides current time and date information with timezone support and multiple formatting options. Enables AI assistants to answer time-related queries in different timezones with detailed temporal information.
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides LLMs with current date and time information across any timezone, with configurable defaults and support for IANA timezone identifiers.
      1
      3
      Apache 2.0
    • A
      license
      A
      quality
      Not graded
      maintenance
      Provides AI assistants with real-time date, time, and timezone information, enabling them to access current temporal data, format dates, calculate day of week, and work with different timezones.
      4
      7 npm
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides tools to get the current date and time in various formats (ISO, Unix timestamp, human-readable, custom) with configurable timezone support.
      MIT