Skip to main content
Glama
IoTaWatt MCP Server

IoTaWatt MCP Server

by 519Green

IoTaWatt MCP Server

A Model Context Protocol server for the IoTaWatt open-source energy monitor. It lets an MCP client such as Claude Code or Claude Desktop read live power, query the on-device history log, inspect the device configuration, and look at the shape of the current on a circuit.

All tools are read-only. The server talks to the IoTaWatt's local HTTP API and needs no cloud account.

This project is not affiliated with or endorsed by IoTaWatt, Inc.

Requirements

  • Node.js 18 or newer

  • An IoTaWatt reachable over HTTP from the machine running the server

Related MCP server: Network Monitor MCP Server

Install

git clone https://github.com/519Green/IotaWattMCP.git
cd IotaWattMCP
npm install

Configure

The device address is given with --host or the IOTAWATT_HOST environment variable. Use an IP address or hostname, for example 192.168.1.50 or iotawatt.local. A full URL such as https://iotawatt.example.net also works if the device sits behind a proxy.

Claude Code

Add to .mcp.json in your project, or to your user configuration:

{
  "mcpServers": {
    "iotawatt": {
      "command": "node",
      "args": ["/path/to/IotaWattMCP/index.js", "--host", "192.168.1.50"]
    }
  }
}

Claude Desktop

Add the same iotawatt block under mcpServers in claude_desktop_config.json.

Password-protected devices

If the IoTaWatt has passwords set, give the server one through the environment:

{
  "mcpServers": {
    "iotawatt": {
      "command": "node",
      "args": ["/path/to/IotaWattMCP/index.js", "--host", "192.168.1.50"],
      "env": { "IOTAWATT_PASSWORD": "your-admin-password" }
    }
  }
}
  • The account defaults to admin. Set IOTAWATT_USER to user to use the device's restricted account instead. That account can do everything except sample_waveform.

  • --user and --password flags also work, but command-line arguments are visible to other processes on the machine. Prefer the environment.

  • The device uses HTTP Digest authentication, so the password is not sent in the clear. The data itself still travels over plain HTTP.

Tools

Tool

What it does

discover

Lists input channels (CTs and VTs) and calculated outputs with their units. Call this first.

status

Device status: firmware version, uptime, Wi-Fi, per-input readings, and data log ranges.

get_config

Returns the device's config.txt: input definitions, calibration, and output scripts.

snapshot

Average power over the last 5 minutes for all outputs or for named channels.

query

Time-series query against the on-device log.

energy_by_interval

Energy in Wh per interval for all outputs or for named channels.

watch

Live readings once a second for up to two minutes, for catching something as it switches.

sample_waveform

One AC cycle of raw voltage and current from a CT, with harmonics, distortion and phase lag.

Query notes

query passes its arguments to the IoTaWatt query API.

  • select is a list of series. Put time.local.iso first to get timestamps.

  • Add a unit suffix to a channel name to change what is returned: .watts, .wh, .amps, .va, .var, .varh or .pf for power channels, .volts or .hz for voltage. Add .d2 for two decimal places.

  • begin and end accept relative times (d for today at midnight, s for now, d-7d, s-3600s) or absolute times such as 2026-02-17T06:00. Leave the seconds off absolute times.

  • group is the aggregation interval. Seconds must be a multiple of 5 (5s, 10s, 30s); then 1m, 1h, 1d and so on, or all for one row.

  • The device returns at most 1,000 rows unless you pass limit. When a result is cut short, the tool adds a note saying where the data stops.

  • Results come back one row per line. format: "csv" is the more compact of the two.

Waveform notes

sample_waveform describes the shape of the current, which says what kind of load is running:

  • A heater or kettle draws a clean sine wave in step with the voltage: low distortion, crest factor near 1.4, lag near zero.

  • A motor or compressor lags the voltage.

  • Electronics draw a narrow, peaky current: high crest factor and a large 3rd harmonic.

The numbers are raw ADC counts, not amps, and the capture is everything on that CT at that instant, not a single appliance. Compare a capture with the appliance on against one with it off.

Example prompts

Once the server is connected, ask in plain language. The assistant picks the tools. It helps to tell it what you already know, for example which appliances are on which circuit.

Getting oriented

  • "What channels does my IoTaWatt have, and what does each one measure?"

  • "Is the device healthy? Check the firmware version, uptime, Wi-Fi signal and how far back the logs go."

  • "What is the house drawing right now, by circuit?"

Energy use

  • "How many kWh did each circuit use yesterday? Rank them."

  • "Show hourly energy for the water heater over the last 7 days. When does it run most?"

  • "Compare this week with last week, circuit by circuit."

  • "What is my always-on load? Find the quietest hour of the past week and break it down by circuit."

Finding appliances

  • "Did the dryer run today? Look for a 240 V load of about 5 kW that cycles on and off."

  • "Find the fridge's defrost cycles on the kitchen circuit over the last 3 days. How often do they happen and how long do they last?"

  • "Something drew about 1.5 kW for a few minutes around 3 pm. Which circuit was it on, and does the power factor look like a heater or a motor?"

  • "How many times did the well pump run today, and how long was each run?"

  • "Watch all circuits for the next 60 seconds. I am going to switch the space heater on, then off. Tell me which circuit it is on and how much it draws."

  • "Sample the waveform on the office circuit. Is that load mostly electronics, motors or heating?"

