传感器设备的 MCP 服务器
该项目是一个 Node.js 应用程序,专为 Claude Desktop 设计。它模拟了一个二氧化碳传感器设备,并提供一个 JSON-RPC 服务器与该设备交互。该应用程序可以在模拟模式和真实模式下运行,在真实模式下,它通过 USB 连接到 Raspberry Pi Pico 来读取二氧化碳浓度。
特征
- 在模拟模式下模拟具有随机二氧化碳水平的二氧化碳传感器设备。
- 通过 USB 连接到 Raspberry Pi Pico 以读取真实的二氧化碳水平。
- 通过 JSON-RPC 提供设备信息、传感器数据和网络状态。
- 支持发布数据到MQTT、重新连接WiFi、重新连接MQTT的命令(部分功能模拟)。
安装
您需要在计算机上安装 Node.js 才能运行此应用程序。如果您尚未安装 Node.js,可以从官方网站下载。
- 克隆存储库。
- 使用 npm 安装依赖项:
配置
确保正确配置claude_desktop_config.json
文件以运行服务器。示例配置:
用法
要启动服务器,请运行以下命令:
JSON-RPC 方法
initialize
初始化服务器并返回服务器功能。
shutdown
关闭服务器。
resources/list
列出可用资源。
resources/read
读取指定的资源。
tools/list
列出可用的工具。
tools/call
调用指定的工具。
DeviceState 类
DeviceState
类模拟设备状态,并提供获取设备信息、传感器数据和网络状态的方法。它还负责处理与 Raspberry Pi Pico 的连接并读取二氧化碳浓度。
方法
getDeviceInfo()
:返回设备信息。getSensorData()
:返回传感器数据。getNetworkStatus()
:返回网络状态(模拟功能)。publishToMQTT()
:模拟将数据发布到 MQTT(模拟功能)。reconnectWiFi()
:模拟重新连接到 WiFi(模拟功能)。reconnectMQTT()
:模拟重新连接到 MQTT(模拟功能)。
日志记录
该应用程序将二氧化碳水平和其他信息记录到位于用户主目录 ( co2_level.log
) 中的日志文件中。
执照
该项目已获得 MIT 许可。
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
一个 Node.js 应用程序,它提供了一个 JSON-RPC 接口来与 CO2 传感器数据交互,可以在模拟模式下和真实的 Raspberry Pi Pico 硬件连接下工作。
Related MCP Servers
- -securityAlicense-qualityA beginner-friendly MCP-inspired JSON-RPC server built with Node.js, offering basic client-server interaction through an 'initialize' capabilities handshake and an 'echo' function.Last updated -3JavaScriptMIT License
- AsecurityFlicenseAqualityA Node.js server that provides advanced video and image processing capabilities through the Model Context Protocol, enabling operations like conversion, compression, editing, and effects application.Last updated -1013JavaScript
- -securityFlicense-qualityNode.js server implementing Model Context Protocol for filesystem operations, allowing Claude to read, write, and manipulate files and directories in specified locations.Last updated -37,693JavaScript
- -securityFlicense-qualityA Node.js application that provides a Model Context Protocol server for interacting with Harbor container registry, supporting operations for projects, repositories, tags, and Helm charts.Last updated -TypeScript