Back to Directory/Developer Tools

io.github.chanyou0311/aiseg2-mcp

Unofficial read-only MCP server for the Panasonic AiSEG2 HEMS controller.

Developer ToolsPythonv0.1.0

aiseg2-mcp

日本語版は README.ja.md をご覧ください。

An unofficial, read-only Model Context Protocol server for the Panasonic AiSEG2 home energy management (HEMS) controller. It lets an MCP client (e.g. Claude) read your home's live power flow, per-circuit consumption, circuit names, and daily energy totals from the AiSEG2's local web interface.

This project is not affiliated with or endorsed by Panasonic. "AiSEG" is a Panasonic trademark.

Verified environment

Developed and tested against:

  • AiSEG2 model MKN713 series
  • Firmware Ver.2.97I-01

The AiSEG2 web interface is undocumented and changes between firmware revisions. On a different model or firmware the pages this server scrapes may differ and some tools may not work. If you hit a parse error, please open an issue with your model / firmware version.

Tools

All tools are read-only (annotated readOnlyHint, non-destructive). The server only issues GETs and the display-only refresh POSTs the web UI itself uses; it never touches settings or any /action/ endpoint.

ToolReturns
get_power_flowInstantaneous generation/consumption (kW), buy/sell state, battery status, generation sources, top consuming circuits
get_circuit_breakdownEvery measured circuit's instantaneous draw (W), ranked highest first, with the total
list_circuitsRegistered circuit ids and names (the authoritative naming source)
get_daily_totalsToday's cumulative generation / consumption / grid-buy / grid-sell (kWh)
get_historyLong-term energy history from the SD-card export (Wh), long-form points. Args: granularity (30min/hour/day/month/year), start/end (per granularity: YYYY-MM-DD, YYYY-MM, or YYYY), optional metrics/circuits filters, limit/offset paging
get_cost_historyLong-term energy-cost history from the SD-card export (JPY). Args: granularity (day/month/year), start/end, limit/offset

The two history tools require an SD card inserted in the AiSEG2 — they read the device's SD-card CSV export. The export is downloaded once and cached (see AISEG_CACHE_DIR / AISEG_CACHE_TTL), so the first call is slow and later calls are fast.

Install & run

Three ways to run it, depending on your setup.

1. uvx (PyPI — once published)

The simplest option for a local (stdio) MCP client. Requires uv.

AISEG_URL=http://192.168.0.216 AISEG_PASSWORD=... uvx aiseg2-mcp

Add it to Claude Code:

claude mcp add aiseg2 \
  --env AISEG_URL=http://192.168.0.216 \
  --env AISEG_PASSWORD=your-digest-password \
  -- uvx aiseg2-mcp

2. docker run (GHCR)

The container defaults to the streamable-http transport (long-lived network service). Only expose it behind an authenticating proxy — see Security.

docker run --rm -p 8000:8000 \
  -e AISEG_URL=http://192.168.0.216 \
  -e AISEG_PASSWORD=your-digest-password \
  ghcr.io/chanyou0311/aiseg2-mcp:latest

3. From source

Requires Python 3.12+ and uv.

uv sync
AISEG_URL=http://192.168.0.216 AISEG_PASSWORD=... uv run aiseg2-mcp

Remote (authenticated claude.ai Custom Connector)

To reach the server from claude.ai while your AiSEG2 stays on your LAN, see examples/remote/ — a Docker Compose stack (MCP + GitHub-OAuth proxy + Cloudflare Tunnel).

Configuration (environment variables)

VariableRequiredDefaultDescription
AISEG_URLyes—AiSEG2 base URL, e.g. http://192.168.0.216 (http only)
AISEG_PASSWORDyes—HTTP Digest password for the AiSEG2 web UI
AISEG_USERnoaisegHTTP Digest user
AISEG_TRANSPORTnostdiostdio or streamable-http
AISEG_HOSTno0.0.0.0Bind host (streamable-http only)
AISEG_PORTno8000Bind port (streamable-http only)
AISEG_DISABLE_DNS_REBINDING_PROTECTIONnofalseDisable the SDK Host allowlist — only behind a trusted auth proxy
AISEG_CACHE_DIRno<tempdir>/aiseg2-mcp-cacheWhere the SD-card history export is cached
AISEG_CACHE_TTLno3600Seconds to reuse a cached history export before re-downloading
LOG_LEVELnoinfoLog level

Security

  • LAN-only by design. The AiSEG2 speaks plain HTTP with Digest auth; keep it and this server on a trusted local network. The password is read from the environment and is never logged.
  • Read-only. There is no tool that changes a device setting. The tool surface is enforced by tests (registered-tool allowlist, tool-name guard, a source scan for /action/, and read-only annotation checks).
  • Do not expose the streamable-http transport to untrusted networks without authentication. This server carries no auth of its own; if you run it as a network service, put an authenticating reverse proxy in front of it. AISEG_DISABLE_DNS_REBINDING_PROTECTION=true is only appropriate in that proxied setup.

Acknowledgements

The AiSEG2 web interface is undocumented; this project builds on the reverse-engineering knowledge shared by prior work:

License

MIT

Installation

Source-derived launch command. Check the maintainer’s required arguments and credentials before running:

bash
uvx aiseg2-mcp

Set up in your AI client

Merge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.

json
{
  "mcpServers": {
    "io-github-chanyou0311-aiseg2-mcp": {
      "command": "uvx",
      "args": [
        "aiseg2-mcp"
      ]
    }
  }
}

Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.

Claude Desktop setup reference

Package

aiseg2-mcppypi

Compatible MCP Clients

io.github.chanyou0311/aiseg2-mcp works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.

  • Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.
  • Cursor~/.cursor/mcp.jsonRestart Cursor for changes to take effect.
  • VS Code.vscode/mcp.jsonReload VS Code window for changes to take effect.
  • Windsurf~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect.
  • Claude Code.mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.

Learn More