Skip to main content
Glama
MCP Lampadina

MCP Lampadina

by Walt7

๐Ÿ”Œ MCP Lampadina

Un progetto dimostrativo che implementa una lampadina virtuale controllabile tramite Model Context Protocol (MCP) per integrazione con Claude Code.

๐Ÿš€ Disponibile in due implementazioni complete:

  • Node.js - Versione originale con Express e Socket.IO

  • .NET - Versione moderna con ASP.NET Core e SignalR

โœจ Caratteristiche

  • ๐ŸŒ Interfaccia Web: Interfaccia grafica reattiva per controllare la lampadina

  • ๐ŸŽจ Controllo Colore: Cambia il colore della lampadina con picker o preset

  • ๐Ÿ’ก Controllo Luminositร : Regola l'intensitร  luminosa da 0 a 100%

  • ๐Ÿ”„ Aggiornamenti Real-time: WebSocket per sincronizzazione live

  • ๐Ÿค– Integrazione MCP: Server MCP per controllo tramite Claude Code

  • ๐Ÿ“ก API REST: Endpoint per integrazioni esterne

Related MCP server: LUZMCP

๐Ÿš€ Installazione

Versione Node.js

# Clona il repository
git clone <url-repository>
cd mcp-lampadina

# Installa le dipendenze
npm install

Versione .NET

# Vai nella cartella .NET
cd MCP-Lampadina-NET/McpLampada

# Ripristina le dipendenze (automatico)
dotnet restore

๐ŸŽฎ Utilizzo

1. Avvia il Server Web

Node.js

npm start

La lampadina sarร  disponibile su:

.NET

dotnet run

La lampadina sarร  disponibile su:

2. Configurazione MCP per Claude Code

Opzione A: Configurazione locale (stdio)

Aggiungi questa configurazione al tuo claude_desktop_config.json:

{
  "mcpServers": {
    "lampadina": {
      "command": "node",
      "args": ["C:\\path\\to\\mcp-lampadina\\mcp-server.js"],
      "cwd": "C:\\path\\to\\mcp-lampadina"
    }
  }
}

Opzione B: Configurazione HTTP con claude mcp add

Node.js:

# Prima avvia entrambi i server
npm run all

# Poi usa il comando claude mcp add
claude mcp add lampadina --transport http http://localhost:3001/mcp

.NET:

# Prima avvia il server .NET
cd MCP-Lampadina-NET/McpLampada
dotnet run

# Poi usa il comando claude mcp add
claude mcp add lampadina-net --transport http http://localhost:5000/mcp

3. Usa Claude Code per Controllare la Lampadina

Ora puoi usare comandi come:

  • "Accendi la lampadina"

  • "Cambia il colore a rosso"

  • "Regola la luminositร  al 50%"

  • "Applica il preset blu"

  • "Mostrami lo stato della lampadina"

๐Ÿ› ๏ธ API Endpoints

GET /api/lampadina

Ottiene lo stato attuale della lampadina.

{
  "success": true,
  "data": {
    "accesa": true,
    "colore": "#ff0000",
    "luminosita": 75
  }
}

POST /api/lampadina/toggle

Accende o spegne la lampadina.

POST /api/lampadina/colore

{
  "colore": "#00ff00"
}

POST /api/lampadina/luminosita

{
  "luminosita": 80
}

๐Ÿค– Strumenti MCP Disponibili

Strumento

Descrizione

lampadina_stato

Ottiene lo stato attuale

lampadina_toggle

Accende/spegne

lampadina_colore

Cambia colore (formato hex)

lampadina_luminosita

Regola luminositร  (0-100)

lampadina_preset

Applica preset colore

