servers
servers copied to clipboard
fix: resolve ZoneInfo error by using IANA-compliant local timezone
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
This should fix #1629 and #786
I meet the same issue on linux. And this fix looks good to me. Could any committers merge this?
Thanks for merging!