jtwirly
MCP Serverjtwirlypublic

smarthomemcp

基于模型上下文协议 (MCP) 的分布式系统,用于智能家庭能源管理。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Python
Language
-
License

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

  1. Energy Prediction MCP

    • Predicts energy usage for the next 6 hours
    • Uses machine learning models trained on historical data
    • Endpoint: localhost:8002
  2. Energy Bills MCP

    • Analyzes and processes energy billing data
    • Tracks historical energy costs
    • Endpoint: localhost:8001
  3. Price Analysis MCP

    • Analyzes energy pricing patterns
    • Predicts optimal usage times
    • Endpoint: localhost:8003
  4. Weather MCP

    • Integrates weather data
    • Helps predict weather-based energy needs
    • Endpoint: localhost:8004

Future Tools

  1. Device Control MCP

    • Smart device management
    • Automated energy optimization
    • Endpoint: localhost:8005
  2. Occupancy Detection MCP

    • Monitors home occupancy patterns
    • Optimizes energy use based on presence
    • Endpoint: localhost:8006
  3. 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

  1. Clone the repository:
git clone <repository-url>
cd mit-mcp-hackathon
  1. Install dependencies for each service:
# For each MCP service
cd <service-name>_mcp
pip install -r requirements.txt

Usage

  1. Start the orchestrator:
cd orchestrator_mcp
python server.py
  1. 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

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. 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

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

MIT License

Quick Start

1

Clone the repository

git clone https://github.com/jtwirly/smarthomemcp
2

Install dependencies

cd smarthomemcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerjtwirly
Reposmarthomemcp
LanguagePython
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation