MCP Energy Hub

MCP Energy Hub

Provides real-time US power grid intelligence and carbon intensity data to enable carbon-aware AI compute scheduling across major grid regions. It allows users to monitor energy generation and optimize workloads based on renewable energy availability and grid load forecasts.

Category
Visit Server

README

<div align="center">

⚑ MCP Energy Hub

Real-Time Energy Grid Intelligence for Carbon-Aware AI

Python 3.11+ MCP Protocol FastAPI License: MIT

GitHub Stars GitHub Forks

Enterprise-grade MCP server providing real-time US power grid intelligence for carbon-aware AI compute scheduling

πŸ“– Documentation β€’ πŸš€ Quick Start β€’ 🀝 Contributing β€’ πŸ“œ License

</div>


🎯 The Problem

AI compute is exploding, but the grid isn't always green.

  • Data centers consume 1-2% of global electricity and growing rapidly
  • AI training runs can emit as much CO2 as 5 cars over their lifetime
  • Most AI workloads run without awareness of grid carbon intensity
  • Enterprises lack tools to schedule compute when renewables are high

πŸ’‘ The Solution

MCP Energy Hub is an enterprise-grade MCP server that gives AI agents real-time visibility into the US power grid, enabling carbon-aware compute scheduling.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    πŸ€– AI Agent (Claude, etc.)                    β”‚
β”‚                              β”‚                                   β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        β”‚
β”‚                    β”‚   MCP Protocol    β”‚                        β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚
β”‚                              β”‚                                   β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚              β”‚      ⚑ MCP Energy Hub         β”‚                  β”‚
β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚                  β”‚
β”‚              β”‚  β”‚ 8 MCP Tools for Energy  β”‚  β”‚                  β”‚
β”‚              β”‚  β”‚ Grid Intelligence       β”‚  β”‚                  β”‚
β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚                  β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β”‚                              β”‚                                   β”‚
β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚    β–Ό             β–Ό           β–Ό           β–Ό             β–Ό       β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”       β”‚
β”‚ β”‚ERCOTβ”‚     β”‚CAISOβ”‚     β”‚ PJM β”‚     β”‚NYISOβ”‚     β”‚MISO β”‚       β”‚
β”‚ β”‚Texasβ”‚     β”‚Califβ”‚     β”‚ Mid β”‚     β”‚ NY  β”‚     β”‚Midwest      β”‚
β”‚ β””β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”˜       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

Feature Description
🌍 7 Grid Regions ERCOT, CAISO, PJM, NYISO, MISO, SPP, ISONE
⚑ Real-Time Data Live from EIA (US Energy Information Administration)
🌱 Carbon Intensity kg CO2/MWh for each region, updated hourly
πŸ”‹ Generation Mix Natural gas, coal, nuclear, wind, solar, hydro
🏒 Data Center Tracking Energy estimates, PUE, AI workload impact
🎯 Smart Scheduling Find the greenest region for your compute
πŸ“Š AI Impact KPIs Track AI's share of grid load
πŸ”Œ MCP Native Full Model Context Protocol support

πŸ› οΈ MCP Tools

8 Tools for Energy Intelligence

Tool Description Use Case
get_grid_realtime Real-time grid metrics Monitor current load & generation
get_grid_carbon Carbon intensity + recommendation Carbon-aware scheduling
get_grid_forecast Load & carbon forecast Plan future workloads
list_grid_regions Available grid regions Discover coverage
get_data_centers Data center info Track facilities
get_data_center_energy Energy consumption estimates Audit energy use
get_ai_impact AI compute KPIs Measure AI's grid footprint
get_best_region_for_compute Find greenest region Optimize for carbon/cost

Example: Carbon-Aware Scheduling

# AI Agent asks: "Where should I run this training job?"

result = mcp.call_tool("get_best_region_for_compute", {
    "optimize_for": "carbon"
})

# Response:
{
    "recommendation": "CAISO",
    "reason": "Lowest carbon intensity at 180 kg CO2/MWh",
    "rankings": [
        {"region": "CAISO", "carbon": 180, "renewable_pct": 45},
        {"region": "ERCOT", "carbon": 320, "renewable_pct": 28},
        {"region": "PJM", "carbon": 420, "renewable_pct": 12}
    ]
}

πŸš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/your-username/mcp-energy-hub.git
cd mcp-energy-hub

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env and add your EIA_API_KEY

Run the Server

# Start the FastAPI server
python -m uvicorn app.main:app --reload --port 8000

# Or run the standalone MCP server (for Claude Desktop)
python mcp_server.py

Try the API

