Python package and MCP server for controlling MirAIe air conditioner devices.
- Discover available MirAIe AC devices.
- Power control (
turn_on_device,turn_off_device) for one or all devices. - Set temperature, fan mode, HVAC mode, presets, and swing positions.
- Query device details and friendly names through MCP tools.
src/miraie_ac_mcp/
api.py
broker.py
constants.py
device.py
device_status.py
enums.py
exceptions.py
home.py
manager.py
server.py
user.py
utils.py
tests/
docs/
- Python 3.13+
- uv (recommended)
- Create and activate an environment:
uv venv
source .venv/bin/activate- Install package and dev dependencies:
uv sync --extra dev- Configure credentials:
cp .env.example .envUpdate .env:
MIRAIE_LOGIN_ID=your_phone_number_or_email
MIRAIE_PASSWORD=your_passworduv run python -m miraie_ac_mcp.serverExample config snippet:
{
"mcpServers": {
"miraie-ac-mcp": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"miraie_ac_mcp.server"
],
"env": {
"MIRAIE_LOGIN_ID": "your_login",
"MIRAIE_PASSWORD": "your_password"
}
}
}
}Run tests:
uv run pytestRun lint checks:
uv run ruff check .Format code:
uv run ruff format .- Tool calls that require live device access need valid MirAIe credentials and network connectivity.
- Unit tests mock network-dependent behavior and run offline.
A Model Context Protocol (MCP) server that enables control of Panasonic MirAIe air conditioning devices through conversational AI. This server provides comprehensive AC control capabilities including temperature setting, mode changes, fan control, and device management.
- Power Management: Turn devices on/off individually or all at once
- Temperature Control: Set temperature (16-30°C) for specific devices or all devices
- Mode Control: Switch between operating modes (auto, cool, heat, dry, fan)
- Fan Control: Adjust fan speed (auto, low, medium, high)
- Preset Modes: Set energy-saving presets (none, eco, boost)
- Swing Control:
- Vertical swing modes (positions 0-5)
- Horizontal swing modes (positions 0-5)
- Device Management:
- List all connected devices
- Get detailed device information
- Individual device targeting by name
get_device_status- List all available AC devicesturn_on_device- Power on specific device or all devicesturn_off_device- Power off specific device or all devicesset_temperature- Set temperature for specific device or all devicesset_fan_mode- Control fan speed settingsset_mode- Change AC operating modeset_preset_mode- Apply energy presetsset_vertical_swing_mode- Control vertical air directionset_horizontal_swing_mode- Control horizontal air directionget_device_details- Get comprehensive device information
mcp>=0.1.0
python-dotenv
asyncio
fastapi (optional, for REST API)
The server requires Panasonic MirAIe account credentials configured as environment variables:
MIRAIE_LOGIN_ID=your_phone_number_or_email
MIRAIE_PASSWORD=your_password#THEN
cd miraie_mcp
pip install mcp python-dotenvCreate a .env file in the project root:
MIRAIE_LOGIN_ID=your_phone_number_or_email
MIRAIE_PASSWORD=your_passwordA sample env is also provided as .env.sample
Add to your MCP client configuration (e.g., Claude Desktop config):
{
"mcpServers": {
"panasonic-miraie-ac": {
"command": "python",
"args": ["/path/to/miraie_mcp/miraie_mcp.py"],
"env": {
"MIRAIE_LOGIN_ID": "83770.....",
"MIRAIE_PASSWORD": "djawesom....(yourpassword)"
}
}
}
}python miraie_mcp.py# Turn on all AC units
"Turn on all AC devices"
# Turn off a specific device
"Turn off the living room AC"
# Set temperature for all devices
"Set all ACs to 24 degrees"
# Set temperature for specific device
"Set the bedroom AC to 22 degrees"
# Change operating mode
"Set all ACs to cooling mode"
"Switch bedroom AC to auto mode"
# Adjust fan speed
"Set fan to high speed for all devices"
"Change living room AC fan to low"
# Apply presets
"Set all ACs to eco mode"
"Enable boost mode for bedroom AC"
# Control swing modes
"Set vertical swing to position 3 for all ACs"
"Change horizontal swing to auto for bedroom AC"
# Get device information
"Show me all available AC devices"
"Get details for the living room AC"
The project includes an optional FastAPI server (fastapi_server.py) for REST API access:
uvicorn fastapi_server:app --reloadGET /devices- Get all device statusPOST /devices/on- Turn on all devicesPOST /devices/off- Turn off all devicesPOST /devices/temperature- Set temperature for all devicesPOST /device/control- Control specific device
miraie_mcp.py- Main MCP server implementationapi.py- Panasonic MirAIe API clientdevice.py- Device abstraction and control logicenums.py- Enumeration definitions for modes and statesfastapi_server.py- Optional REST API server
Supports multiple authentication methods:
- Mobile phone number
- Email address
- Username
- Automatic device discovery upon connection
- Context-managed device connections
- Error handling and device validation
- Support for multiple simultaneous devices
- Authentication Errors: Verify credentials in
.envfile - Device Not Found: Check device name spelling and availability
- Connection Issues: Ensure stable internet connection
- Permission Errors: Verify MirAIe account has device access
Enable debug logging by setting stderr output in the terminal:
python miraie_mcp.py 2>debug.log- Store credentials securely using environment variables
- Never commit credentials to version control
- Use secure network connections for device communication
- Regularly update authentication tokens
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly with actual devices
- Submit a pull request
Feel free to use.
For issues and support:
- Check the troubleshooting section
- Review device compatibility
- Open an issue with detailed error logs
- Include device model and network setup details