Skip to main content
Glama

MCPCurrentTime

by mattjwarren
MIT License

MCPCurrentTime

A python Model Context Protocol (MCP) server that provides a simple and reliable way to get the current time in any timezone with customizable formatting.

Overview

MCPCurrentTime is an MCP server that wraps a time utility tool, allowing AI assistants and other MCP clients to retrieve the current time in various timezones and formats. This is particularly useful for applications that need timezone-aware time information or want to display time in user-friendly formats.

The server is based on the python mcp package.

Features

  • Timezone Support: Get current time in any timezone supported by the pytz library
  • Flexible Formatting: Customize time output using Python's strftime directives
  • Error Handling: Robust error handling for invalid timezones and format strings
  • Simple Integration: Easy to integrate with any MCP-compatible application

Installation

Prerequisites

  • Python 3.7+
  • Required packages:
    • mcp
    • pytz
  • install with

pip install MCPCurrentTime

Usage

Running the Server

You can run the MCP server in several ways:

Command Line, with stdio transport
python MCPCurrentTime.py
As a Module
from MCPCurrentTime import MCPCurrentTime server = MCPCurrentTime() server.run_server()
Custom Transport
from MCPCurrentTime import MCPCurrentTime server = MCPCurrentTime() # Run with custom MCP arguments server.run_server({"transport": "stdio"})

Tool Usage

The server provides a single tool called get_time with the following parameters:

Parameters
  • time_format (optional, default: "%Y%m%d%H%M%S"): The format string for time output
  • timezone (optional, default: "UTC"): The timezone to get the current time for
Time Format Examples

The time_format parameter uses Python's strftime directives:

  • "%Y-%m-%d %H:%M:%S""2025-06-30 14:30:45"
  • "%Y%m%d%H%M%S""20250630143045" (default)
  • "%B %d, %Y at %I:%M %p""June 30, 2025 at 02:30 PM"
  • "%A, %B %d, %Y""Monday, June 30, 2025"
Timezone Examples

The timezone parameter accepts any timezone from the pytz library:

  • "UTC" (default)
  • "America/New_York"
  • "Europe/London"
  • "Asia/Tokyo"
  • "Australia/Sydney"
  • "America/Los_Angeles"
Example Calls
# Get current time in default format and UTC await get_time() # Returns: "20250630-143045" # Get current time in New York with custom format await get_time(time_format="%Y-%m-%d %H:%M:%S", timezone="America/New_York") # Returns: "2025-06-30 10:30:45" # Get current date only in Tokyo await get_time(time_format="%Y-%m-%d", timezone="Asia/Tokyo") # Returns: "2025-06-30"

AI Assistant Integration

A tool for AI assistants that need to:

  • Schedule appointments and events
  • Provide time-aware responses
  • Generate timestamps for logs or documents
  • Real-time clock functionality
  • Time-based file naming
  • Log generation with timezone awareness
  • Batch processing with time tracking
  • ...

License

This project is open source. Please refer to the LICENSE file for details.

-
security - not tested
A
license - permissive license
-
quality - not tested

A Model Context Protocol server that provides the current time in any timezone with customizable formatting, allowing AI assistants to access accurate time information.

  1. Overview
    1. Features
      1. Installation
        1. Prerequisites
      2. Usage
        1. Running the Server
        2. Tool Usage
        3. AI Assistant Integration
      3. License

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A TypeScript server implementing the Model Context Protocol (MCP) that provides datetime and timezone information to AI agents and chat interfaces, allowing them to access current time in various timezones.
          Last updated -
          4
          2
          TypeScript
          Mozilla Public License 2.0
        • A
          security
          F
          license
          A
          quality
          A 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 -
          2
          1
          Python
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server for time manipulation tasks, enabling AI models to get the current date/time and calculate duration between timestamps.
          Last updated -
          2
          TypeScript
          MIT License
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that integrates with TickTick task management service, allowing AI assistants to list, create, update, and complete tasks with proper timezone handling.
          Last updated -
          1
          JavaScript
          MIT License
          • Apple

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/mattjwarren/MCPCurrentTime'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server