Metadata-Version: 2.4
Name: mcp-time-server-hsy
Version: 0.1.0
Summary: An MCP Server that provides a tool to get the current time with an optional IANA timezone.
License: MIT
License-File: LICENSE
Author: hsy
Author-email: hsy@example.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: mcp (>=2.0.0)
Requires-Dist: tzdata ; sys_platform == "win32"
Description-Content-Type: text/markdown

# mcp-time-server-hsy

一个最小可用的 [MCP](https://modelcontextprotocol.io) Server，提供 `get_current_time` 工具，
支持可选的 IANA 时区参数。

## 安装

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

## 使用

默认以 streamable-http 传输启动（监听 http://127.0.0.1:8000/mcp）：

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

以 stdio 传输启动（供 Trae / Claude Desktop 等客户端以子进程方式拉起）：

```bash
# Linux / macOS
MCP_TRANSPORT=stdio mcp-time-server-hsy

# Windows PowerShell
$env:MCP_TRANSPORT="stdio"; mcp-time-server-hsy
```

## 工具

### `get_current_time(timezone: str | None = None) -> str`

返回当前时间，格式为 `YYYY-MM-DD HH:MM:SS.SSSSSS 时区名称`。

- `timezone` 省略时返回服务器本地时间
- 传入非法时区名时返回 `isError: true` 及可读的错误信息

示例返回：

```
2026-11-30 21:48:07.123456 CST
```

## 客户端配置示例

```json
{
  "mcpServers": {
    "time-server": {
      "command": "mcp-time-server-hsy",
      "env": { "MCP_TRANSPORT": "stdio" }
    }
  }
}
```

## License

MIT

