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-mcp-mock

v1.3.30

Published

Hotel MCP Mock Service for Bailian Platform

Readme

Hotel MCP Mock Service

酒店MCP Mock服务,使用装饰器实现,可通过npx方式部署到百炼平台。

功能特性

  • 入住信息查询
  • 洗衣房查询
  • 早餐下单
  • 客房服务请求
  • 会员信息查询
  • IOT设备控制(灯光、空调、窗帘、电视、门锁等)
  • 场景控制(欢迎客人、睡眠模式、观影时间等)
  • 场景配置管理
  • 叫醒服务设置
  • 续住服务
  • 退房服务
  • 起床服务

安装依赖

npm install

使用方式

本地运行

# 使用stdio传输(适用于本地测试)
npm start

# 使用HTTP传输(适用于Postman测试)
node index.js 3001

通过npx运行

npx hotel-mcp-mock

百炼平台部署

在百炼平台部署时,使用以下配置文件:

  1. 工具配置: bailian-mcp-config.json
  2. 服务器配置: bailian-mcp-server-config.json

在阿里云百炼平台使用

本npm包已发布到官方npm平台,可以直接在阿里云百炼平台中使用:

  1. 登录阿里云百炼平台
  2. 创建自定义MCP服务
  3. 使用以下配置:
    • 服务名称:hotel-mcp-mock
    • 运行命令:npx
    • 参数:-y hotel-mcp-mock ${port}
    • 环境变量:NODE_ENV=production

重要说明:百炼平台需要MCP服务支持HTTP传输方式,因此参数中必须包含 ${port} 变量,服务会根据该端口启动HTTP服务器。

项目结构

hotel-mcp-mock/
├── index.js              # 入口文件
├── package.json          # 项目配置
├── README.md             # 说明文档
├── bailian-mcp-config.json     # 百炼平台工具配置
├── bailian-mcp-server-config.json  # 百炼平台服务器配置
├── scene-config.json     # 场景配置文件(可选,用于自定义场景配置)
└── mcp/
    └── mock.js           # MCP Mock服务实现

实现说明

mock.js使用@modelcontextprotocol/sdk实现MCP工具:

  1. 使用McpServer类创建MCP服务器
  2. 通过registerTool方法注册每个工具
  3. 实现了多个酒店服务Mock方法,包括:
    • 基础酒店服务(入住信息查询、洗衣房查询等)
    • IOT设备控制服务(灯光、空调、窗帘、电视、门锁等)
    • 场景控制服务(欢迎客人、睡眠模式、观影时间等)
  4. 所有方法都包含日志输出和模拟数据返回

服务支持两种传输方式:

  • stdio传输:适用于本地测试和直接运行
  • HTTP传输:适用于百炼平台部署,通过端口参数启动

场景配置

场景控制功能需要通过scene-config.json文件自定义场景配置。与之前的版本不同,现在必须提供scene-config.json文件并包含相应的场景配置,否则场景控制将无法工作。

场景配置文件格式如下:

{
  "scene_name": {
    "name": "场景显示名称",
    "devices": [
      {"deviceType": "设备类型", "action": "操作", "value": 可选值}
    ]
  }
}

依赖说明

版本历史

  • 1.3.2: 增加Docker配置支持
  • 1.3.1: 删除不必要的simple-http-mock文件和test文件
  • 1.2.28: 修复阿里云函数环境中的日志输出问题,将日志输出到stderr以避免干扰JSON响应
  • 1.2.27: 修复阿里云函数环境中的日志输出问题,确保只返回纯JSON响应
  • 1.2.26: 移除winston日志依赖,改为使用标准console.log()以兼容阿里云函数环境
  • 1.2.25: 修复云函数环境中的日志输出问题,避免干扰JSON响应
  • 1.2.24: 删除旧的 wake_up 工具,只保留 set_wake_up 工具
  • 1.2.23: 修改 wake_up 工具名称为 set_wake_up,使其更加准确
  • 1.2.22: 修改起床服务工具,不再执行设备操作
  • 1.2.21: 添加起床服务工具
  • 1.2.20: 修改会员信息查询工具入参为 roomId,返回包含早餐权益
  • 1.2.19: 删除积分查询工具
  • 1.2.18: 添加退房服务工具
  • 1.2.17: 添加续住服务工具
  • 1.2.16: 添加叫醒服务工具
  • 1.2.15: 修改商城订单工具为早餐下单工具
  • 1.2.14: 修改送饮品后端接口请求体格式
  • 1.2.13: 调用 checkin_info 工具时调用电视内容展示接口
  • 1.2.12: 修改设备控制后端接口请求体格式
  • 1.2.11: 实现设备控制时保存用户偏好设置
  • 1.2.10: checkin_info 增加是否首次入驻判断,非首次从 preference.json 获取用户偏好
  • 1.1.14: 修改checkin_info工具返回字段,将roomNumber改为roomId,统一房间号命名
  • 1.1.13: 修改checkin_info工具的入参从memberId为roomId
  • 1.1.12: 修复scene-config.json文件路径问题,支持云函数环境部署
  • 1.1.11: 修改场景控制逻辑,只读取scene-config.json中的配置,不再使用硬编码的默认配置
  • 1.1.10: 增加scene-config.json文件,用于自定义场景配置
  • 1.1.9: 删除健康数据上传功能,增加IOT设备控制工具和场景控制工具
  • 1.1.8: 优化MCP工具输入参数定义,使用zod库增强类型验证和参数描述
  • 1.1.7: 移除设备控制功能,该功能已迁移到独立的IOT MCP服务
  • 1.1.6: 修复Zod模式问题,优化服务稳定性
  • 1.1.5: 恢复HTTP传输支持,修复百炼平台部署问题
  • 1.1.4: 简化项目结构,移除云函数相关代码
  • 1.1.3: 简化项目结构,移除云函数相关代码,优化百炼平台部署配置
  • 1.1.2: 优化npm包结构,移除不必要的部署文件
  • 1.1.1: 发布到npm官方平台,支持阿里云百炼直接使用
  • 1.1.0: 添加阿里云函数计算支持
  • 1.0.1: 修复百炼平台部署问题
  • 1.0.0: 初始版本