Skip to main content

MCP Time Server

This is a simple MCP (Model Context Protocol) 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
  • Returns time in ISO 8601 format
  • Handles unknown timezone errors gracefully

Requirements

  • Python 3.7+
  • mcp Python SDK
  • pytz library (for timezone support)

Installation

pip install mcp-time-server

Usage

  1. Run the server:
mcp-time-server
  1. The server will start and listen for requests

Tool Usage

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

  • timezone (optional): A string representing the timezone (e.g., "Asia/Shanghai", "America/New_York")

Example Requests

Without timezone:

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "callTool",
  "params": {
    "toolCall": {
      "name": "get_current_time",
      "arguments": {}
    }
  }
}

With timezone:

{
  "jsonrpc": "2.0",
  "id": "2",
  "method": "callTool",
  "params": {
    "toolCall": {
      "name": "get_current_time",
      "arguments": {
        "timezone": "Asia/Shanghai"
      }
    }
  }
}

Example Responses

Without timezone:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "toolResult": {
      "content": "2024-01-30T12:34:56.789012"
    }
  }
}

With timezone:

{
  "jsonrpc": "2.0",
  "id": "2",
  "result": {
    "toolResult": {
      "content": "2024-01-30T20:34:56.789012+08:00"
    }
  }
}

Error response (unknown timezone):

{
  "jsonrpc": "2.0",
  "id": "3",
  "result": {
    "toolResult": {
      "content": "Error: Unknown timezone 'Invalid/Timezone'"
    }
  }
}

Configuration

The server runs with default configuration using the streamable-http transport, which is suitable for local development and testing.

For production deployment, you may want to configure additional options such as HTTP transport or authentication.

License

This project is licensed under the MIT License.

Metadata

Release files for mcp-time-servercuclsy 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 mcp-time-servercuclsy 0.1.0
File Size Uploaded Provenance
mcp_time_servercuclsy-0.1.0.tar.gz 4.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 9.7 kB

Release files / mcp_time_servercuclsy-0.1.0.tar.gz

Download URL mcp_time_servercuclsy-0.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8eeb7f85b94718d0e1344b67b7e065688e3240dd95f8d94002024bb0bbca6bbc
BLAKE2b-256 checksum
How to use checksums
e10b82c3aca9dccd6030cdf37d28b23ff0ebdcffaaf65265ffab618d4b4b9d38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.1 CPython/3.13.0 Windows/11

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

Download URL mcp_time_servercuclsy-0.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff1eaab8be310f649a3fe6850d0bc4ffaa4b8b1cb828c7a9909f4ac23b9d57f9
BLAKE2b-256 checksum
How to use checksums
bc1530b836ed9b394de0405dbdd7eaa154e5db1ef26da32dc02732d698e74904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.1 CPython/3.13.0 Windows/11

Security for mcp-time-servercuclsy 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