tesla-powerwall
Provides tools to monitor and control your Tesla Powerwall 2 system locally via the gateway API, including authentication, real-time power metrics, battery state, system status, operation mode changes, and configuration.
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., "@tesla-powerwall What's my current battery level?"
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.
Tesla Powerwall 2 MCP Server
A Model Context Protocol (MCP) server that provides tools to interact with your Tesla Powerwall 2 local gateway API. This allows AI assistants like Claude to monitor and control your Powerwall system.
Features
Authentication
powerwall_login - Authenticate with your Powerwall gateway
powerwall_logout - Expire your authentication token
Monitoring Tools
powerwall_get_meters_aggregates - Get real-time power metrics for solar, grid, battery, and home
powerwall_get_soe - Get battery state of energy (charge percentage)
powerwall_get_system_status - Get overall system status
powerwall_get_status - Get Powerwall version and uptime
powerwall_get_site_info - Get site configuration and capacity
powerwall_get_grid_status - Check grid connection status
powerwall_get_powerwalls - List all Powerwalls and their status
powerwall_get_meters - Get detailed meter information
powerwall_get_solars - Get solar array information
Control Tools
powerwall_set_operation - Change operation mode (self_consumption, backup, autonomous, scheduler)
Set backup reserve percentage
Configuration Tools
powerwall_get_operation - View current operation mode settings
powerwall_get_config - Get system configuration
powerwall_get_customer - Get customer registration info
powerwall_get_installer - Get installer information
powerwall_get_networks - Get WiFi network information
powerwall_get_device_type - Get device type details
Related MCP server: Tessie MCP Server
Installation
# Clone or create the project
npm install
# Build the TypeScript code
npm run buildConfiguration
Set these environment variables or create a .env file:
POWERWALL_HOST=192.168.1.xxx # Your Powerwall gateway IP or hostname
POWERWALL_USERNAME=customer # Usually "customer"
POWERWALL_PASSWORD=xxxxx # Last 5 digits of gateway serial number or custom password
POWERWALL_EMAIL= # Optional emailFinding Your Credentials
Gateway IP Address: Check your router's connected devices or use the Tesla app
Password:
Open the Tesla app
Go to Settings → My Home Info
Find "Powerwall Gateway" serial number
Use the last 5 digits as your password (unless you set a custom password)
Usage with Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"tesla-powerwall": {
"command": "node",
"args": ["/path/to/tesla-powerwall-mcp/dist/index.js"],
"env": {
"POWERWALL_HOST": "192.168.1.xxx",
"POWERWALL_USERNAME": "customer",
"POWERWALL_PASSWORD": "xxxxx"
}
}
}
}Example Queries for Claude
Once configured, you can ask Claude things like:
"What's my current battery level?"
"How much solar power am I generating right now?"
"Show me all my power metrics"
"What's my Powerwall operation mode?"
"Change to self-consumption mode with 20% backup reserve"
"Is the grid connected?"
"What's my home power consumption?"
"How many Powerwalls do I have?"
Understanding Power Metrics
When you query powerwall_get_meters_aggregates, you'll see power values in watts:
site (Grid):
Positive = drawing power from grid
Negative = sending power to grid
battery (Powerwall):
Positive = discharging (powering home)
Negative = charging
solar:
Positive = generating power
load (Home):
Power being consumed by your home
Operation Modes
self_consumption: Use solar/battery to power home, grid as backup
backup: Prioritize keeping battery charged for outages
autonomous: Time-based control (if configured)
scheduler: Custom schedule mode
Security Notes
⚠️ Important Security Considerations:
Self-Signed Certificate: The Powerwall uses a self-signed SSL certificate. This server accepts it by setting
rejectUnauthorized: false. This is standard for local Powerwall access but means SSL verification is disabled.Local Network Only: Only use this on your trusted local network. Never expose your Powerwall gateway to the internet.
Credentials: Keep your gateway password secure. Anyone with access can control your Powerwall.
Token Storage: Authentication tokens are stored in memory only during the session.
API Reference
Based on the community-documented API at: https://github.com/vloschiavo/powerwall2
Troubleshooting
Cannot connect to Powerwall:
Verify the IP address is correct
Make sure you're on the same network as your Powerwall
Check firewall settings
Authentication fails:
Verify password is correct (last 5 digits of gateway serial)
Try using the custom password if you set one
Some firmware versions may require different authentication
"Error: self signed certificate":
This is expected. The server handles self-signed certificates automatically.
Project Structure
tesla-powerwall-mcp/
├── src/
│ └── index.ts # Main MCP server code
├── dist/ # Compiled JavaScript (generated)
├── package.json
├── tsconfig.json
└── README.mdDevelopment
# Install dependencies
npm install
# Build
npm run build
# Run directly
npm startContributing
Contributions welcome! This server implements the documented endpoints from the community research at https://github.com/vloschiavo/powerwall2
License
MIT
Disclaimer
This is an unofficial tool and is not affiliated with Tesla, Inc. Use at your own risk. The author is not responsible for any issues that arise from using this software to interact with your Powerwall system.
Credits
API documentation: https://github.com/vloschiavo/powerwall2
MCP Protocol: Anthropic
Community research and testing by Tesla Powerwall owners
Available Tools
18 toolspowerwall_get_configC
Get system configuration
Inputs: no named parameters.
powerwall_get_customerB
Get customer registration information
Inputs: no named parameters.
powerwall_get_device_typeB
Get device type information
Inputs: no named parameters.
powerwall_get_grid_statusB
Get grid connection status
Inputs: no named parameters.
powerwall_get_installerB
Get installer information
Inputs: no named parameters.
powerwall_get_metersB
Get detailed meter information for all meters
Inputs: no named parameters.
powerwall_get_meters_aggregatesB
Get current readings from meters measuring solar, grid, battery, and home power
Inputs: no named parameters.
powerwall_get_networksB
Get WiFi network information
Inputs: no named parameters.
powerwall_get_operationA
Get current operation mode settings
Inputs: no named parameters.
powerwall_get_powerwallsB
Get list of Powerwalls and their status
Inputs: no named parameters.
powerwall_get_site_infoB
Get site information including nominal system energy and power
Inputs: no named parameters.
powerwall_get_soeB
Get state of energy (battery charge percentage)
Inputs: no named parameters.
powerwall_get_solarsB
Get solar array information
Inputs: no named parameters.
powerwall_get_statusB
Get Powerwall status including version and uptime
Inputs: no named parameters.
powerwall_get_system_statusB
Get overall system status and information
Inputs: no named parameters.
powerwall_loginA
Authenticate with the Powerwall gateway and obtain an access token
Inputs: password (required), email, username.
powerwall_logoutA
Logout and expire the current authentication token
Inputs: no named parameters.
powerwall_set_operationB
Set operation mode (self_consumption, backup, autonomous, etc.)
Inputs: mode (required), backup_reserve_percent.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools map to distinct resources, but several read-only getters overlap in purpose, such as get_status vs get_system_status and get_meters vs get_meters_aggregates. An agent may struggle to choose between status-related endpoints without deeper API knowledge.
All tools use a consistent powerwall_ prefix with snake_case verb_noun names. The only non-get tools are login, logout, and set_operation, which clearly follow the same predictable action-based pattern.
18 tools is on the heavier side but appropriate for a Powerwall gateway server that exposes many distinct API resources. Each tool appears to represent a real endpoint, so the count is justified rather than bloated.
The server covers authentication, status, meters, battery state, grid status, operation settings, configuration, and installer details. The main gap is limited write operations beyond setting operation mode, but for monitoring and basic control the surface is largely complete.
Maintenance
Related MCP Connectors
Control your Tesla from your AI assistant - climate, charging, access, and security.
Home energy for AI assistants: live Power flow, Energy history, solar forecast, and device control.
AI for your car: check charge, start climate, lock/unlock, open trunk via Tesla Fleet API. OAuth.
Tesla data for your AI: battery, range, charging, tires, alerts, history. Controls off by default.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Home Assistant smart home devices through natural language. Control devices, manage automations, query entity states, and retrieve historical data across your home automation system.1MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to control and monitor Tesla vehicles via natural language through the Tessie API, supporting battery, climate, security, charging, and more.611MIT
- AlicenseAqualityBmaintenanceConnect AI assistants to Victron Energy systems to read real-time solar, battery, grid, and inverter data from your local network via Modbus TCP or MQTT.3245 npm7MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control Home Assistant via natural language, including device control, automation management, and system monitoring.MIT