Skip to main content
Glama
scau-electricity-mcp

scau-electricity-mcp

by xnbx2012

SCAU Electricity MCP Server

简体中文 | English

A lightweight, read-only Model Context Protocol (MCP) server for querying dormitory electricity data at South China Agricultural University (SCAU).

The server runs locally over stdio, keeps authentication sessions in memory, and does not read Home Assistant configuration or persist tokens, cookies, room details, or query results.

Features

  • Query total and per-day electricity usage for an inclusive date range.

  • Read the current electricity balance, refresh time, and meter status.

  • Read lifetime electricity usage without supplying any parameters.

  • Calculate range and daily electricity costs using a configurable unit price.

  • Expose read-only, idempotent MCP tools with structured JSON results.

Related MCP server: MCP Student Assistant

Available tools

Tool

Parameters

Description

get_daily_energy

start_date, end_date

Returns total usage and per-day readings for an inclusive date range.

get_balance

None

Returns the current balance, refresh time, and meter online status.

get_lifetime_energy

None

Returns cumulative electricity usage since the meter came online.

get_electricity_summary

start_date, end_date

Returns range totals, daily readings and costs, lifetime usage as of the end date, and the current balance.

Dates must use the YYYY-MM-DD format. start_date must not be later than end_date.

Requirements

  • Python 3.12 or newer

  • uv

  • Network access to http://cz.scau.edu.cn

  • Your SCAU electricity room name and room ID

Installation

git clone https://github.com/xnbx2012/scau-electricity-mcp.git
cd scau-electricity-mcp
uv sync

If uv reports invalid peer certificate: UnknownIssuer behind a system or corporate certificate proxy, run uv --system-certs sync.

Running locally

Pass the room settings as command-line arguments:

uv run python server.py --room-name "Your room name" --room-id "Your room ID"

Or use environment variables:

$env:SCAU_ROOM_NAME = "Your room name"
$env:SCAU_ROOM_ID = "Your room ID"
uv run python server.py

The process communicates over stdio. It is normal for it to remain running without printing a prompt.

MCP client configuration

Replace the directory with the absolute path to your clone:

{
  "mcpServers": {
    "scau-electricity": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\absolute\\path\\to\\scau-electricity-mcp",
        "run",
        "python",
        "server.py"
      ],
      "env": {
        "SCAU_ROOM_NAME": "Your room name",
        "SCAU_ROOM_ID": "Your room ID"
      }
    }
  }
}

If the client cannot find uv, set command to the absolute path of uv.exe. Do not commit client configuration containing real room details to a public repository.

Configuration

Environment variable

CLI option

Default

Description

SCAU_ROOM_NAME

--room-name

Required

Electricity account room name.

SCAU_ROOM_ID

--room-id

Required

Electricity account room ID.

SCAU_BASE_URL

--base-url

http://cz.scau.edu.cn

Upstream service URL.

SCAU_DB_ID

--db-id

9853

Upstream meter database ID.

SCAU_ELECTRICITY_PRICE

--electricity-price

0.63

Electricity price in CNY per kWh.

Command-line options take precedence over environment variables.

Development

uv sync --group dev
uv run ruff check .
uv run pytest

Tests do not contact the university service and contain no real room information.

Privacy and security

  • Room details are sent only to the university electricity service.

  • Authentication tokens and cookies remain in memory and are not persisted.

  • The upstream service currently uses plain HTTP, so traffic is not protected by TLS.

  • All exposed MCP tools are read-only.

Disclaimer

This is an unofficial community project and is not affiliated with or endorsed by South China Agricultural University. The upstream interface may change without notice.

License

Licensed under the MIT License.

Available Tools

4 tools
get_balanceA
Read-onlyIdempotent

读取当前电费余额、余额刷新时间和电表在线状态。

Inputs: no named parameters. Returns: object

get_daily_energyB
Read-onlyIdempotent

读取指定日期范围的用电量; 起止日期均为 YYYY-MM-DD (含首尾)。

Inputs: end_date (required), start_date (required). Returns: object

get_electricity_summaryA
Read-onlyIdempotent

读取日期范围用电量、电费、累计用电量和当前余额 (含首尾)。

Inputs: end_date (required), start_date (required). Returns: object

get_lifetime_energyA
Read-onlyIdempotent

读取电表自上线以来截至当前日期的累计总用电量。

Inputs: no named parameters. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 4 tools

    Disambiguation4/5

    get_daily_energy and get_electricity_summary both cover date-range electricity usage, but the summary tool explicitly bundles fees, lifetime usage, and balance, making its purpose distinct. The other tools are clearly separated by their specific query targets.

    Naming Consistency5/5

    All tool names follow a consistent get_<descriptive_noun> pattern, such as get_daily_energy and get_lifetime_energy. There are no mixed conventions or vague verbs.

    Tool Count5/5

    Four tools is well-scoped for a read-only electricity meter server. Each tool either serves a specific query or provides a combined summary without unnecessary bloat.

    Completeness4/5

    The set covers daily usage, lifetime usage, current balance, and a combined summary, which is sufficient for typical electricity monitoring. A standalone fee breakdown or current power reading could be added, but agents will not encounter significant dead ends.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only queries of i桂航 campus data, including schedules, classes, terms, and campus information through MCP tools.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Read-only MCP server for Chaoxing (学习通) that logs into a user's account and exposes their class schedule, enrolled courses, course materials downloads, homework status, exam schedules and scores, chapter task-point progress, notices, and personal cloud drive files. Enables any MCP client to answer natural-language questions about a student's coursework without submitting anything or modifying account data.
      25
      MIT