
smarthomemcp
基于模型上下文协议 (MCP) 的分布式系统,用于智能家庭能源管理。
Repository Info
About This Server
基于模型上下文协议 (MCP) 的分布式系统,用于智能家庭能源管理。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Smart Home Energy Management System
A distributed system using Model Context Protocol (MCP) for intelligent home energy management.
Overview
This system uses multiple microservices (MCPs) to analyze, predict, and optimize home energy usage:
Core Services
-
Energy Prediction MCP
- Predicts energy usage for the next 6 hours
- Uses machine learning models trained on historical data
- Endpoint:
localhost:8002
-
Energy Bills MCP
- Analyzes and processes energy billing data
- Tracks historical energy costs
- Endpoint:
localhost:8001
-
Price Analysis MCP
- Analyzes energy pricing patterns
- Predicts optimal usage times
- Endpoint:
localhost:8003
-
Weather MCP
- Integrates weather data
- Helps predict weather-based energy needs
- Endpoint:
localhost:8004
Future Tools
-
Device Control MCP
- Smart device management
- Automated energy optimization
- Endpoint:
localhost:8005
-
Occupancy Detection MCP
- Monitors home occupancy patterns
- Optimizes energy use based on presence
- Endpoint:
localhost:8006
-
Regulations MCP
- Ensures compliance with energy regulations
- Monitors energy usage limits
- Endpoint:
localhost:8007
Orchestrator
The MCP Orchestrator (port 8000) coordinates between all services, providing:
- Single service predictions
- Aggregated predictions from multiple services
- Error handling and service health monitoring
- Asynchronous request processing
Installation
- Clone the repository:
git clone <repository-url>
cd mit-mcp-hackathon
- Install dependencies for each service:
# For each MCP service
cd <service-name>_mcp
pip install -r requirements.txt
Usage
- Start the orchestrator:
cd orchestrator_mcp
python server.py
- Start individual services:
# In separate terminals
cd energy_prediction_mcp
python server.py
cd energy_bills_mcp
python server.py
# ... and so on for other services
API Documentation
Orchestrator Endpoints
1. Single Service Prediction
POST http://localhost:8000/predict/
{
"service": "energy_prediction",
"data": {
"past_24_hours": [1.2, 1.3, ...] // 24 values
}
}
2. Aggregated Predictions
POST http://localhost:8000/aggregate-predictions/
{
"past_24_hours": [1.2, 1.3, ...] // 24 values
}
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
License
MIT License
The orchestrator expects MCP services to be running on the following ports:
- Energy Bills MCP: 8001
- Energy Prediction MCP: 8002
- Price Analysis MCP: 8003
- Weather MCP: 8004
- Device Control MCP: 8005
- Occupancy Detection MCP: 8006
- Regulations MCP: 8007
You can modify these in server.py if needed.
Usage
Start the server:
python server.py
The server will run on http://localhost:8000 by default.
API Endpoints
1. Single Service Prediction
POST /predict/
Request body:
{
"service": "energy_prediction",
"data": {
"past_24_hours": [1.2, 1.3, ...] // 24 values
}
}
Response:
{
"predictions": [1.5, 1.6, ...], // 6-hour predictions
"service": "energy_prediction"
}
2. Aggregated Predictions
POST /aggregate-predictions/
Request body:
{
"past_24_hours": [1.2, 1.3, ...] // 24 values
}
Response:
{
"aggregated_predictions": [1.5, 1.6, ...] // Averaged predictions
}
Error Handling
The API returns appropriate HTTP status codes:
- 404: Service not found
- 400: Invalid request data
- 500: Internal server error or service unavailable
Dependencies
- FastAPI
- Uvicorn
- HTTPX
- Pydantic
- Python-dotenv
- Asyncio
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
License
MIT License
Quick Start
Clone the repository
git clone https://github.com/jtwirly/smarthomemcpInstall dependencies
cd smarthomemcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.