Skip to content

Time server fails under EDT timezone #786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jamesfalkner opened this issue Mar 10, 2025 · 11 comments
Open

Time server fails under EDT timezone #786

jamesfalkner opened this issue Mar 10, 2025 · 11 comments
Labels
bug Something isn't working server-time Reference implementation for the Time MCP server - src/time

Comments

@jamesfalkner
Copy link

jamesfalkner commented Mar 10, 2025

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.

@jamesfalkner jamesfalkner added the bug Something isn't working label Mar 10, 2025
@mor10
Copy link

mor10 commented Mar 14, 2025

Same happens for PDT

@Wsgamer7
Copy link

same error in CST

@Roalkege
Copy link

Same for zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Mitteleuropäische Zeit'

@stronkfinkle
Copy link

& BST

@zstbee
Copy link

zstbee commented Apr 1, 2025

same error in CST
i have try to re-edit th settings developer config as this :
command:
python3
arguments:
-m mcp_server_time --local-timezone "Etc/GMT-1"

is still not work

@xpire
Copy link

xpire commented Apr 3, 2025

Same issue with AEDT

@MovGP0
Copy link

MovGP0 commented Apr 9, 2025

I have the same issue (in CEST: W. Europe Summer Time; Windows 11):

uvx mcp-server-time
Installed 23 packages in 316ms
Traceback (most recent call last):
  File "~\AppData\Local\Programs\Python\Python311\Lib\zoneinfo\_common.py", line 12, in load_tzdata
    return resources.files(package_name).joinpath(resource_name).open("rb")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\AppData\Local\Programs\Python\Python311\Lib\pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Johann.Dirry\\AppData\\Local\\uv\\cache\\archive-v0\\hjDT43lT6gZ4WHUVnywKc\\Lib\\site-packages\\tzdata\\zoneinfo\\W. Europe Summer Time'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~\AppData\Local\uv\cache\archive-v0\hjDT43lT6gZ4WHUVnywKc\Scripts\mcp-server-time.exe\__main__.py", line 10, in <module>
  File "~\AppData\Local\uv\cache\archive-v0\hjDT43lT6gZ4WHUVnywKc\Lib\site-packages\mcp_server_time\__init__.py", line 15, in main
    asyncio.run(serve(args.local_timezone))
  File "~\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "~\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "~\AppData\Local\uv\cache\archive-v0\hjDT43lT6gZ4WHUVnywKc\Lib\site-packages\mcp_server_time\server.py", line 119, in serve
    local_tz = str(get_local_tz(local_timezone))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\AppData\Local\uv\cache\archive-v0\hjDT43lT6gZ4WHUVnywKc\Lib\site-packages\mcp_server_time\server.py", line 45, in get_local_tz
    return ZoneInfo(str(tzinfo))
           ^^^^^^^^^^^^^^^^^^^^^
  File "~\AppData\Local\Programs\Python\Python311\Lib\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 W. Europe Summer Time'

@bsdayo
Copy link

bsdayo commented Apr 14, 2025

Same issue with China Standard Time.

ZoneInfoNotFoundError: 'No time zone found with key China Standard Time'

@danilop
Copy link

danilop commented Apr 18, 2025

I gave a look at the code. It seems you need to use a valid IANA timezone name. For example, the correct timezone for British Summer Time (BST) would be 'Europe/London'. This works for me:

mcp_server_time --local-timezone "Europe/London"

@MovGP0
Copy link

MovGP0 commented Apr 21, 2025

It seems you need to use a valid IANA timezone name.

If no parameter is set, the current user system setting should be used.

@Muhammad-Hazimi-Yusri
Copy link

to add in to answer from @danilop,

this config works for me:

    "time": {
      "command": "uvx",
      "args": [
        "mcp-server-time",
        "--local-timezone",
        "Europe/London"
      ]
    }

@olaservo olaservo added the server-time Reference implementation for the Time MCP server - src/time label May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server-time Reference implementation for the Time MCP server - src/time
Projects
None yet
Development

No branches or pull requests