Skip to main content

An MCP Server that provides a tool to get the current time with optional timezone support

Project description

MCP Time Server

An MCP Server that provides a tool to get the current time with optional timezone support.

Features

  • Provides a get_current_time tool to retrieve the current time
  • Supports optional timezone parameter
  • Simple and lightweight implementation
  • Built using the Model Context Protocol (MCP)

Installation

pip install mcp-time-server

Usage

Running the Server

mcp-time-server

This will start the MCP Server using the STDIO transport, which is suitable for local process communication.

Using the get_current_time Tool

The server exposes a single tool called get_current_time that can be used by MCP clients.

Parameters

  • timezone (optional): A timezone string, e.g., "Asia/Shanghai", "America/New_York"
    • If not provided, the system's default timezone will be used

Return Value

A formatted string representing the current time in the format: YYYY-MM-DD HH:MM:SS.SSSSSS TIMEZONE

Examples

# Get current time in system default timezone
result = await mcp_client.call_tool("get_current_time")
# Example output: "2023-12-25 13:45:30.123456 EST"

# Get current time in a specific timezone
result = await mcp_client.call_tool("get_current_time", timezone="Asia/Shanghai")
# Example output: "2023-12-26 02:45:30.123456 CST"

Project Structure

mcp-time-server/
├── mcp_time_server/
│   ├── __init__.py      # Package initialization
│   └── main.py          # Main server implementation
├── pyproject.toml       # Project configuration
├── README.md            # This file
├── LICENSE              # License file
└── .gitignore           # Git ignore file

License

MIT License - see the LICENSE file for details.

About MCP

The Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems. For more information, visit modelcontextprotocol.io.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_cuc_tangxr-0.2.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_cuc_tangxr-0.2.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_cuc_tangxr-0.2.0.tar.gz.

File metadata

  • Download URL: mcp_cuc_tangxr-0.2.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11

File hashes

Hashes for mcp_cuc_tangxr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2b4fe6464c260b41aaba5039a60894575d759d2169e601a0925b92786bec3588
MD5 85f09c699a756c8c16a9e787a1c6fbcb
BLAKE2b-256 3e7b1f2e415222fa82d205ca7b84c500b6bf6a3b3b952d836257f27800b13784

See more details on using hashes here.

File details

Details for the file mcp_cuc_tangxr-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_cuc_tangxr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11

File hashes

Hashes for mcp_cuc_tangxr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ceac0279f05ff9cfbcc49b7c0799680f32253b59044b5b5e770c256e73b5e408
MD5 93bd3a986f06fdd72a06e5737cfe7b36
BLAKE2b-256 5e77447d1b4055da5f74a973433e10815f65824788dffc19b01002959e3b6a08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page