iot-mcp-server

jayaprakash-optisol/iot-mcp-server

3.2

If you are the rightful owner of iot-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

An MCP (Model Context Protocol) server designed for IoT device communication using UDP messaging.

Tools
  1. send-device-info

    Sends device information to IoT server.

IoT MCP Server

An MCP (Model Context Protocol) server for IoT device communication with UDP messaging capabilities.

Project Structure

iot-mcp-server/
ā”œā”€ā”€ server/                 # MCP Server implementation
│   ā”œā”€ā”€ src/
│   │   ā”œā”€ā”€ index.ts       # Main MCP server
│   │   └── service.ts     # Device communication service
│   ā”œā”€ā”€ dist/              # Compiled JavaScript
│   └── package.json
└── node-udp-simulator/    # UDP server simulator
    ā”œā”€ā”€ udpServer.ts       # UDP echo server
    └── package.json

Features

  • MCP Server: Implements Model Context Protocol for AI assistant integration
  • Device Communication: Sends device information via UDP messaging
  • UDP Simulator: Echo server for testing device communication
  • TypeScript: Full TypeScript implementation with type safety

Components

MCP Server (/server)

The main MCP server that provides tools for IoT device interaction:

  • Tool: send-device-info - Sends device information to IoT server
  • Transport: STDIO transport for MCP communication
  • Device Data: Sends JSON payload with deviceId, deviceName, and deviceType

UDP Simulator (/node-udp-simulator)

A UDP echo server for testing device communication:

  • Port: 41234
  • Protocol: UDP IPv4
  • Function: Echoes received messages back to sender

Setup

Prerequisites

  • Node.js
  • pnpm (for server)
  • ts-node

Installation

  1. Server Setup:
cd server
pnpm install
  1. UDP Simulator Setup:
cd node-udp-simulator
npm install

Usage

Start UDP Simulator

cd node-udp-simulator
npm start

Run MCP Server (Development)

cd server
pnpm dev

Build & Run MCP Server (Production)

cd server
pnpm build
pnpm start

Device Communication

The MCP server sends device information as JSON:

{
  "deviceId": "1234567890",
  "deviceName": "Device 1",
  "deviceType": "Device Type 1"
}

MCP Integration

This server can be integrated with MCP-compatible AI assistants. The server provides:

  • Server Name: IoT-Server
  • Version: 1.0.0
  • Available Tools: send-device-info

Cursor Integration

MCP Configuration

Add to your Cursor settings (.cursor/mcp.json):

Production:

{
  "mcp.servers": {
    "iot-server": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/your/iot-mcp-server/server"
    }
  }
}

Development:

{
  "mcp.servers": {
    "iot-server": {
      "command": "pnpm",
      "args": ["dev"],
      "cwd": "/path/to/your/iot-mcp-server/server"
    }
  }
}

Usage in Cursor

Once configured, use in Cursor chat:

@iot-server send device info

Or simply:

can you send device info

Setup checklist:

  1. Build the server: cd server && pnpm build
  2. Start UDP simulator: cd node-udp-simulator && npm start
  3. Update cwd path to your project location
  4. Restart Cursor after configuration

Development

  • TypeScript Configuration: Both projects use TypeScript with proper tsconfig
  • Hot Reload: Use pnpm dev for development with ts-node
  • Build Process: TypeScript compilation to dist/ directory