semvec/pypi-packages huggingface dataset:
gettime-mcp 0.1.0
A local MCP server that provides local time and timezone conversion tools.
Requires Python: >=3.13
Keywords: fastmcp, mcp, time, timezone

# gettime-mcp

A local FastMCP server (stdio) with two tools:

- `get_local_time`
- `convert_time_between_timezones`

## Requirements

- Python 3.13+
- `uv`

## Setup

```powershell
uv sync --all-groups
```

## Run

```powershell
uv run gettime-mcp
```

## Tools

### `get_local_time`

Input:
- none

Output JSON:
- `local_iso`: ISO 8601 local datetime with offset
- `weekday`: weekday name in current local timezone (`Monday` to `Sunday`)
- `timezone_name`: local timezone name
- `utc_offset`: `+HH:MM/-HH:MM`
- `unix_timestamp`: seconds timestamp

### `convert_time_between_timezones`

Input:
- `datetime_iso` (required): ISO 8601 datetime string (supports `Z`)
- `to_timezone` (required): IANA timezone name (for example `UTC`, `Asia/Shanghai`)
- `from_timezone` (optional): used only when `datetime_iso` has no offset

Output JSON:
- `input_datetime_iso`
- `source_timezone`
- `target_timezone`
- `converted_iso`
- `converted_unix_timestamp`

Error behavior:
- invalid timezone: `Invalid timezone: <name>`
- invalid datetime format: `Invalid datetime_iso format`
- if `datetime_iso` already has an offset, `from_timezone` is ignored

## Cursor / Cline (local MCP)

Add to your MCP config (path depends on your editor installation):

```json
{
  "mcpServers": {
    "gettime-local": {
      "command": "uv",
      "args": ["run", "gettime-mcp"],
      "cwd": "<ABSOLUTE_PROJECT_PATH>"
    }
  }
}
```

Example `cwd` on Windows: `D:\\path\\to\\gettime`

## Tests

```powershell
uv run pytest
```

## Publish To PyPI (safe)

Build and validate:

```powershell
uv build
uvx twine check dist/*
```

Publish with environment variable (do not paste token in files):

```powershell
$env:PYPI_TOKEN = "pypi-***"
uvx twine upload dist/* -u __token__ -p $env:PYPI_TOKEN
```

## Security Notes

- Never commit tokens, cookies, or API keys.
- Do not hardcode local absolute paths in public docs.
- If a token was exposed, revoke and rotate it immediately.