Checking the installation

  • "Compare each subpanel's total against the mains that feed it. Do any CTs look reversed, mislabelled or on the wrong leg?"

  • "Read my output formulas. Does anything get counted twice or left out?"

Tips

  • For short events, ask for fine resolution over a short window, such as 5 second data for one hour. The device keeps 5 second data for about a year and 1 minute data for longer.

  • A 240 V appliance shows up on two CTs at once, one per leg. A 120 V appliance shows up on one.

  • Ask for a summary, not the raw rows. Long, fine-grained queries return a lot of data.

Things to know

  • get_config returns the whole config file. If you have uploaders configured (InfluxDB, Emoncms, PVoutput), that file can contain their URLs and credentials, and they will be passed to the MCP client.

  • Queries pause sampling. The IoTaWatt documentation notes that the device does not sample power while it is answering a query. Prefer a few well-scoped queries over many large ones. watch is light by comparison: one small request a second.

  • Channel names are cached. Call discover after changing inputs or outputs on the device.

  • Password support is tested against a mock, built from the IoTaWatt firmware source, not against a real password-protected unit. Please open an issue if it fails on yours.

Development

npm test

The tests start the server over stdio against a small mock IoTaWatt in test/mock-iotawatt.js, so they need no device.

License

ISC. See LICENSE.

Available Tools

8 tools
discoverA
Read-only

List all IoTaWatt inputs (physical CTs/VTs) and calculated outputs with their units. Always call this first to learn what channels are available before querying.

Inputs: no named parameters.

energy_by_intervalB
Read-only

Energy consumption (Wh) broken down by interval for all or selected output channels. Use for today's hourly breakdown, daily totals, etc.

Inputs: end, begin, group, channels.

get_configB
Read-only

Get the full IoTaWatt device configuration from /config.txt: input channel definitions (names, CT models, calibration factors) and output scripts showing how calculated values are derived.

Inputs: no named parameters.

queryA
Read-only

Flexible IoTaWatt time-series query against the on-device log. Use discover first to know valid channel names. Results come back one row per line. The device stops sampling while it answers, so prefer a few well-scoped queries.

Inputs: select (required), end, begin, group, +3 more.

sample_waveformA
Read-only

Capture one AC cycle of raw voltage and current samples (about 640 pairs) from a single CT input and describe the shape of the current: crest factor, 3rd/5th/7th harmonics, distortion and phase lag. This shows what kind of load is on the circuit right now: a heater draws a clean sine in phase with voltage, a motor lags, electronics draw a peaky current rich in harmonics. It is a snapshot of everything on that CT, not of one appliance. Values are raw ADC counts, not amps or volts, and have no CT/VT phase correction, so angles are approximate. Needs the admin user on a password-protected device.

Inputs: channel (required), include_samples.

snapshotA
Read-only

Latest instantaneous power: a single averaged value over the last 5 minutes. Defaults to all discovered output channels. Optionally restrict to specific channels.

Inputs: channels.

statusA
Read-only

IoTaWatt device status: firmware version, uptime, WiFi SSID/RSSI/IP, heap memory, AC frequency, and data log ranges.

Inputs: no named parameters.

watchA
Read-only

Live view at 1 second resolution, finer than the stored log. Polls the device once a second for the given number of seconds and returns one CSV row per second with the watts on each input (volts for a voltage input). Use it to catch an appliance being switched on or off right now. The call takes as long as the duration asked for.

Inputs: pf, seconds, channels.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct access mode or temporal resolution: device status, channel discovery, configuration, instantaneous snapshot, flexible historical query, aggregated energy, live 1-second polling, and raw waveform capture. Although all are read operations, the scopes are clearly differentiated in the descriptions.

    Naming Consistency3/5

    Mixed conventions are present: single-word nouns/verbs (status, discover, snapshot, query, watch) alongside verb_noun (get_config, sample_waveform) and noun_prep_noun (energy_by_interval). All names are lowercase snake_case and readable, but there is no single predictable pattern.

    Tool Count5/5

    Eight tools is well-scoped for an IoTaWatt device monitoring server. Each tool covers a distinct access pattern—status/config discovery, historical query, aggregated energy, live monitoring, and waveform analysis—with no obvious filler.

    Completeness4/5

    The surface covers device status, channel discovery, configuration read, raw and aggregated historical queries, live monitoring, and detailed waveform analysis, which is strong for a monitoring-oriented server. Minor gap: there are no tools to modify configuration, reboot the device, or manage firmware/logs, though these may be intentionally out of scope.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Local MCP server for reading temperature/humidity sensors from Tuya/SmartLife devices, exposing tools to list devices, get capabilities, and read sensor data.
      -
    • F
      license
      A
      quality
      D
      maintenance
      Read-only MCP server for querying solar generation, consumption, and DER telemetry from SolarNetwork via the SolarQuery API. Zero-config against a public demo node.
      5
      -