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

mcp-time-server

v1.0.1

Published

带有时区转换工具的MCP时间服务器

Downloads

87

Readme

MCP 时间服务器

npm版本 许可证

一个基于模型上下文协议(MCP)的时间服务器,提供时区相关工具。可以获取指定时区的当前时间以及在不同时区之间转换时间。

## 安装

您可以通过npm全局安装:

```bash
npm install -g mcp-time-server

或者直接通过npx使用:

npx -y mcp-time-server

功能

该MCP服务器提供以下工具:

1. 获取当前时间 (get_current_time)

获取指定时区的当前时间。如果不指定时区,默认为UTC。

参数:

  • timezone (可选): 时区名称,例如 "Asia/Tokyo"、"America/New_York" 等

返回:

  • 指定时区的当前日期和时间

2. 时区转换 (convert_time)

将一个时区的时间转换为另一个时区的时间。

参数:

  • source_timezone: 源时区名称
  • time: 要转换的时间,格式为 "HH:MM"
  • target_timezone: 目标时区名称

返回:

  • 目标时区的等效时间

使用方法

在MCP环境中使用

您可以通过以下方式直接启动MCP服务器:

{ "type": "stdio", "command": "npx", "args": ["-y", "mcp-time-server"] }

这将通过stdio启动MCP服务器,您可以使用MCP客户端与之通信。

作为命令行工具

npx mcp-time-server

作为库使用

import { McpTimeServer } from 'mcp-time-server';

async function example() {
  const server = new McpTimeServer();
  await server.init();
  
  // 使用server.server对象进行进一步操作
  // ...
}

示例

获取当前时间

{
  "name": "get_current_time",
  "params": {
    "timezone": "Asia/Shanghai"
  }
}

响应:

{
  "content": [
    {
      "type": "text",
      "text": "5/4/2025, 12:30:45 (Asia/Shanghai)"
    }
  ]
}

时区转换

{
  "name": "convert_time",
  "params": {
    "source_timezone": "Asia/Tokyo",
    "time": "15:30",
    "target_timezone": "America/Los_Angeles"
  }
}

响应:

{
  "content": [
    {
      "type": "text",
      "text": "15:30 在 Asia/Tokyo 相当于 23:30 在 America/Los_Angeles"
    }
  ]
}

许可证

MIT

贡献

欢迎提交问题和拉取请求!