timezone-mcp

timezone-mcp

A local MCP server that converts timestamps between time zones using IANA time zone rules, exposing a single convert_time tool.

Category
访问服务器

README

timezone-mcp

timezone-mcp is a local MCP server that converts timestamps between time zones. It exposes one tool, convert_time.

The server uses IANA time zone rules, including daylight saving time at the specified instant. Configured and requested zones are omitted when they produce the same local clock time and UTC offset as the source. This removes redundant results for fixed-offset inputs and equivalent IANA names. It can also omit distinct zones when their results happen to agree at that instant.

Agents often get date boundaries wrong

As of mid-2026, general-purpose agents often answer time zone questions confidently but incorrectly. Errors are especially common around daylight saving transitions and conversions that cross a calendar date. timezone-mcp delegates the calculation to Python's IANA time zone database and returns the source, UTC, and converted dates explicitly.

Requirements

  • Python 3.11 or later
  • uv

Install

From a checkout of this repository, install the project:

uv sync --no-dev

Record the paths used by the MCP client examples:

export TIMEZONE_MCP_DIR="$(pwd)"
export TIMEZONE_MCP_UV="$(command -v uv)"
export TIMEZONE_MCP_ZONES=China,Eastern

Run the stdio server directly with:

uv run timezone-mcp

The process waits for MCP messages on standard input. An MCP client normally starts it for you.

Configuration

If no configuration is supplied, output includes China and U.S. Eastern unless one matches the source result.

Set TIMEZONE_MCP_ALWAYS_TIMEZONES to a comma-separated list or a JSON array:

export TIMEZONE_MCP_ALWAYS_TIMEZONES="China,Eastern"

The JSON value [] disables default output zones. An empty value is rejected.

For file-based configuration, save a JSON file such as /absolute/path/to/timezone-mcp.json:

{
  "always_timezones": ["China", "Eastern"]
}

Then set its path:

export TIMEZONE_MCP_CONFIG=/absolute/path/to/timezone-mcp.json

TIMEZONE_MCP_ALWAYS_TIMEZONES takes precedence when both variables are set.

Configured and requested zones are combined, and repeated normalized names are deduplicated. A result is omitted when its local clock time and UTC offset match the source at the specified instant. For example, a Los Angeles result is omitted for a Phoenix source when both are on UTC−07:00, even though their daylight saving rules differ.

MCP client setup

The examples below configure China and U.S. Eastern as the default output zones. Replace /absolute/path/to/uv and /absolute/path/to/timezone-mcp with the values printed by:

command -v uv
pwd

Claude Desktop

Open the local MCP configuration from Claude Desktop's developer settings. On macOS, the configuration file is ~/Library/Application Support/Claude/claude_desktop_config.json.

Add this entry under mcpServers:

{
  "timezone-mcp": {
    "command": "/absolute/path/to/uv",
    "args": [
      "--directory",
      "/absolute/path/to/timezone-mcp",
      "run",
      "--no-dev",
      "timezone-mcp"
    ],
    "env": {
      "TIMEZONE_MCP_ALWAYS_TIMEZONES": "China,Eastern"
    }
  }
}

Restart Claude Desktop after editing the configuration.

Claude Code

claude mcp add --scope user timezone-mcp \
  -e TIMEZONE_MCP_ALWAYS_TIMEZONES="$TIMEZONE_MCP_ZONES" \
  -- "$TIMEZONE_MCP_UV" \
  --directory "$TIMEZONE_MCP_DIR" \
  run --no-dev timezone-mcp

Codex

codex mcp add timezone-mcp \
  --env TIMEZONE_MCP_ALWAYS_TIMEZONES="$TIMEZONE_MCP_ZONES" \
  -- "$TIMEZONE_MCP_UV" \
  --directory "$TIMEZONE_MCP_DIR" \
  run --no-dev timezone-mcp

Tool arguments

  • time: An ISO-like timestamp with a clock time, such as 2026-07-16 09:30, 2026-07-16T09:30:00, or 2026-07-16T09:30:00-04:00. Date-only values are rejected.
  • source_timezone: The source time zone for a timestamp without a UTC offset. It accepts IANA names such as America/Los_Angeles and aliases such as china, eastern, pacific, and aoe. Omit this argument when time already contains an offset.
  • output_timezones: An optional list of additional output time zones or aliases.
  • fold: 0 selects the first occurrence of an ambiguous local time, and 1 selects the second occurrence during a fall daylight saving transition. The default is 0.

Local times that do not exist during a spring daylight saving transition are rejected.

Result

The result contains the resolved input, UTC time, configured zones, conversions, and date-boundary information. Selected fields from a China-to-Eastern conversion look like this:

{
  "utc": {
    "datetime": "2026-07-16T01:00:00+00:00"
  },
  "configured_timezones": [
    "Asia/Shanghai",
    "America/New_York"
  ],
  "conversions": [
    {
      "datetime": "2026-07-15T21:00:00-04:00",
      "timezone": "America/New_York",
      "abbreviation": "EDT",
      "requested_timezone": "America/New_York"
    }
  ],
  "date_boundary": {
    "source_date": "2026-07-16",
    "different_dates": ["America/New_York"]
  }
}

Each formatted timestamp also includes date, time, weekday, abbreviation, and utc_offset fields.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选