fix(time): expand LOCAL_TIMEZONE in Docker ENTRYPOINT - #4620
Open
ks72 wants to merge 1 commit into
Open
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exec-form
ENTRYPOINTdoesn't invoke a shell, so${LOCAL_TIMEZONE}was never expanded —mcp-server-timealways received the literal string"${LOCAL_TIMEZONE}", whichZoneInfo()rejects. The container exits 1 on startup, whether or not-e LOCAL_TIMEZONEis 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:
Fix: shell-form
ENTRYPOINTso the variable expands. Keptexecsomcp-server-timestill replaces the shell as PID 1 — signal handling (SIGTERM on container stop) behaves the same as exec form.