Preset Colori Disponibili

  • bianco (#ffffff)

  • rosso (#ff0000)

  • verde (#00ff00)

  • blu (#0000ff)

  • giallo (#ffff00)

  • magenta (#ff00ff)

  • ciano (#00ffff)

  • arancione (#ffa500)

๐Ÿ”ง Sviluppo

# Modalitร  sviluppo con hot reload
npm run dev

# Avvia solo il server MCP (stdio)
npm run mcp

# Avvia solo il server MCP HTTP
npm run mcp-http

# Avvia entrambi i server (web + MCP HTTP)
npm run all

๐Ÿ“ Struttura Progetto

Versione Node.js

mcp-lampadina/
โ”œโ”€โ”€ server.js              # Server web principale
โ”œโ”€โ”€ mcp-server.js          # Server MCP (stdio)
โ”œโ”€โ”€ mcp-http-server.js     # Server MCP HTTP
โ”œโ”€โ”€ package.json           # Configurazione Node.js
โ”œโ”€โ”€ public/                # File statici web
โ”‚   โ”œโ”€โ”€ index.html         # Interfaccia utente
โ”‚   โ””โ”€โ”€ script.js          # Logica frontend
โ”œโ”€โ”€ CLAUDE.md             # Configurazione Claude Code
โ””โ”€โ”€ README.md             # Documentazione

Versione .NET

MCP-Lampadina-NET/
โ””โ”€โ”€ McpLampada/
    โ”œโ”€โ”€ Controllers/       # API REST e MCP endpoints
    โ”œโ”€โ”€ Services/          # Business logic e MCP server
    โ”œโ”€โ”€ Models/            # Data models
    โ”œโ”€โ”€ Hubs/              # SignalR hubs
    โ”œโ”€โ”€ Program.cs         # Startup configuration
    โ”œโ”€โ”€ McpLampada.csproj  # Project configuration
    โ”œโ”€โ”€ CLAUDE.md          # Claude Code configuration
    โ””โ”€โ”€ README.md          # Documentation

๐Ÿค Come Funziona MCP

Il Model Context Protocol permette a Claude Code di interagire con applicazioni esterne. In questo progetto:

  1. Server MCP (mcp-server.js) espone strumenti per il controllo della lampadina

  2. Claude Code puรฒ invocare questi strumenti tramite comandi naturali

  3. Server Web gestisce lo stato e sincronizza l'interfaccia

  4. WebSocket mantiene aggiornati tutti i client in tempo reale

๐Ÿ“ Note Tecniche

Node.js

  • Node.js con Express per il server web

  • Socket.IO per comunicazione real-time

  • MCP SDK per integrazione con Claude Code

  • Vanilla JavaScript per il frontend (nessun framework)

.NET

  • ASP.NET Core per server web e API

  • SignalR per comunicazione real-time

  • System.Text.Json per serializzazione JSON

  • Minimal APIs per endpoint leggeri

๐Ÿ†š Confronto Implementazioni

Caratteristica

Node.js

.NET

Runtime

V8 Engine

.NET Runtime

Linguaggio

JavaScript

C#

Server Web

Express.js

ASP.NET Core

WebSocket

Socket.IO

SignalR

Porta Default

3000

5000

Hot Reload

nodemon

dotnet watch

Memoria

~50MB

~25MB

Avvio

~2s

~1s

Tipizzazione

Dinamica

Statica

Package Manager

npm

NuGet

๐ŸŽฏ Scopo del Progetto

Questo progetto serve come esempio pratico per comprendere:

  • Come implementare un server MCP

  • Integrazione tra Claude Code e applicazioni custom

  • Comunicazione real-time con WebSocket

  • Architettura di un'applicazione IoT simulata

Perfetto per sperimentare con il protocollo MCP e capire come estendere le capacitร  di Claude Code! ๐Ÿš€

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    Related MCP Connectors

    • Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.

      https://writingmate.ai/api/mcp
    • Lets your AI build and edit websites in Xodia, a visual website builder for real code (Vite, React, Tailwind CSS or plain HTML in your own git repo): read and write site files, create pages and CMS collections, run typecheck, design and link checks, take screenshots, manage forms and translations, and pick up change requests the user sends from the visual editor. Sign in once with your Xodia account (OAuth). Free plan, no card needed. Setup: https://xodia.ai/ai/mcp

      https://app.xodia.ai/mcp
    • Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.

      https://remote.exza.de/mcp
    • Kliv is an AI web-app builder. It hosts each app with its own database, edge functions, commerce and email. Connect Claude Code or Cursor to Kliv's MCP server, sign in with your Kliv account, and your AI tool can work on your apps with the same tools the Kliv builder uses. It can edit an app's files, change the database, write and run edge functions, set up products and subscriptions, and run your tests. Then it can build and publish the app. Other MCP clients connect the same way. Your AI tool runs on your own AI subscription, so this work doesn't use your Kliv usage. Kliv still hosts the app and everything behind it. Each person signs in as themselves and reaches only the apps they can edit. The account owner sees every connected tool and can remove one at any time. The address is https://mcp.kliv.dev/mcp for everyone. Sign-in is OAuth in your browser, with your Kliv account. There are no API keys. Setup guide: https://docs.kliv.dev/integrations/mcp

      https://mcp.kliv.dev/mcp

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server for controlling Elgato Key Lights. Enables turning lights on/off, adjusting brightness and color temperature, applying presets, and triggering effects via Claude.
      13
      Apache 2.0
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables remote monitoring and control of IoT lamps via MCP tools, allowing AI agents to query lamp status and toggle lights in real time.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables Claude Code to control a real browser for navigation, interaction, screenshots, accessibility snapshots, and automated end-to-end testing through MCP tools.
      106 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables Claude Code to control a real browser for navigation, interaction, screenshots, accessibility snapshots, network and console monitoring, and automated end-to-end testing through MCP tools.
      106 npm
      MIT