Metadata-Version: 2.4
Name: mcp-time-servercuclsy
Version: 0.1.0
Summary: A simple MCP (Model Context Protocol) Server that provides a tool to get the current time with optional timezone support.
Author-email: Your Name <your.email@example.com>
License: MIT License
        
        Copyright (c) 2026 Your Name
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp
Requires-Dist: pytz
Dynamic: license-file

# 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

```bash
pip install mcp-time-server
```

## Usage

1. Run the server:

```bash
mcp-time-server
```

2. 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:
```json
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "callTool",
  "params": {
    "toolCall": {
      "name": "get_current_time",
      "arguments": {}
    }
  }
}
```

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

### Example Responses

#### Without timezone:
```json
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "toolResult": {
      "content": "2024-01-30T12:34:56.789012"
    }
  }
}
```

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

#### Error response (unknown timezone):
```json
{
  "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.
