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

@vkse/stdio-mcp-skill

v1.0.1

Published

A stdio-based MCP server providing time query tool for AI clients

Downloads

14

Readme

stdio-mcp-skill

一个基于 Model Context Protocol (MCP)Stdio 传输模式 示例服务器,使用 Node.js 实现。该服务器对外暴露 get_current_time 工具,供 AI 客户端(如 Claude Desktop、Cursor 等)在对话中获取服务器当前时间。

项目结构

stdio-mcp-skill/
├── index.js          # 服务器入口,定义工具清单与调用逻辑
├── package.json      # 项目依赖与脚本配置
└── README.md

核心依赖

| 依赖 | 版本 | 说明 | |------|------|------| | @modelcontextprotocol/sdk | ^1.28.0 | MCP 官方 SDK,提供 Server、Transport、Schema 等核心能力 |

工具列表

get_current_time

获取服务器当前的精确时间。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | timezone | string | 否 | 时区标识,例如 Asia/ShanghaiUTC。未传则返回服务器本地时间 |

返回示例:

当前时间是: 2026/3/27 03:30:00

快速开始

1. 安装依赖

cd stdio-mcp-skill
npm install

2. 运行服务

node index.js

服务启动后通过 标准输入/输出 (stdio) 进行 JSON-RPC 通信,不会监听任何端口。

⚠️ 注意: Stdio 模式下,服务器中 禁止 使用 console.log() 输出普通日志,否则会破坏 JSON-RPC 通信。调试日志请使用 console.error(),输出到 stderr。

测试方法

方式一:使用 MCP Inspector 测试

MCP Inspector 是官方提供的可视化调试工具:

npx -y @modelcontextprotocol/inspector node index.js

启动后在浏览器中打开 Inspector 界面,可以:

  • 查看工具清单(List Tools)
  • 手动调用 get_current_time 工具并查看返回结果
  • 调试 JSON-RPC 消息收发

方式二:通过命令行手动测试

直接在终端中与服务进行 JSON-RPC 通信:

# 启动服务并发送 initialize 请求
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | node index.js

方式三:配置到 AI 客户端中测试

在支持 MCP 的 AI 客户端(如 Claude Desktop、Cursor、Cline 等)中添加如下配置:

{
  "mcpServers": {
    "my-custom-mcp-server": {
      "command": "node",
      "args": ["<绝对路径>/stdio-mcp-skill/index.js"]
    }
  }
}

配置完成后,在对话中询问"现在几点?"等时间相关问题,AI 将自动调用 get_current_time 工具。

使用方法

作为 MCP 技能集成

  1. 将本项目作为 MCP 服务器接入 AI 客户端
  2. AI 根据对话上下文自动判断是否调用 get_current_time
  3. 工具返回结果后,AI 将时间信息整合到回答中

扩展新工具

index.js 中按以下模式添加新工具:

① 在 ListToolsRequestSchema 处理器中注册工具描述:

{
  name: "your_tool_name",
  description: "工具描述(写给 AI 看,决定调用时机)",
  inputSchema: {
    type: "object",
    properties: {
      param1: { type: "string", description: "参数说明" },
    },
    required: ["param1"],
  },
}

② 在 CallToolRequestSchema 处理器中实现工具逻辑:

if (request.params.name === "your_tool_name") {
  const { param1 } = request.params.arguments || {};
  // 执行业务逻辑...
  return {
    content: [{ type: "text", text: "返回结果" }],
  };
}

License

ISC