Skip to main content

MCP Time Server

A Model Context Protocol (MCP) time server that provides current time information. This server implements the MCP protocol and offers a tool to get the current time with optional timezone support.

Features

  • Provides current time information via MCP protocol
  • Supports optional timezone parameter
  • Easy to install and use
  • Lightweight implementation

Installation

You can install MCP Time Server using pip:

pip install mcp-time-server

Usage

Running the Server

To start the MCP Time Server, simply run:

python -m time_server

Or use the command-line entry point:

mcp-time-server

Using the Server

The server provides a tool called get_current_time that can be called via the MCP protocol.

Example using an MCP client:

import requests
import json

# Example using JSON-RPC over HTTP
url = "http://localhost:8000"

# Request without timezone
payload = {
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
        "name": "get_current_time",
        "arguments": {}
    },
    "id": 1
}

response = requests.post(url, json=payload)
print(response.json())

# Request with timezone
payload_with_tz = {
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
        "name": "get_current_time",
        "arguments": {
            "timezone": "Asia/Shanghai"
        }
    },
    "id": 1
}

response = requests.post(url, json=payload_with_tz)
print(response.json())

API Reference

get_current_time(timezone: Optional[str] = None)

Get the current time.

  • Parameters:

    • timezone (Optional[str]): Timezone string (e.g., "Asia/Shanghai", "America/New_York"). If not provided, uses system default timezone.
  • Returns:

    • Formatted time string in the format: "YYYY-MM-DD HH:MM:SS.SSSSSS TIMEZONE"
  • Example:

    • get_current_time() → "2023-06-15 14:30:45.123456 UTC"
    • get_current_time("Asia/Shanghai") → "2023-06-15 22:30:45.123456 CST"

Configuration

The server can be configured using command-line arguments or environment variables. Refer to the documentation for more details.

Requirements

  • Python 3.7+
  • pytz
  • fastmcp

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for cuc-mcp-time-server 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuc-mcp-time-server 0.1.0
File Size Uploaded Provenance
cuc_mcp_time_server-0.1.0.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cuc-mcp-time-server 0.1.0
File Interpreter ABI Platform
cuc_mcp_time_server-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / cuc_mcp_time_server-0.1.0.tar.gz

Download URL cuc_mcp_time_server-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6d9efade869c17012a793c857010bb84ec13cfc86d2e8cbca3160f576c34ad73
BLAKE2b-256 checksum
How to use checksums
739007443670226e3f9b593e30eb75540a3c6ec7180ee6520a96528f2007adb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.5 Windows/11

Release files / cuc_mcp_time_server-0.1.0-py3-none-any.whl

Download URL cuc_mcp_time_server-0.1.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e1d46cb6582ca5470ad1bf3d7864b62be7e9dc1e4b493e1f44c49271b7e5044
BLAKE2b-256 checksum
How to use checksums
9a0252fe09b0b2bfdf42d083e2825b650a2afe9ebdecdeb631c96d28151be7fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.5 Windows/11

Security for cuc-mcp-time-server 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page