Time server fails under EDT timezone
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:
- Run
uvx mcp-server-timewhile 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.
Same happens for PDT
same error in CST
Same for zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Mitteleuropäische Zeit'
& BST
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
Same issue with AEDT
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'
Same issue with China Standard Time.
ZoneInfoNotFoundError: 'No time zone found with key China Standard Time'
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"
It seems you need to use a valid IANA timezone name.
If no parameter is set, the current user system setting should be used.
to add in to answer from @danilop,
this config works for me:
"time": {
"command": "uvx",
"args": [
"mcp-server-time",
"--local-timezone",
"Europe/London"
]
}
same for SE Asia Standard Time
same for India Standard Time (IST)
Duplicate of #489, merging this issue so we can address it there :)