World time and timezone conversion for your agents and your own node.
This is the reference MCP time server, rebuilt as one static C99 binary with
the IANA tz database compiled into it. Three tools — get_current_time,
convert_time, get_time_ago — and the same three operations back a World
Clock, converter and time-ago panel inside SCORPIOX BOT. No account, no tzdata
package, no CDN, no network request of any kind.
make # native build -> ./plugin_time
make musl # static musl x86_64 -> ./plugin_time.musl
make arm64 # static aarch64 -> ./plugin_time.arm64
make win64 # MinGW-w64 static PE -> ./plugin_time.exe
make macos # Apple clang (on macOS) -> ./plugin_time
make tzdata # regenerate src/tzdata.h from the host tz database
make ui # regenerate src/ui_html.h from src/ui.html
make install # copy the binary into ~/.scorpiox/plugins (no restart needed)
make test # offline suite (204 assertions)
python3 tests/tz_diff.py # differential run against the host's own tz database
python3 tests/e2e.py # Playwright viewport suite (1440 / 1024 / 390, dark + light)
A timezone connector that reads the host's tz database answers differently on
every node: a Windows box has none at all, macOS's filesystem is case-insensitive
so europe/warsaw resolves while Linux refuses it, and a slim container may ship
an older tzdata release. Embedding the table makes the same call return the same
string on every platform — which is the whole point of a tool an agent reasons
about.
tools/gen_tzdata.py reads the compiled TZif files and emits src/tzdata.h:
for the zones that still generate them — so DST rules, Ramadan exceptions
(Africa/Casablanca) and redesigned rules (Asia/Hebron) are exact rather
than approximated;
transition, which is exactly what a host does when it runs out of table;
windowsZones.xml), so a Windows node reports New Zealand Standard Time as Pacific/Auckland instead of
guessing from an offset — plugin_time --win-tz "New Zealand Standard Time"
answers for a Windows box from any platform.
The Windows name comes from GetDynamicTimeZoneInformation().TimeZoneKeyName,
which is the invariant registry id. GetTimeZoneInformation().StandardName is
localised (Neuseeland Normalzeit on a German Windows) and matches no CLDR row,
so it is only a fallback.
Regeneration is deterministic: the same tz database produces the same bytes, and
tests/run.sh re-runs the generator and compares.
cp plugin_time ~/.scorpiox/plugins/plugin_time
chmod +x ~/.scorpiox/plugins/plugin_time
# or from the market
curl -s -H "X-Bot-Password: $BOT_PASSWORD" \
"http://127.0.0.1:8150/plugin_manage?action=install&slug=time&mode=prebuilt"
Windows: %LOCALAPPDATA%\scorpiox\plugins\plugin_time.exe.
BotCloud container: /workspace/.scorpiox/plugins/plugin_time.
| Mode | Trigger | Response |
|---|---|---|
| Discovery | --meta or SX_PLUGIN_META=1 | {"name":"time","desc":"World time MCP","kind":"mcp","mcp":true,"daemon":false,"menus":false,"verified":"live","category":"utilities","version":"1.0.2"} (unauthenticated) |
| MCP tool provider | --mcp | newline-delimited JSON-RPC 2.0 over stdio — initialize, tools/list, tools/call, ping |
| API | ?action=..., ?format=json, or any POST | application/json; charset=utf-8 |
| UI | plain GET (?embed=1 aware) | the World Clock page, text/html |
| Info | --version, --help, --schema, --win-tz <id> | id + version, usage, the tool schemas, a Windows id -> IANA key |
Modes 3 and 4 sit behind require_node_auth(): X-Bot-Password,
Authorization: Bearer <pwd>, or ?pwd=. With BOT_PASSWORD unset the check is
a no-op, which is the intended behaviour on a single-user box. --meta and
--mcp stay open — the node spawns the stdio server itself, so a CGI password
must not stop it, or the router could never reach an installed connector.
--mcp and not an MCP server entryplugin_time is a connector plugin, not a new MCP server. scorpiox-bot-api
keeps one lightweight stdio router (sx-connector-mcp) and this plugin is
discovered by scan, so installing it never consumes one of clang's 16 MCP
server slots and never adds 3 tools to every prompt. An agent reaches the tools
through connector_list / connector_tools / connector_call.
get_current_time{"timezone": "Pacific/Auckland"}
{
"timezone": "Pacific/Auckland",
"datetime": "2026-11-14T13:00:00+13:00",
"day_of_week": "Saturday",
"is_dst": true,
"utc_offset": "+13:00",
"abbreviation": "NZDT"
}
timezone is optional and defaults to the node's own zone, which the tool
description names so a model can default to it. utc_offset and abbreviation
are additions to the reference shape — a caller should not have to re-derive
either from the ISO string.
convert_time{"source_timezone": "Pacific/Auckland", "time": "09:00",
"target_timezone": "America/New_York"}
{
"source": {"timezone": "Pacific/Auckland", "datetime": "2026-11-14T09:00:00+13:00", "...": "..."},
"target": {"timezone": "America/New_York", "datetime": "2026-11-13T15:00:00-05:00", "...": "..."},
"time_difference": "-18.0h",
"later_occurrence": null
}
time must be exactly HH:MM, 24-hour. 9:00, 24:00, 12:60 and 12:30:00 are all refused with the reference server's own message.
`Invalid time: 01:30 does not exist in Europe/London on 2026-03-29 (skipped by
a clock change)` — never a silently shifted answer.
occurrence in source/target and puts the second under later_occurrence,
with its own note and time_difference. That is Python's fold=0/fold=1
behaviour, and it is the difference between "01:30" being one time and two.
time_difference is +3.0h for whole hours and +5.75h / +13.75h for thefractional zones (Kathmandu, Chatham).
get_time_ago{"timezone": "Europe/London", "hours_ago": 5}
The span is subtracted from the UTC instant, not the local wall clock, so
"5 hours ago" across a clock change is five real hours. Every component
(days_ago, hours_ago, minutes_ago, seconds_ago) defaults to 0 and must be
non-negative.
GET /plugin_time serves a bot-themed World Clock: a live clock in any zone, a
converter with both sides named, an editable world-clock table (persisted per
browser), a time-ago panel and the live tool list. Every value on the page comes
from a tool call, so a node whose system clock is off shows the tool's answer
rather than the browser's.
Dark and light come from the bot's own tokens and its localStorage.bot_theme
key; ?theme=light|dark and the {type:'sx-theme'} postMessage both work, and
?embed=1 hides the standalone chrome inside a bot modal. Zero <script src=>,
zero <link rel=stylesheet>, zero CDN — it renders offline and inside a strict
CSP.
| Action | Arguments | Result |
|---|---|---|
current (or now, or format=json) | timezone | the get_current_time object |
convert | source_timezone, time, target_timezone | the convert_time object |
ago | timezone, days_ago, hours_ago, minutes_ago, seconds_ago | the get_time_ago object |
zones | — | every embedded key, sorted, plus the node's local zone |
tools | — |