Skip to content

Time server fails under EDT timezone #786

Open
@jamesfalkner

Description

@jamesfalkner

Describe the bug
Running the Time server results in a failure due to local timezone moving to summer time ("EDT").

To Reproduce
Steps to reproduce the behavior:

  1. Run uvx mcp-server-time while you are in the US/Eastern and/or America/New_York timezone while summer time ("EDT") is active.

Expected behavior
A working MCP server for time regardless of current timezone

Logs
Here's what I get when I run it:

➜  research git:(main) ✗ uvx mcp-server-time
Traceback (most recent call last):
  File "/Users/jhf/.pyenv/versions/3.11.9/lib/python3.11/zoneinfo/_common.py", line 12, in load_tzdata
    return resources.files(package_name).joinpath(resource_name).open("rb")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jhf/.pyenv/versions/3.11.9/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jhf/.cache/uv/archive-v0/ZIoktJZ4w7sZkFWy-iTeK/lib/python3.11/site-packages/tzdata/zoneinfo/EDT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jhf/.cache/uv/archive-v0/ZIoktJZ4w7sZkFWy-iTeK/bin/mcp-server-time", line 12, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/jhf/.cache/uv/archive-v0/ZIoktJZ4w7sZkFWy-iTeK/lib/python3.11/site-packages/mcp_server_time/__init__.py", line 15, in main
    asyncio.run(serve(args.local_timezone))
  File "/Users/jhf/.pyenv/versions/3.11.9/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/jhf/.pyenv/versions/3.11.9/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jhf/.pyenv/versions/3.11.9/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/jhf/.cache/uv/archive-v0/ZIoktJZ4w7sZkFWy-iTeK/lib/python3.11/site-packages/mcp_server_time/server.py", line 119, in serve
    local_tz = str(get_local_tz(local_timezone))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jhf/.cache/uv/archive-v0/ZIoktJZ4w7sZkFWy-iTeK/lib/python3.11/site-packages/mcp_server_time/server.py", line 45, in get_local_tz
    return ZoneInfo(str(tzinfo))
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jhf/.pyenv/versions/3.11.9/lib/python3.11/zoneinfo/_common.py", line 24, in load_tzdata
    raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key EDT'

Additional context
This only started failing yesterday (the first day of daylight savings time in the US). Prior to this it was working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserver-timeReference implementation for the Time MCP server - src/time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions