servers icon indicating copy to clipboard operation
servers copied to clipboard

fix: resolve ZoneInfo error by using IANA-compliant local timezone

Open sleeper opened this issue 6 months ago • 2 comments

Replaced local timezone detection using tzinfo string (e.g. "CEST") with tzlocal.get_localzone_name() to ensure a valid IANA time zone (e.g. "Europe/Paris") is passed to ZoneInfo. This avoids runtime errors on macOS and other systems that return non-IANA tz abbreviations.

Description

Server Details

  • Server: time
  • Changes to: code

Motivation and Context

The mcp_time_server was not able to determine the local timezone on MacOS.

How Has This Been Tested?

I was able to run the server on MacOS.

Breaking Changes

No.

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation update

Checklist

  • [x] I have read the MCP Protocol Documentation
  • [x] My changes follows MCP security best practices
  • [x] I have updated the server's README accordingly
  • [x] I have tested this with an LLM client
  • [x] My code follows the repository's style guidelines
  • [x] New and existing tests pass locally
  • [x] I have added appropriate error handling
  • [x] I have documented all environment variables and configuration options

Additional context

sleeper avatar May 13 '25 16:05 sleeper

This should fix #1629 and #786

sleeper avatar May 13 '25 16:05 sleeper

I meet the same issue on linux. And this fix looks good to me. Could any committers merge this?

Vonfry avatar Jun 08 '25 05:06 Vonfry

Thanks for merging!

sleeper avatar Jun 25 '25 09:06 sleeper