Integrations
Supports publishing CO2 sensor data to MQTT brokers, including functionality to reconnect to MQTT services when needed.
Runs as a Node.js application providing device information, sensor data, and network status via JSON-RPC interface.
Connects to a Raspberry Pi Pico via USB to read real CO2 levels as an alternative to simulation mode.
MCP Server for sensor device
This project is a Node.js application designed for use with Claude Desktop. It simulates a CO2 sensor device and provides a JSON-RPC server to interact with the device. The application can run in both simulation mode and real mode, where it connects to a Raspberry Pi Pico via USB to read CO2 levels.
Features
- Simulates a CO2 sensor device with random CO2 levels in simulation mode.
- Connects to a Raspberry Pi Pico via USB to read real CO2 levels.
- Provides device information, sensor data, and network status via JSON-RPC.
- Supports commands to publish data to MQTT, reconnect WiFi, and reconnect MQTT (some functionalities are mocked).
Installation
You need to have Node.js installed on your machine to run this application. If you don't have Node.js installed, you can download it from the official website.
- Clone the repository.
- Install the dependencies using npm:Copy
Configuration
Ensure that the claude_desktop_config.json
file is correctly configured to run the server. Example configuration:
Usage
To start the server, run the following command:
JSON-RPC Methods
initialize
Initializes the server and returns server capabilities.
shutdown
Shuts down the server.
resources/list
Lists available resources.
resources/read
Reads the specified resource.
tools/list
Lists available tools.
tools/call
Calls the specified tool.
DeviceState Class
The DeviceState
class simulates the device state and provides methods to get device information, sensor data, and network status. It also handles the connection to the Raspberry Pi Pico and reads CO2 levels.
Methods
getDeviceInfo()
: Returns device information.getSensorData()
: Returns sensor data.getNetworkStatus()
: Returns network status (mocked functionality).publishToMQTT()
: Simulates publishing data to MQTT (mocked functionality).reconnectWiFi()
: Simulates reconnecting to WiFi (mocked functionality).reconnectMQTT()
: Simulates reconnecting to MQTT (mocked functionality).
Logging
The application logs CO2 levels and other information to a log file located in the user's home directory (co2_level.log
).
License
This project is licensed under the MIT License.
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.
A Node.js application that provides a JSON-RPC interface to interact with CO2 sensor data, working in both simulation mode and with real Raspberry Pi Pico hardware connections.
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 -29,124JavaScript
- -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