# Get carbon intensity for Texas grid
curl -X POST http://localhost:8000/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{"name": "get_grid_carbon", "arguments": {"region_id": "ERCOT"}}'

Example Response

{
  "success": true,
  "result": {
    "region_id": "ERCOT",
    "timestamp": "2024-11-28T22:00:00Z",
    "carbon_intensity_kg_per_mwh": 320.5,
    "renewable_fraction_pct": 28.3,
    "recommendation": "Good - Moderate carbon intensity"
  }
}

Connect to Claude Desktop

Add to your Claude Desktop MCP settings (claude_desktop_config.json):

{
  "mcpServers": {
    "energy-hub": {
      "command": "python",
      "args": ["/absolute/path/to/mcp-energy-hub/mcp_server.py"],
      "env": {
        "EIA_API_KEY": "your-api-key-here"
      }
    }
  }
}

πŸ“Š API Endpoints

Endpoint Method Description
/docs GET Interactive Swagger UI
/mcp/info GET MCP server information
/mcp/tools GET List all MCP tools
/mcp/tools/call POST Execute an MCP tool
/grid/regions GET List grid regions
/grid/{region}/realtime GET Real-time metrics
/grid/{region}/carbon GET Carbon intensity
/health GET Health check

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     MCP Energy Hub                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   FastAPI    β”‚  β”‚  MCP Server  β”‚  β”‚  Data Ingestion  β”‚ β”‚
β”‚  β”‚   REST API   β”‚  β”‚  (8 Tools)   β”‚  β”‚  (EIA Collector) β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚         β”‚                 β”‚                    β”‚           β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚                           β”‚                                β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                        β”‚
β”‚                    β”‚  SQLite DB  β”‚                        β”‚
β”‚                    β”‚ Grid Metricsβ”‚                        β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                    External Data Sources                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚   EIA   β”‚  β”‚  ERCOT  β”‚  β”‚  CAISO  β”‚  β”‚   PJM   β”‚      β”‚
β”‚  β”‚   API   β”‚  β”‚   API   β”‚  β”‚   API   β”‚  β”‚   API   β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🌍 Real-World Impact

For Enterprises

  • Reduce carbon footprint by scheduling AI workloads during high-renewable periods
  • Cost optimization by running compute when energy prices are low
  • ESG reporting with accurate AI energy consumption data

For AI Developers

  • Carbon-aware training - Train models when the grid is green
  • Transparent impact - Know your model's carbon footprint
  • Automated scheduling - Let AI agents make green decisions

Potential Impact

  • If 10% of AI workloads shifted to low-carbon periods: ~500,000 tons CO2/year saved
  • Real-time visibility enables 30-50% carbon reduction for flexible workloads

πŸ”§ Tech Stack

Component Technology
Backend FastAPI, Python 3.11
Database SQLite (HF) / PostgreSQL (Production)
MCP Protocol Native implementation
Data Source EIA Open Data API
Deployment Docker, Hugging Face Spaces

πŸ“ Project Structure

mcp-energy-hub/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py              # FastAPI application
β”‚   β”œβ”€β”€ config.py            # Configuration
β”‚   β”œβ”€β”€ api/routes/          # REST endpoints
β”‚   β”œβ”€β”€ mcp/                  # MCP server implementation
β”‚   β”‚   β”œβ”€β”€ server.py        # MCP protocol handler
β”‚   β”‚   β”œβ”€β”€ tools.py         # Tool definitions
β”‚   β”‚   └── routes.py        # HTTP MCP endpoints
β”‚   β”œβ”€β”€ ingestion/           # Data collectors
β”‚   β”‚   └── eia_collector.py # EIA API integration
β”‚   └── models/              # Database models
β”œβ”€β”€ mcp_server.py            # Standalone MCP server (stdio)
β”œβ”€β”€ Dockerfile               # HuggingFace deployment
└── README.md                # This file

οΏ½ Docker Deployment

# Build the Docker image
docker build -t mcp-energy-hub .

# Run the container
docker run -p 8000:8000 -e EIA_API_KEY=your-key mcp-energy-hub

πŸ§ͺ Testing

# Run tests
pytest

# Run with coverage
pytest --cov=app --cov-report=html

🀝 Contributing

Contributions are welcome! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ™ Acknowledgments

  • Anthropic - For creating the MCP protocol
  • EIA - For open energy data APIs
  • FastAPI - For the excellent web framework

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ”— Links


<div align="center">

Made with ❀️ for sustainable AI

Helping AI compute become carbon-aware, one query at a time ⚑🌱

⭐ Star this repo if you find it useful!

</div>

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured