npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

current-time-timezone-server

v1.1.12

Published

MCP服务器,提供NTP校准的当前时间和时区相关功能,支持stdio和HTTP/SSE,可配置host和protocol,支持.env文件,返回指定时区的本地时间

Readme

Current Time Timezone Server

A Model Context Protocol (MCP) server that provides accurate time information with timezone support and NTP synchronization.

Features

  • Accurate Time: NTP-synchronized time from configurable NTP servers
  • Timezone Support: Local time for any specified timezone
  • Unix Timestamp: Unix timestamp in seconds
  • Dual Protocol: Supports both Streamable HTTP and Server-Sent Events (SSE) protocols
  • Real-time Updates: SSE endpoint provides real-time time updates via streaming
  • Docker Ready: Complete Docker support with health checks

Installation

NPM

npm install -g current-time-timezone-server

Docker

# 直接运行
docker run -p 3000:3000 current-time-timezone-server:latest

# 使用docker-compose
docker-compose up -d

Usage

MCP Server Configuration

Streamable HTTP方式 (推荐)

{
  "mcpServers": {
    "current-time-http": {
      "protocol": "http",
      "url": "http://localhost:3000/mcp"
    }
  }
}

SSE方式

{
  "mcpServers": {
    "current-time-sse": {
      "protocol": "sse",
      "url": "http://localhost:3000/sse"
    }
  }
}

Docker方式

{
  "mcpServers": {
    "current-time": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-p", "3000:3000", "current-time-timezone-server:latest"]
    }
  }
}

Stdio方式

{
  "mcpServers": {
    "current-time": {
      "command": "npx",
      "args": ["current-time-timezone-server-stdio"],
      "env": {
        "NTP_SERVER": "pool.ntp.org"
      }
    }
  }
}

启动服务器

# 默认启动(同时支持Streamable HTTP和SSE)
npx current-time-timezone-server

# 自定义配置
HOST=0.0.0.0 PORT=8080 npx current-time-timezone-server

访问端点

服务器启动后,以下端点可用:

  • Streamable HTTP: POST http://localhost:3000/mcp
  • SSE: GET http://localhost:3000/sse
  • SSE消息: POST http://localhost:3000/messages

测试SSE连接

# 访问SSE端点
curl -N http://localhost:3000/sse

# 注意:SSE端点用于MCP客户端连接,不支持直接带时区参数

Stdio Server

npx current-time-timezone-server-stdio

Environment Variables

  • HOST: 服务器地址 (默认: localhost)
  • PORT: 服务器端口 (默认: 3000)
  • NTP_SERVER: NTP服务器地址 (默认: pool.ntp.org)

Docker Usage

构建镜像

docker build -t current-time-timezone-server .

运行容器

docker run -d \
  --name time-server \
  -p 3000:3000 \
  -e NTP_SERVER=pool.ntp.org \
  current-time-timezone-server:latest

使用docker-compose

docker-compose up -d

Development

# 安装依赖
npm install

# 开发模式
npm run dev

# 构建
npm run build

协议对比

| 协议 | 描述 | 使用场景 | 端点 | |---|---|---|---| | Streamable HTTP | MCP标准HTTP传输 | MCP客户端连接 | POST /mcp | | SSE | 服务器推送实时数据流 | MCP客户端连接 | GET /sse | | Stdio | 标准输入输出通信 | MCP客户端内部通信 | 无 |

端点说明

  • Streamable HTTP: 支持完整的MCP协议,包括工具调用
  • SSE: 提供实时连接,需要配合/messages端点使用
  • Stdio: 独立的可执行文件,用于标准输入输出通信