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 🙏

© 2026 – Pkg Stats / Ryan Hefner

yang-gettime

v1.0.0

Published

这是一个基于MCP SDK的时间服务,可以返回当前时间并支持通过环境变量进行配置。

Readme

GetTime MCP 服务

这是一个基于MCP SDK的时间服务,可以返回当前时间并支持通过环境变量进行配置。

功能

  • 提供当前时间信息
  • 支持通过环境变量自定义配置
  • 在响应中显示服务器配置信息

环境变量配置

服务支持以下环境变量:

| 环境变量 | 描述 | 默认值 | |---------|------|-------| | TIME_ZONE | 时区设置 | Asia/Shanghai | | SERVER_NAME | 服务器名称 | getTime | | SERVER_VERSION | 服务器版本 | 1.0.0 |

如何使用

构建项目

# 安装依赖
npm install

# 构建项目
npm run build

设置环境变量

在Linux/macOS上

# 设置环境变量
export TIME_ZONE="America/New_York"
export SERVER_NAME="customTimeServer"
export SERVER_VERSION="2.0.0"

# 运行服务
node dist/index.js

在Windows上

# 设置环境变量
set TIME_ZONE=America/New_York
set SERVER_NAME=customTimeServer
set SERVER_VERSION=2.0.0

# 运行服务
node dist/index.js

在单行命令中设置环境变量

# Linux/macOS
TIME_ZONE="America/New_York" SERVER_NAME="customTimeServer" SERVER_VERSION="2.0.0" node dist/index.js

# Windows (PowerShell)
$env:TIME_ZONE="America/New_York"; $env:SERVER_NAME="customTimeServer"; $env:SERVER_VERSION="2.0.0"; node dist/index.js

在MCP中使用

服务提供了一个名为get_tool的工具,可以通过MCP协议调用:

{
  "state": "任意状态信息"
}

响应示例:

{
  "content": [
    {
      "type": "text",
      "text": "当前时间: 2025/07/21 18:45:30, 传入参数: 任意状态信息"
    },
    {
      "type": "text",
      "text": "服务器配置 - 名称: customTimeServer, 版本: 2.0.0, 时区: America/New_York"
    }
  ]
}

常见时区列表

以下是一些常用的时区值:

  • Asia/Shanghai - 中国标准时间 (UTC+8)
  • America/New_York - 美国东部时间
  • America/Los_Angeles - 美国西部时间
  • Europe/London - 英国时间
  • Europe/Paris - 欧洲中部时间
  • Asia/Tokyo - 日本标准时间
  • Australia/Sydney - 澳大利亚东部时间
  • UTC - 协调世界时

注意事项

  • 如果环境变量未设置,将使用默认值
  • 时区必须是有效的IANA时区标识符
  • 服务启动时会在控制台输出当前使用的配置信息