Spaces:
Running
Running
File size: 7,180 Bytes
94a770b 1be7499 94a770b e6e66bc 94a770b 1be7499 e6e66bc 94a770b 1be7499 e6e66bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
---
title: PowerMCP - Power System Analysis MCP Server
emoji: ⚡
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 6.1.0
app_file: app.py
pinned: false
license: mit
tags:
- mcp
- power-systems
- electrical-engineering
- simulation
- model-context-protocol
---
# ⚡ PowerMCP - Power System Analysis MCP Server
[](https://modelcontextprotocol.io/)
[](https://gradio.app/)
[](https://opensource.org/licenses/MIT)
This is an **MCP-enabled Hugging Face Space** for **PowerMCP** - an open-source collection of Model Context Protocol (MCP) servers for power system software. This Space can be added as an MCP tool to Claude Desktop, Cursor, or any other MCP-compatible client with a single click!
## 🌟 What is PowerMCP?
PowerMCP enables Large Language Models (LLMs) to directly interact with power system applications through the Model Context Protocol. It bridges the gap between AI and power system analysis, facilitating:
- **Intelligent Power Flow Analysis**: Let AI perform complex power system simulations
- **Automated Contingency Analysis**: AI-driven evaluation of grid contingencies
- **Dynamic Simulation**: Transient stability and time-domain analysis
- **Energy System Optimization**: Network expansion and optimal power flow
- **Professional Report Generation**: AI-generated analysis reports
## 🔧 Supported Power System Tools
### 🔌 pandapower
Python-based power system analysis focusing on power flow and contingency analysis.
- Create and manage power networks
- AC/DC power flow calculations
- N-1 and N-2 contingency analysis
- Network modification and optimization
### ⚡ PyPSA (Python for Power System Analysis)
Energy system optimization and network expansion planning.
- Multi-period optimization
- Unit commitment and economic dispatch
- Network expansion planning
- Renewable integration analysis
### 🌊 ANDES
Dynamic simulation and transient stability analysis.
- Time-domain simulation
- Transient stability analysis
- Small-signal stability
- Dynamic model library
## 🚀 Quick Start
### Option 1: Install from GitHub (Local MCP Server)
```bash
# Install PowerMCP
pip install git+https://github.com/Power-Agent/PowerMCP.git
# Configure Claude Desktop (macOS)
# Edit: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"pandapower": {
"command": "powermcp-pandapower"
}
}
}
# Restart Claude Desktop and start using PowerMCP!
```
See [INSTALL.md](INSTALL.md) for detailed installation instructions.
### Option 2: Use Hugging Face Space as MCP Tool
1. **Install an MCP Client**:
- [Claude Desktop](https://claude.ai/download)
- [Cursor](https://cursor.sh/)
- [Windsurf](https://codeium.com/windsurf)
- VS Code with Cline extension
2. **Add PowerMCP to Your Client**:
- Click the **MCP badge** on this Space
- Select "Add to MCP tools"
- Confirm when prompted
- The tools will be available instantly in your MCP client!
3. **Use PowerMCP in Your AI Assistant**:
```
Ask Claude: "Create a power network and run power flow analysis"
Ask Cursor: "Load test_case.json and perform N-1 contingency analysis"
```
### Option 2: Use Web Interface
1. Select a power system tool (pandapower, PyPSA, or ANDES)
2. Click "List Available Tools" to see all functions
3. Enter the tool name and arguments in JSON format
4. Click "Execute Tool" to run
5. View results in JSON format
## 📖 Example Usage
### In MCP Clients (Claude Desktop, Cursor, etc.)
```python
# Create and analyze a power network
create_empty_network(server="pandapower")
load_network(file_path="test_case.json", server="pandapower")
run_power_flow(server="pandapower", algorithm="nr")
get_network_info(server="pandapower")
# Run contingency analysis
run_contingency_analysis(
server="pandapower",
contingency_type="N-1",
elements=["line", "trafo"]
)
# PyPSA optimization
create_network(name="my_network", server="pypsa")
add_bus(network_name="my_network", bus_id="bus1", v_nom=380.0, server="pypsa")
run_optimization(network_name="my_network", server="pypsa")
# ANDES dynamic simulation
run_power_flow(file_path="kundur_full.json", server="andes")
run_time_domain_simulation(
file_path="kundur_full.json",
end_time=10.0,
step_size=0.01,
server="andes"
)
```
### In Web Interface
#### Create an Empty Network
```json
Tool Name: create_empty_network
Arguments: {}
```
#### Load a Network
```json
Tool Name: load_network
Arguments: {"file_path": "PowerMCP/pandapower/test_case.json"}
```
#### Run Power Flow
```json
Tool Name: run_power_flow
Arguments: {"algorithm": "nr"}
```
## 🎯 Available Tools by Server
### pandapower Tools
- `create_empty_network()` - Create new empty network
- `load_network(file_path)` - Load from JSON/pickle
- `run_power_flow(algorithm, ...)` - Power flow analysis
- `run_contingency_analysis(contingency_type, elements)` - N-1/N-2 analysis
- `get_network_info()` - Network statistics
### PyPSA Tools
- `create_network(name, snapshots, crs)` - Create PyPSA network
- `add_bus(network_name, bus_id, v_nom, x, y, carrier)` - Add bus
- `add_generator(network_name, generator_id, bus, p_nom, ...)` - Add generator
- `run_optimization(network_name)` - Optimal power flow
- `get_network_info(network_name)` - Network information
### ANDES Tools
- `run_power_flow(file_path)` - Power flow with ANDES
- `run_time_domain_simulation(file_path, end_time, step_size)` - Dynamic simulation
- `get_bus_results()` - Bus voltage/angle results
## 💻 Development
### Deploy Your Own Space
1. Fork this repository
2. Create a new Space on [Hugging Face](https://huggingface.co/new-space)
3. Choose Gradio SDK and link your repository
4. The Space will automatically get the MCP badge!
### Running Locally
```bash
git clone https://github.com/Power-Agent/PowerMCP.git
cd PowerMCP
pip install -r requirements.txt
python app.py
```
### Local MCP Configuration
For Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
```json
{
"mcpServers": {
"pandapower": {
"command": "/usr/local/bin/python3",
"args": ["/path/to/PowerMCP/PowerMCP/pandapower/panda_mcp.py"]
}
}
}
```
## 🔗 Resources
- **GitHub**: [Power-Agent/PowerMCP](https://github.com/Power-Agent/PowerMCP)
- **MCP Docs**: [modelcontextprotocol.io](https://modelcontextprotocol.io/)
- **Tutorial**: [PowerMCP Tutorial](https://github.com/Power-Agent/PowerMCP/blob/main/PowerMCP_Tutorial.pdf)
- **Gradio MCP Guide**: [Building MCP Servers](https://www.gradio.app/guides/building-mcp-server-with-gradio)
## 🎥 Video Demos
- [Contingency Evaluation](https://www.youtube.com/watch?v=MbF-SlBI4Ws)
- [Load Growth Evaluation](https://www.youtube.com/watch?v=euFUvhhV5dM)
## 📄 License
MIT License - See [LICENSE](LICENSE) file for details
## 🤝 Contributing
Contributions welcome! PowerMCP is community-driven. Help us accelerate AI adoption in power systems.
---
Built with ❤️ by the PowerMCP Community |