Home Automation MCP Server
Click on "Install 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., "@Home Automation MCP ServerTurn on the living room lights"
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.
Home Automation MCP Server
A comprehensive smart home automation system that allows AI assistants to control and monitor smart home devices through natural language using the Model Context Protocol (MCP).
๐๏ธ Architecture
AI Assistant (Claude Desktop/VS Code)
โ stdio MCP Protocol
FastMCP Server
โ
SQLite Database โ [Real-time Polling] โ FastAPI Server
โ WebSocket
React FrontendKey Components:
FastMCP Server - Handles AI interactions via stdio protocol
FastAPI Server - REST API + WebSocket for real-time frontend updates
SQLite Database - Shared state between both servers with timestamp-based change detection
React Frontend - Real-time dashboard with WebSocket updates
โจ Features
MCP Tools (9 Tools)
control_device - Universal device control (on/off/set/toggle)
get_device_status - Query device states
get_sensor_reading - Read temperature, motion sensors
set_home_mode - Execute scenes (home/away/sleep/vacation)
get_home_mode - Check current mode
feed_fish - Trigger fish feeder
water_plants - Control sprinkler system
start_ev_charging / stop_ev_charging - EV charger control
Supported Devices (24+ Sample Devices)
๐ก Lights (with brightness control)
๐ก๏ธ Thermostat (temperature + mode control)
๐ Locks
๐ช Blinds (with position control)
๐จ Fans (with speed control)
๐ Garage door
๐ Fish feeder
๐ง Sprinkler system
๐ EV charger
๐ก๏ธ Temperature sensors
๐๏ธ Motion sensors
Home Modes
Home - Welcome mode (lights on, 72ยฐF)
Away - Security mode (lights off, locks engaged, 65ยฐF)
Sleep - Night mode (bedroom dim 20%, doors locked, 68ยฐF)
Vacation - Extended away (everything secured, 60ยฐF)
๐ Quick Start
1. Install Dependencies
pip install -r requirements.txt
cd frontend
npm install # First time only2. Start the System
Option A: Using the Menu (Easiest)
start.batThen select what to start from the menu.
Option B: Direct Commands (Recommended for Development)
Open 2 separate terminals:
# Terminal 1: Start API Server (Backend)
python app/main.py
# โ Available at http://localhost:8000
# Terminal 2: Start Frontend (Dashboard)
cd frontend
npm run dev
# โ Available at http://localhost:51733. Configure MCP Server for Claude Desktop (Optional)
Run the configuration helper:
python app/stdio_config.pyCopy the output and add it to your Claude Desktop config file:
Windows:
%APPDATA%/Claude/claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Example configuration:
{
"mcpServers": {
"home-automation": {
"command": "python",
"args": ["C:/path/to/home_automation/app/mcp_server_stdio.py"]
}
}
}Restart Claude Desktop after adding the configuration.
๐ฌ Example AI Interactions
Device Control
"Turn on the living room lights to 75%"
"Set bedroom temperature to 72 degrees"
"Close all the blinds"
"Lock all doors"Status Queries
"What's the status of my home?"
"What's the temperature in the bedroom?"
"Are all the doors locked?"Home Modes
"I'm leaving" โ Sets away mode
"I'm going to bed" โ Sets sleep mode
"Good morning" โ Sets home modeSpecial Actions
"Feed the fish"
"Water the front yard for 10 minutes"
"Start charging my car"๐ Project Structure
home_automation/
โโโ app/
โ โโโ config.py # Configuration settings
โ โโโ main.py # FastAPI server
โ โโโ mcp_server_stdio.py # FastMCP server with tools
โ โโโ stdio_config.py # MCP configuration helper
โ โโโ db/
โ โ โโโ schema.sql # Database schema
โ โ โโโ database.py # Database manager
โ โ โโโ seed_data.py # Sample devices
โ โโโ models/
โ โ โโโ device.py # Device models
โ โโโ schemas/
โ โ โโโ responses.py # API response schemas
โ โโโ utils/
โ โโโ websocket_manager.py # WebSocket manager
โโโ frontend/ # React dashboard
โโโ requirements.txt
โโโ home_automation.db # SQLite database (auto-created)
โโโ README.md
โโโ DEVELOPMENT.md # Development guide๐ง API Endpoints
REST API
GET /- API informationGET /api/devices- Get all devices (supports?room=and?type=filters)GET /api/rooms- Get list of roomsGET /api/stats- Get dashboard statisticsWebSocket /ws- Real-time device updates
WebSocket Messages
From Server:
{
"type": "device_update",
"device_id": "living_room_light_main",
"state": "on",
"properties": {"brightness": 75}
}
{
"type": "mode_change",
"mode": "away"
}
{
"type": "full_refresh"
}๐งช Testing
Test API Server
curl http://localhost:8000
curl http://localhost:8000/api/devices
curl http://localhost:8000/api/statsTest MCP Tools Directly
python app/mcp_server_stdio.pyTest with MCP Inspector
npx @modelcontextprotocol/inspector python app/mcp_server_stdio.pyOpen browser to: http://localhost:6274
๐ All Available Commands
Command | Purpose | URL |
| Menu-driven launcher | - |
| Start API server | |
| Start frontend | |
| Start MCP server | stdio only |
| Test with inspector | |
| Get Claude config | - |
๐ Real-time Updates Flow
AI assistant calls MCP tool (e.g.,
control_device)MCP server updates SQLite database with timestamp
FastAPI server detects timestamp change (polls every 100ms)
FastAPI broadcasts update via WebSocket to all connected clients
Frontend receives update and re-renders affected devices
Total latency: < 300ms
๐ Performance Metrics
โ Database queries: < 10ms
โ MCP tool execution: < 100ms
โ Change detection: 100ms polling
โ WebSocket broadcast: < 50ms
โ End-to-end update: < 300ms
โ Concurrent WebSocket connections: 100+
๐ Troubleshooting
MCP Server Not Connecting
Check Claude Desktop config file path
Verify Python path in configuration
Restart Claude Desktop after config changes
Frontend Not Updating
Verify FastAPI server is running on port 8000
Check browser console for WebSocket errors
Ensure CORS origins include your frontend URL
Database Locked Errors
Verify only one process is accessing the database at a time
WAL mode is enabled automatically in database.py
Port Already in Use
# Windows PowerShell - Kill process on port
Get-NetTCPConnection -LocalPort 8000 |
Select-Object -ExpandProperty OwningProcess |
ForEach-Object { Stop-Process -Id $_ -Force }๐ ๏ธ Development
Add New Device Type
Add device to
app/db/seed_data.pyUpdate type hints in
app/models/device.pyAdd icon in frontend
DeviceCard.jsx
Add New MCP Tool
Add
@mcp.tool()decorated function inapp/mcp_server_stdio.pyInclude database operations
Document in docstring for AI assistant context
For detailed development information, see DEVELOPMENT.md
๐ Resources
๐ License
MIT License - See LICENSE file for details
๐ค Contributing
Contributions welcome! Please open an issue or submit a pull request.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/balupeddireddy08/home_automation_mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server