Skip to main content

A simple MCP server that provides current time functionality

Project description

Time Server MCP

A simple MCP (Model Control Protocol) server that provides current time functionality.

Overview

This package implements a lightweight MCP server that exposes a get_current_time tool which can return the current time in any specified timezone.

Installation

pip install time-server-mcp

Dependencies

  • pytz - For timezone handling
  • mcp - The Model Control Protocol framework

Usage

Starting the Server

You can start the server using the provided command-line script:

time-server

Using the Server

Once the server is running, you can interact with it using any MCP client.

Example: Getting Current Time

from mcp.client import Client

# Connect to the time server
client = Client(transport="streamable-http")

# Get current time in default timezone
result = client.get_current_time()
print(f"Current time: {result}")

# Get current time in a specific timezone
result = client.get_current_time(timezone="Asia/Shanghai")
print(f"Current time in Shanghai: {result}")

Available Tools

get_current_time(timezone=None)

Returns the current time in the specified timezone.

  • timezone (optional): A timezone string (e.g., "Asia/Shanghai", "America/New_York")
  • Returns: A formatted time string ("YYYY-MM-DD HH:MM:SS.SSSSSS TIMEZONE")

License

MIT License

Contributing

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

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

time_server_mcp_yolan11-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

time_server_mcp_yolan11-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file time_server_mcp_yolan11-0.1.0.tar.gz.

File metadata

  • Download URL: time_server_mcp_yolan11-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.0 Windows/10

File hashes

Hashes for time_server_mcp_yolan11-0.1.0.tar.gz
Algorithm Hash digest
SHA256 82d4e9c17fc335f5b137c3bab09004cfca358c247c4b4692d7867e7831e6a3f5
MD5 bb480b55da5a1ac08e8de0f01a75ed75
BLAKE2b-256 2ef53439426e23a85e3c5e1b15ea768704aea8f7b109b165d59c6171fd45edee

See more details on using hashes here.

File details

Details for the file time_server_mcp_yolan11-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for time_server_mcp_yolan11-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8aa8a4664d3fd1fa6073df9e695ba996e02b6caea1e0285700d610768ca5464b
MD5 486f0d26bfaad342b4bf86f8b6df04dd
BLAKE2b-256 b93c267adb68cb7d4a66758eba4e733aa5780a81e8010a88c43b992f809fda35

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