solax-cloud-mcp
This server enables real-time monitoring and control of SolaX solar inverters via the SolaX Developer Platform API, accessible as an MCP tool or HTTP API.
Query real-time inverter data (get_realtime_data):
PV string voltage, current, and power output
AC output per phase (voltage, current, power, frequency)
Daily and total energy yield
Grid import/export data
Battery status (SOC, state of health, charge/discharge power, voltage, current, temperature, cycle count)
Emergency Power Supply (EPS) data
Inverter temperature and operating status
Configure battery self-use mode (set_battery_self_use_mode):
Set minimum SOC (prevent over-discharging) and maximum charge SOC ceiling
Enable/disable charging from the grid
Schedule up to two time-based charge/discharge periods
Additional features:
Flexible device selection: Pass a device serial number or use the default from environment variables
MCP integration: Use directly with Claude Code/Desktop as an MCP tool
HTTP/Docker deployment: Run as a containerized HTTP API with health checks and authenticated endpoints
Automatic rate limiting: Enforces 0.7-second minimum spacing between calls to stay within SolaX API limits
Clear error handling: Covers invalid credentials, unauthorized devices, rate limiting, and network issues
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@solax-cloud-mcpget my solar inverter's real-time data"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SolaX Cloud MCP Server
An MCP server that provides real-time access to solar inverter data from the SolaX Developer Platform API. Query your inverter's current power output, energy yields, battery status, and grid import/export data directly from Claude Code or Claude Desktop.
Prerequisites
Python 3.10+ (automatically provisioned by
uv)uv package manager (install here)
A SolaX Developer Platform account with OAuth2 application registered
Device (inverter) serial number (
deviceSn) for your inverter
Related MCP server: EcoFlow MCP Server
Getting Started
1. Register an OAuth2 Application
Log in to SolaX Developer Platform
Navigate to Application section
Create a new application and enable client_credentials grant type
Copy your Client ID and Client Secret (keep these secret!)
2. Identify Your Device Serial Number
Log in to SolaX Developer Platform
Navigate to My Account or device management section
Find your inverter's device serial number (e.g.,
X3ABCD0123)This is NOT the old WiFi dongle registration number used by the legacy SolaX Cloud API
3. Install the Server
# Clone or navigate to the repo
cd /Users/gary/mysrc/claude/solax-cloud-mcp
# Install uv if needed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies and create virtual environment
uv sync4. Configure Credentials
# Copy the example environment file
cp .env.example .env
# Edit .env and fill in your credentials
nano .envAdd your OAuth2 credentials and device serial number:
SOLAX_CLIENT_ID=your_client_id
SOLAX_CLIENT_SECRET=your_client_secret
SOLAX_DEVICE_SN=X3ABCD01235. Register with Claude Code
To use this server with Claude Code or Claude Desktop:
claude mcp add solax-cloud \
--env SOLAX_CLIENT_ID=your_client_id \
--env SOLAX_CLIENT_SECRET=your_client_secret \
--env SOLAX_DEVICE_SN=your_device_sn \
--scope user \
-- uv run --directory /Users/gary/mysrc/claude/solax-cloud-mcp solax-cloud-mcpIf the above doesn't work (environment variable propagation issues), edit your MCP config JSON directly:
Claude Code:
~/.claude/mcp.jsonor project settingsClaude Desktop:
~/.config/Claude/claude_desktop_config.json(macOS) or equivalent
Add this entry:
{
"solax-cloud": {
"command": "uv",
"args": [
"run",
"--directory",
"/Users/gary/mysrc/claude/solax-cloud-mcp",
"solax-cloud-mcp"
],
"env": {
"SOLAX_CLIENT_ID": "your_client_id",
"SOLAX_CLIENT_SECRET": "your_client_secret",
"SOLAX_DEVICE_SN": "your_device_sn"
}
}
}Usage
Once registered, the get_realtime_data tool is available in your MCP toolset. Use it to query real-time inverter data.
Tool: get_realtime_data
Arguments:
device_sn(optional): Inverter device serial number. If omitted, defaults toSOLAX_DEVICE_SNenvironment variable.
Returns: A structured dictionary containing:
{
"device": {
"deviceSn": "X3ABCD0123",
"registerNo": "SE123456SP",
"dataTime": "2025-05-22 15:13:10",
"plantLocalTime": "2025-05-22 15:13:10"
},
"status": {
"code": 102,
"description": "Normal"
},
"pv": [
{"string": 1, "voltage_V": 421.7, "current_A": 0.4, "power_W": 189.0},
{"string": 2, "voltage_V": 418.0, "current_A": 0.0, "power_W": 0.0}
],
"mppt": {
"trackers": [
{"mppt": 1, "voltage_V": 0.0, "current_A": 0.0, "power_W": 0.0}
],
"totalPower_W": null
},
"ac": {
"phases": [
{"phase": 1, "voltage_V": 224.1, "current_A": 0.9, "power_W": 189.0, "frequency_Hz": 50.0},
{"phase": 2, "voltage_V": 226.5, "current_A": 0.8, "power_W": 171.0, "frequency_Hz": 50.0}
],
"totalPower_W": 360.0,
"totalReactivePower": 0,
"powerFactor": 1.0,
"gridFrequency": 50.0
},
"energy": {
"dailyYield_kWh": 157.4,
"totalYield_kWh": 20465.3,
"dailyACOutput_kWh": 160.9,
"totalACOutput_kWh": 19907.5
},
"meter1": {
"gridPower_W": 0,
"todayImportEnergy_kWh": 0.07,
"totalImportEnergy_kWh": 23.28,
"todayExportEnergy_kWh": 0.0,
"totalExportEnergy_kWh": 64.98
},
"meter2": {
"gridPower_W": 0,
"todayImportEnergy_kWh": 0.08,
"totalImportEnergy_kWh": 1.39,
"todayExportEnergy_kWh": 0.0,
"totalExportEnergy_kWh": 0.75
},
"battery": {
"soc_percent": 85.5,
"remainingEnergy_kWh": 1024.8,
"soh_percent": 99.2,
"chargeDischargePower_W": -150.5,
"voltage_V": 409.6,
"current_A": -15.2,
"temperature_C": 28.3,
"cycleTimes": 142,
"totalCharge_kWh": 4250.75,
"totalDischarge_kWh": 4100.25,
"status": {"code": 1, "description": "Work"}
},
"eps": {
"voltage_V": [0.0, 0.0, 0.0],
"current_A": [0.0, 0.0, 0.0],
"activePower_W": [0.0, 0.0, 0.0],
"apparentPower_W": [0.0, 0.0, 0.0]
},
"temperature": {
"inverter_C": 40.4
},
"misc": {
"l1l2Voltage_V": null,
"l2l3Voltage_V": null,
"l1l3Voltage_V": null
}
}Example Usage in Claude
"What's the current power output of my solar inverter?"
Claude will call get_realtime_data() and report the results to you in human-friendly terms.
Docker: Build, Deploy & HTTP Consumption
For containerized deployment on Raspberry Pi or any Docker-enabled system, you can run the server in HTTP mode:
Build the Docker Image
# Build the image
docker build -t solax-cloud-mcp:latest .
# Verify the build
docker images | grep solax-cloud-mcpDeploy with Docker Compose
Configure your environment variables first:
# Copy and edit the environment file
cp .env.example .env
nano .envFill in your SolaX credentials and generate a strong API key:
SOLAX_CLIENT_ID=your_client_id
SOLAX_CLIENT_SECRET=your_client_secret
SOLAX_DEVICE_SN=your_device_sn
HTTP_API_KEY=$(python -c "import secrets; print(secrets.token_urlsafe(32))")Start the HTTP server:
# Build and start the container in the background
docker-compose up -d
# Check logs
docker-compose logs -f solax-http
# Verify it's running
curl http://localhost:8000/healthThe server listens on port 8000 and is accessible at http://YOUR_PI_IP:8000.
Consume the HTTP API
All endpoints (except /health) require a bearer token in the Authorization header.
Health Check (no authentication)
curl http://192.168.1.100:8000/healthResponse:
{"status": "ok"}Get Real-Time Inverter Data
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"device_sn": "X3ABCD0123"}' \
http://192.168.1.100:8000/api/realtime-dataReturns current power output, battery SOC, grid export/import, and more.
Set Battery Self-Use Mode
Configure battery charging/discharging thresholds:
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_sn": "X3ABCD0123",
"min_soc": 20,
"charge_upper_soc": 80,
"charge_from_grid_enable": 1
}' \
http://192.168.1.100:8000/api/battery/self-use-modePython / JavaScript Examples
Quick examples in Python and JavaScript are available in HTTP_API.md, including:
Polling for real-time updates
Time-based battery scheduling
Error handling patterns
Rate limiting considerations
Deployment on Raspberry Pi
Full deployment instructions (Docker installation, network setup, security, monitoring) are in DEPLOYMENT.md.
Docker Management
# View logs
docker-compose logs -f solax-http
# Restart the server
docker-compose restart solax-http
# Stop the server
docker-compose down
# Rebuild after code changes
docker-compose up -d --build
# Check resource usage
docker stats solax-httpManual Testing
Quick Smoke Test
Before registering with Claude, you can test the client directly:
uv run --env-file .env python -c \
"import asyncio; from solax_cloud_mcp.client import fetch_realtime_data; \
from solax_cloud_mcp.config import get_default_device_sn; \
print(asyncio.run(fetch_realtime_data(get_default_device_sn())))"Run Tests
uv run pytest -vTests include:
Response shaping and status decoding
Environment variable validation
Error handling and edge cases (battery-less devices, null status codes)
Dynamic PV/MPPT parsing
Case-insensitive field access
Interactive Inspection
If you have the MCP CLI tools installed:
uv run --env-file .env mcp dev src/solax_cloud_mcp/server.pyRate Limiting
This server respects SolaX Developer Platform's documented rate limits:
100 calls per minute per token
1,000,000 calls per day per token
The client automatically enforces a 0.7-second minimum spacing between calls, which keeps typical usage well within both limits. No manual rate limiting is needed.
Data Fields Reference
All values are in SI units:
Power: Watts (W)
Energy: Kilowatt-hours (kWh)
Voltage: Volts (V)
Current: Amps (A)
Temperature: Celsius (°C)
Frequency: Hertz (Hz)
Inverter Status Codes
The inverter's status.code is an integer from the table below (Appendix 6 from the SolaX Developer Platform API docs). Not all possible codes are listed; consult the full Appendix 6 table on developer.solaxcloud.com/doc for the complete set.
Code | Status | Description |
100 | Waiting | Waiting |
101 | Self-check | Self-check |
102 | Normal | Normal |
103 | Fault | Fault |
104 | Permanent Fault Mode | Permanent Fault Mode |
105 | Update Mode | Update Mode |
106 | EPS Check Mode | EPS Check Mode |
107 | EPS Mode | EPS Mode |
108 | Self-test | Self-test |
109 | Idle Mode | Idle Mode |
110 | Standby Mode | Standby Mode |
130 | VPP mode | VPP mode |
131 | TOU-Self use | TOU-Self use |
132 | TOU-Charging | TOU-Charging |
133 | TOU-Discharging | TOU-Discharging |
1301-1309 | Advanced control modes | Power/SOC target control, self-consume modes, etc. |
Battery Status Codes (Residential)
The battery's battery.status.code is an integer:
Code | Status |
0 | Idle |
1 | Work |
API Error Codes (Appendix 1)
Code | Message |
10000 | Operation successful |
10001 | Operation failed |
11500 | System busy, please try again later |
10200 | Operation abnormality, please see the specific message content for details |
10400 | Request not authenticated |
10401 | Username or password incorrect |
10402 | Request access_token authentication failed |
10403 | Interface has no access rights |
10404 | Callback function not configured |
10405 | The number of API calls has been used up |
10406 | The API call rate has reached the upper limit, please try again later |
10500 | User has no device data permission |
10505 | Device unauthorized |
10506 | Plant unauthorized |
Troubleshooting
"SOLAX_CLIENT_ID environment variable not set"
Set the
SOLAX_CLIENT_IDenvironment variable or register the server with the correct credentials
"SOLAX_CLIENT_SECRET environment variable not set"
Set the
SOLAX_CLIENT_SECRETenvironment variable or register the server with the correct credentials
"No device_sn provided"
Either pass the
device_snargument to the tool or set theSOLAX_DEVICE_SNenvironment variable
"SolaX API error 10402: Request access_token authentication failed"
The server will automatically attempt to refresh the access token once; if this persists, your Client Secret may be invalid or revoked. Re-register your OAuth2 application at https://developer.solaxcloud.com/
"SolaX API error 10505: Device unauthorized"
The device serial number you provided is invalid or not associated with your account. Double-check the device SN in your SolaX Developer Platform account.
"SolaX API error 10406: The API call rate has reached the upper limit"
The rate limiter is correctly enforced; this should rarely occur under normal usage. If it does, the server automatically backs off. Reduce tool call frequency or wait a few seconds and retry.
"Network timeout"
SolaX Developer Platform API is unreachable. Check your internet connection and confirm the service is online at
https://developer.solaxcloud.com/.
Development
Project Structure
solax-cloud-mcp/
├── src/solax_cloud_mcp/
│ ├── __init__.py # Package metadata
│ ├── __main__.py # CLI entry point
│ ├── server.py # MCP server and tool definitions
│ ├── client.py # HTTP client and API calls
│ ├── auth.py # OAuth2 token management
│ ├── config.py # Environment variable handling
│ └── models.py # Data models and response shaping
├── tests/
│ ├── fixtures/ # Test data
│ ├── test_config.py # Configuration tests
│ └── test_models.py # Response shaping tests
├── pyproject.toml # Project metadata and dependencies
└── README.md # This fileAdding Features
The server is designed to be minimal and focused. To add more endpoints/tools:
Fetch the data from SolaX Developer Platform API (extend
client.py)Add a response shaping function if needed (extend
models.py)Define a new
@server.tool()inserver.py
License
MIT
Support
For issues with this MCP server, open an issue on the repository.
For SolaX Developer Platform API documentation, refer to SolaX Developer Platform.
Available Tools
2 toolsget_realtime_dataA
Fetch real-time solar inverter data from SolaX Developer Platform.
Retrieves the latest readings including power output, energy yields, battery status, and grid import/export data from the SolaX Developer Platform API. All power values are in Watts (W), energy in kWh, voltage in Volts (V), current in Amps (A), and temperature in Celsius (°C).
Args: device_sn: Serial number of the inverter to query (the device SN, not WiFi dongle SN). If omitted, defaults to SOLAX_DEVICE_SN environment variable.
Returns: A structured dictionary with decoded status values and grouped data fields: - device: inverter identifiers (SN, registration number, timestamps) - status: inverter operating status (code + human-readable description) - pv: list of active PV strings with voltage/current/power - mppt: MPPT tracker data (individual trackers + total power) - ac: AC output phases, total power, reactive power, power factor, grid frequency - energy: daily/total yield and AC output - meter1: grid power and energy (import/export) - meter2: secondary meter data (import/export) - battery: battery voltage/current/power/soc/status (None if no battery) - eps: emergency power supply data (3-phase voltage/current/power) - temperature: inverter temperature - misc: line-to-line voltages
Raises: ToolError: if credentials are invalid, the device is not found, or the API fails.
| Name | Required | Description | Default |
|---|---|---|---|
| device_sn | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Describes the operation as read-only ('Fetch', 'Retrieves'), lists error conditions, and provides return structure details. No annotations are present, so description covers the behavioral aspects well.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-structured with summary, units, clear Args/Returns/Raises sections. Front-loaded with main purpose, no superfluous content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool, the description fully covers input, output (detailed return structure), and error behavior, making it self-contained without needing an output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Clearly explains the parameter 'device_sn', including the distinction from WiFi dongle SN and the default environment variable. This adds significant value beyond the schema which lacks descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Fetch real-time solar inverter data' with a specific data source. It distinguishes from the sibling tool 'set_battery_self_use_mode' which is a write operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides context like data source and default environment variable, but lacks explicit when-to-use or when-not-to-use guidance relative to siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
set_battery_self_use_modeA
Set inverter battery to Self Use Mode with configurable charging thresholds.
Self Use Mode is ideal for automated control based on conditions like weather. You can set minimum SOC (don't discharge below), maximum charge SOC (don't charge above), and optionally configure time-based charge/discharge periods (e.g., charge during peak solar, discharge during high-rate periods).
Example automation scenarios:
Reduce charging threshold on cloudy days to preserve grid import reserves
Increase charging threshold on clear days to maximize solar self-consumption
Prevent overnight charging from grid during expensive peak hours
Args: device_sn: Serial number of the inverter. If omitted, uses SOLAX_DEVICE_SN. min_soc: Minimum SOC (%), range [10, 100]. Battery won't discharge below this. Default: 10%. charge_upper_soc: Maximum charging SOC (%), range [10, 100]. Battery won't charge above this. Default: 100%. charge_from_grid_enable: Allow charging from grid (0=no, 1=yes). Default: 1 (enabled). charge_start_time_period1: Optional start time for charging period 1 (HH:MM format, e.g., "06:00"). charge_end_time_period1: Optional end time for charging period 1 (HH:MM format, e.g., "18:00"). discharge_start_time_period1: Optional start time for discharge period 1 (HH:MM format). discharge_end_time_period1: Optional end time for discharge period 1 (HH:MM format). enable_time_period2: Enable second time period (0=disabled, 1=enabled). Default: 0. charge_start_time_period2: Optional start time for charging period 2 (HH:MM format). charge_end_time_period2: Optional end time for charging period 2 (HH:MM format). discharge_start_time_period2: Optional start time for discharge period 2 (HH:MM format). discharge_end_time_period2: Optional end time for discharge period 2 (HH:MM format).
Returns: API response confirming the command was sent to the inverter.
Raises: ToolError: if the inverter is offline, credentials are invalid, or the API fails.
| Name | Required | Description | Default |
|---|---|---|---|
| min_soc | No | ||
| device_sn | No | ||
| charge_upper_soc | No | ||
| enable_time_period2 | No | ||
| charge_end_time_period1 | No | ||
| charge_end_time_period2 | No | ||
| charge_from_grid_enable | No | ||
| charge_start_time_period1 | No | ||
| charge_start_time_period2 | No | ||
| discharge_end_time_period1 | No | ||
| discharge_end_time_period2 | No | ||
| discharge_start_time_period1 | No | ||
| discharge_start_time_period2 | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses that the tool sends a command to the inverter, returns an API response, and raises ToolError for offline inverter, invalid credentials, or API failure. It does not detail potential side effects on other settings, but overall transparency is good.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with a one-line summary, explanatory paragraph, example scenarios, and a clear list of arguments. It is slightly verbose but front-loads the purpose. No unnecessary sentences, but could be trimmed slightly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 13 parameters, no output schema, and no annotations, the description covers all aspects: parameter details, error conditions, usage scenarios. It is comprehensive enough for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so description must compensate. It provides thorough details for all 13 parameters: defaults, ranges (e.g., min_soc [10,100]), formats (HH:MM for time periods), and explanations of each parameter's purpose. This fully compensates for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool sets inverter battery to Self Use Mode with configurable thresholds. It uses a specific verb ('Set') and resource ('inverter battery'), and distinguishes from sibling tool get_realtime_data which is read-only.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains when Self Use Mode is ideal (automated control based on conditions) and provides example automation scenarios. It does not explicitly exclude other modes or provide alternatives, but given the sibling tool, context is clear. Score 4 for clear context without explicit exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
get_realtime_data - First observed
set_battery_self_use_mode
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: one retrieves real-time data, the other sets a battery mode. There is no ambiguity between them.
Both tools follow a consistent verb_noun snake_case pattern (get_realtime_data, set_battery_self_use_mode), making them predictable.
With only 2 tools, the server feels too thin. A typical solar inverter API would require more tools (e.g., historical data, other modes, configuration) to be useful.
Major gaps exist: no tool for reading current battery mode, no historical data, no other inverter settings. The set covers only real-time data and one battery mode.
Maintenance
Related MCP Connectors
GB solar/battery comparisons and Ofgem rates. Five trial calls, then 0.01 USDC per eligible call.
Query Australia's electricity market (NEM/AEMO): prices, generation, FCAS, interconnectors, bids.
Read-only access to Australian NEM grid-scale battery performance, revenue, dispatch and FCAS data.
Real-time electricity price signals for AI agents. Spot prices, cheapest hours, and contract recommendations. 31 countries across Europe and Oceania. No authentication required.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides access to Alpha ESS solar inverter and battery system data, enabling monitoring of energy statistics, real-time power data, and configuration of battery charging and discharge schedules through the Alpha ESS Open API.10MIT
- FlicenseAqualityNot gradedmaintenanceEnables monitoring and control of EcoFlow Power Stations and devices through the Model Context Protocol. Users can manage battery levels, toggle AC/DC outputs, and configure charging settings across the DELTA and RIVER series via the EcoFlow API.9-
- AlicenseAqualityDmaintenanceEnables real-time solar data from Fronius inverters via Claude, allowing natural language queries about solar production, battery, and grid exchange.51Apache 2.0
- AlicenseAqualityCmaintenanceEnables access to Fronius solar inverter data via the MCP protocol, allowing real-time monitoring of energy production, consumption, and battery storage through natural language.1484MIT