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

local-time-mcp-server

v1.0.5

Published

A local time MCP server written in Node.js. Provides current time, timezone time, time formatting, and time difference tools.

Readme

Local Time MCP Server (Node.js)

一个用于学习 MCP(Model Context Protocol)的入门级 Server,提供本地时间相关的工具。

npm version npm downloads license

📖 MCP 文档:


这个仓库是做什么的?

MCP(Model Context Protocol)是一种让 AI 助手调用外部工具的协议。本仓库从零实现了一个 Node.js 的 MCP Server,演示了完整的 "编写 → 发布到 npm → 配置到 AI 助手 → 实际使用" 流程,可作为学习和参考的范本。

它只提供 4 个时间相关工具:

| 工具 | 功能 | 示例调用 | |------|------|---------| | get_current_time | 获取当前时间(支持时区) | "现在几点?""东京现在几点?" | | format_time | 格式化指定时间点 | "把 2026-01-01 格式化一下" | | time_diff | 计算两个时间点的差值 | "距离春节还有多久?" | | list_timezones | 列出可用时区 | "有哪些亚洲时区?" |

已发布到 npm:local-time-mcp-server(需 Node.js 18+)。


怎么使用

方式一:配置到 AI 助手(WorkBuddy / CodeBuddy)—— 最推荐

编辑 MCP 配置文件 ~/.workbuddy/mcp.json(不存在则新建),通过 npx 一键运行,无需克隆仓库

{
  "mcpServers": {
    "local-time": {
      "type": "stdio",
      "command": "npx",
      "args": ["local-time-mcp-server@latest"]
    }
  }
}

配置完成后,在 AI 助手的连接器管理页面找到 local-time 并点击 Trust(信任),即可在对话中使用。

方式二:npx 一键运行(推荐,无需克隆仓库)

npx local-time-mcp-server@latest

或全局安装:

npm install -g local-time-mcp-server
local-time-mcp-server

安装之后local-time-mcp-server 是一个 stdio 类型的 MCP Server,直接运行时会挂起等待标准输入(它本身不提供交互界面)。它的作用是作为子进程被 AI 客户端启动,所以安装后下一步是把它配置到 AI 助手(见下方"方式一"),然后在对话中就能调用时间工具了。

试试看

在 AI 助手中直接问:

  • "现在本地几点了?"
  • "纽约现在几点?"
  • "距离 2026 年 12 月 31 日还有多少天?"
  • "列出所有亚洲时区"

发布到 npm

本仓库已配置 CI/CD 自动发布:打一个 v* 版本 tag 并推送,即自动测试、改版本号并发布到 npm。

git add . && git commit -m "改动" && git push
git tag v1.0.5 && git push origin v1.0.5

详细的发布步骤、2FA 处理、跨平台修复、CI/CD 配置等,见 mcp从零编写到发布上线.md


项目结构

local-time-mcp/
├── server.js               # MCP Server 主程序(npm bin 入口)
├── test_server.js          # 工具逻辑测试脚本
├── package.json            # 依赖与发布配置(bin/files/engines)
├── mcp_config_example.json # MCP 配置示例
├── .github/workflows/      # CI/CD(测试 + 自动发布)
├── docs/                   # MCP 概念与实战文档
├── .gitignore
└── README.md