Skip to content

fix(time): expand LOCAL_TIMEZONE in Docker ENTRYPOINT - #4620

Open
ks72 wants to merge 1 commit into
modelcontextprotocol:mainfrom
ks72:fix/time-docker-local-timezone-expansion
Open

fix(time): expand LOCAL_TIMEZONE in Docker ENTRYPOINT#4620
ks72 wants to merge 1 commit into
modelcontextprotocol:mainfrom
ks72:fix/time-docker-local-timezone-expansion

Conversation

@ks72

@ks72 ks72 commented Aug 7, 2026

Copy link
Copy Markdown

Exec-form ENTRYPOINT doesn't invoke a shell, so ${LOCAL_TIMEZONE} was never expanded — mcp-server-time always received the literal string "${LOCAL_TIMEZONE}", which ZoneInfo() rejects. The container exits 1 on startup, whether or not -e LOCAL_TIMEZONE is set. The README's documented usage (-e LOCAL_TIMEZONE) has never worked since it was added in #640.

Verified against the published Dockerfile — same command, before and after:

$ docker run --rm -e LOCAL_TIMEZONE=Europe/Paris mcp/time
# before: ZoneInfoNotFoundError: 'No time zone found with key ${LOCAL_TIMEZONE}'  (exit 1)
# after:  starts normally                                                          (exit 0)

Fix: shell-form ENTRYPOINT so the variable expands. Kept exec so mcp-server-time still replaces the shell as PID 1 — signal handling (SIGTERM on container stop) behaves the same as exec form.

Exec-form ENTRYPOINT does not invoke a shell, so
"${LOCAL_TIMEZONE}" was never expanded — it reached
mcp-server-time as the literal string "${LOCAL_TIMEZONE}"
on every run, regardless of what -e LOCAL_TIMEZONE was set to.

That string is truthy, so get_local_tz() always took the
override branch and called ZoneInfo("${LOCAL_TIMEZONE}"),
which raises ZoneInfoNotFoundError. The container exits 1
on startup every time, whether or not the caller sets the
variable — the feature added in modelcontextprotocol#640 has never worked.

Verified against the published Dockerfile:

  # before, docker run --rm -e LOCAL_TIMEZONE=Europe/Paris mcp/time
  zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found
  with key ${LOCAL_TIMEZONE}'
  exit 1

  # after, identical command
  exit 0

Switched to shell-form ENTRYPOINT with `exec` so the variable
expands while mcp-server-time still replaces the shell as PID 1
(signals like SIGTERM still reach it directly, matching the
exec-form behavior everywhere else in this Dockerfile).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant