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

hotel-iot-mock

v1.0.1

Published

Hotel IoT Mock Server based on MCP Framework

Readme

Hotel IoT Mock Server

一个基于 Model Context Protocol (MCP) 框架的酒店 IoT 设备模拟服务器。该服务器模拟各种酒店设备,并为 AI 智能体提供 MCP 工具来控制和查询设备状态。

功能特性

  • 模拟 5 种酒店设备:
    • 空调 (air conditioner)
    • 灯 (light)
    • 窗帘 (curtain)
    • 电视 (TV)
    • 门锁 (door lock)
  • 提供两个 MCP 工具:
    • control_device:控制酒店 IoT 设备(开关、设置空调温度)
    • query_device_status:查询酒店 IoT 设备状态
  • 简单易用的模拟环境,用于测试 AI 智能体

安装

npm install hotel-iot-mock

使用方法

作为 CLI 工具使用

npx hotel-iot-mock [port]

默认端口为 3000,您可以指定自定义端口:

npx hotel-iot-mock 3001

作为模块使用

import { MCPServer } from 'hotel-iot-mock';

const server = new MCPServer({
  name: "hotel-iot-mock",
  version: "1.0.1"
});

server.start();

MCP 服务配置

您可以使用以下配置文件来启动服务:

{
  "mcpServers": {
    "hotel-iot-mock": {
      "command": "npx",
      "args": [
        "-y",
        "hotel-iot-mock",
        "${port}"
      ],
      "env": {
        "NODE_ENV": "production"
      },
      "cwd": ".",
      "description": "酒店 IoT MCP 服务"
    }
  }
}

将此配置保存为 mcp.config.json 文件,然后使用支持 MCP 配置的工具加载。

故障排除

如果您在使用阿里云百炼平台时遇到以下错误:

获取工具异常,请确认MCP是否正常运行
错误码:11200001

请检查以下几点:

  1. 确保您的 MCP 服务已正确启动并监听指定端口
  2. 确保防火墙或网络安全组允许相应端口的访问
  3. 确保 MCP 服务能够正常响应 HTTP 请求
  4. 检查服务日志确认没有错误信息

您可以通过以下方式测试服务是否正常运行:

# 启动服务
npx hotel-iot-mock 3001

# 在另一个终端中测试
curl http://localhost:3001/mcp

MCP 工具

control_device

控制酒店 IoT 设备。

参数:

  • deviceType:设备类型(air_conditioner, light, curtain, tv, door_lock)
  • action:操作类型(turn_on, turn_off, 仅空调支持 set_temperature)
  • temperature:温度值(仅空调需要,范围 16-30)

query_device_status

查询酒店 IoT 设备状态。

参数:

  • deviceType:设备类型(可选,如果不提供则查询所有设备)

设备假设

  • 每种设备类型只有一个设备实例
  • 只有空调需要具体的温度值
  • 其他设备只需要开关操作

环境要求

  • Node.js >= 18.19.0

许可证

MIT