センサーデバイス用MCPサーバー
このプロジェクトは、Claude Desktop で使用するために設計された Node.js アプリケーションです。CO2 センサーデバイスをシミュレートし、デバイスとやり取りするための JSON-RPC サーバーを提供します。このアプリケーションは、シミュレーションモードとリアルモードの両方で実行でき、リアルモードでは USB 経由で Raspberry Pi Pico に接続して CO2 レベルを読み取ります。
特徴
- シミュレーション モードでランダムな CO2 レベルを持つ CO2 センサー デバイスをシミュレートします。
- USB 経由で Raspberry Pi Pico に接続し、実際の CO2 レベルを読み取ります。
- 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への接続を処理し、CO2レベルを読み取ります。
方法
getDeviceInfo()
: デバイス情報を返します。getSensorData()
: センサー データを返します。getNetworkStatus()
: ネットワークステータスを返します (モック機能)。publishToMQTT()
: MQTT へのデータの公開をシミュレートします (モック機能)。reconnectWiFi()
: WiFi への再接続をシミュレートします (モック機能)。reconnectMQTT()
: MQTT への再接続をシミュレートします (モック機能)。
ログ記録
アプリケーションは、CO2 レベルやその他の情報をユーザーのホーム ディレクトリにあるログ ファイル ( 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.
シミュレーション モードと実際の Raspberry Pi Pico ハードウェア接続の両方で動作し、CO2 センサー データと対話するための JSON-RPC インターフェイスを提供する Node.js アプリケーションです。
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 -4JavaScriptMIT License
- -securityAlicense-qualityA powerful and flexible Node.js Express server that provides a comprehensive interface to the CoinGecko cryptocurrency data API. This server supports both the free public API and the Pro API with automatic fallback.Last updated -4JavaScriptMIT License
- -securityAlicense-qualityA Node.js Express server that provides access to CoinGecko's cryptocurrency data through a comprehensive API interface, supporting both free and Pro APIs with automatic fallback functionality.Last updated -1JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to perform real-time carbon emissions calculations and provide climate impact insights by interfacing with the Climatiq API.Last updated -105PythonMIT License