MCP Server for sensor device

MCP Server for sensor device

By kmwebnet GitHub

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.

sensor nodejs
Overview

What is MCP Server for Sensor Device?

MCP Server for Sensor Device is a Node.js application that simulates a CO2 sensor device and provides a JSON-RPC server for interaction. It can operate in both simulation mode and real mode, connecting to a Raspberry Pi Pico to read actual CO2 levels.

How to use MCP Server for Sensor Device?

To use the MCP Server, clone the repository, install the dependencies using npm, configure the claude_desktop_config.json file, and start the server with the command node index.js.

Key features of MCP Server for Sensor Device?

  • 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 and manage WiFi connections.

Use cases of MCP Server for Sensor Device?

  1. Monitoring indoor air quality by reading CO2 levels.
  2. Simulating sensor data for testing applications.
  3. Integrating with IoT systems for environmental monitoring.

FAQ from MCP Server for Sensor Device?

  • Can this server simulate multiple sensors?

Yes, it can simulate multiple CO2 sensors in simulation mode.

  • Is it necessary to have a Raspberry Pi Pico for real mode?

Yes, a Raspberry Pi Pico is required to read real CO2 levels in real mode.

  • How do I log CO2 levels?

The application logs CO2 levels to a file located in the user's home directory.

Content

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.

  1. Clone the repository.

  2. Install the dependencies using npm:

    npm install
    

Configuration

Ensure that the claude_desktop_config.json file is correctly configured to run the server. Example configuration:

{
  "mcpServers": {
    "CO2 sensor": {
      "command": "node",
      "args": [
        "...mcp-server-for-sensor-device/index.js"
      ],
      "env": {}
    }
  }
}

Usage

To start the server, run the following command:

node index.js

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.

No tools information available.
Ldoce MCP Server
Ldoce MCP Server by MCP-Mirror

Mirror of

mcp-server nodejs
View Details

-

mcp-node-server-template nodejs
View Details

The MCP Node DuckDuckGo Server is a modular Node.js application that allows developers to integrate and test DuckDuckGo search and web content fetching capabilities through a simple HTTP API. It uses Express to establish endpoints, axios to make outbound HTTP requests, and Cheerio for parsing HTML.

duckduckgo nodejs
View Details