strompreis-mcp

strompreis-mcp

MCP server that gives AI agents real-time German electricity price forecasts.

Category
访问服务器

README

⚡ Strompreis MCP — Electricity Price Forecast for AI Agents

Python ≥3.11 License: MIT Smithery

MCP server that gives AI agents real-time German electricity price forecasts.
Tells your smart home agent when to run the dishwasher, charge the car, or schedule power-hungry tasks.

Built for the Model Context Protocol — works with Claude Desktop, Cline, and any MCP-compatible client.


Architecture

                    ┌────────────────────────────┐
                    │    SMARD (Bundesnetzagentur) │
                    │    Live-Strompreise 15min    │
                    └──────────┬─────────────────┘
                               │ API
                    ┌──────────▼─────────────────┐
                    │   strompreis-collector       │
                    │   (Cron: every 15 min)       │
                    └──────────┬─────────────────┘
                               │ writes
                    ┌──────────▼─────────────────┐
                    │   SQLite Database             │
                    │   ~/.strompreis/strompreis.db │
                    │   ├── price_data (historical) │
                    │   ├── api_keys (auth)         │
                    │   └── usage_log (rate limit)  │
                    └──────────┬─────────────────┘
                               │ reads
              ┌────────────────┼────────────────┐
              │                │                 │
    ┌─────────▼──────┐  ┌─────▼──────┐  ┌──────▼─────────┐
    │  MCP Server     │  │  B2C Site   │  │  CLI Tools     │
    │  (stdio/SSE)    │  │  (FastAPI)  │  │  status/vacuum │
    │  price_forecast │  │  savings    │  │                 │
    │  best_hours     │  │  checker    │  │                 │
    │  db_status      │  │  affiliate  │  │                 │
    └─────────────────┘  └────────────┘  └─────────────────┘

Quick Start

1. Install

pip install strompreis-mcp

Or from source:

git clone https://github.com/DasClown/strompreis-mcp.git
cd strompreis-mcp
pip install -e .

2. Initialize database + first data collection

# Automatic setup
bash scripts/setup.sh

# Or manual:
strompreis-collector collect
strompreis-collector status

3. Add to Claude Desktop

Edit ~/.config/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "strompreis": {
      "command": "strompreis-mcp"
    }
  }
}

Or with Cline / any MCP client:

{
  "mcpServers": {
    "strompreis": {
      "command": "strompreis-mcp",
      "args": []
    }
  }
}

Tools

Tool Parameters Returns
price_forecast hours (1-72, default 24) JSON array: [{timestamp, price_ct, confidence, is_peak}]
best_hours count (default 3) Human-readable cheapest hours recommendation
db_status none Database health: rows, latest timestamp, usage stats

Example Prompts

"When is the cheapest time to run my laundry today?"
→ Agent calls best_hours(count=3) → "Tonight 00:00-02:00 at ~28 ct/kWh"

"What's the electricity price forecast for tomorrow?"
→ Agent calls price_forecast(hours=48) → hourly prices in ct/kWh

"Should I charge my EV now or wait?"
→ Agent calls price_forecast(hours=24), finds cheapest window

Database Persistence

The database lives at ~/.strompreis/strompreis.db. It persists:

Table Purpose Retention
price_data Historical SMARD prices + generation data Unlimited (for ML training)
api_keys Monetization: tier-based API access Manual expiration
usage_log Rate limiting + analytics Accumulates

Cron Setup (recommended)

# Fetch data every 15 minutes
*/15 * * * * cd /path/to/strompreis-mcp && strompreis-collector collect

# Weekly database maintenance (Sunday 03:00)
0 3 * * 0 cd /path/to/strompreis-mcp && strompreis-collector vacuum

Or use the provided crontab:

crontab deploy/crontab

CLI Commands

# Fetch + store latest SMARD data
strompreis-collector collect

# Show database health
strompreis-collector status
# → 📊 Strompreis DB Status
#     Total rows:     1,248
#     Latest data:    2026-06-30T21:00:00+00:00
#     DB file size:   180 KB

# Weekly maintenance
strompreis-collector vacuum

Deployment

systemd (production)

# Edit deploy/strompreis-mcp.service paths for your system, then:
sudo cp deploy/strompreis-mcp.service /etc/systemd/system/
sudo systemctl enable --now strompreis-mcp

# Monitor
journalctl -u strompreis-mcp -f

B2C Website (side-stream)

# Install dependencies
pip install strompreis-mcp[b2c]

# Run
python3 -m uvicorn b2c.server:app --host 0.0.0.0 --port 8080

Then open http://localhost:8080 — users enter their annual kWh consumption and get:

  • ✅ Savings calculation (fixed vs dynamic tariff)
  • ✅ Tibber/Awattar affiliate comparison
  • ✅ 24h price forecast snippet

Smithery

Smithery

One-click install for Claude Desktop via Smithery.

API Key Mode (for production)

By default the server runs in keyless mode (100 req/day global limit).
For production use, set an API key:

# Generate a key
python3 -c "
from strompreis_mcp.database import create_api_key
print(create_api_key('my-app', tier='pro', daily_limit=10000))
"

# Set it
export STROMPREIS_API_KEY=sp_your_key_here
strompreis-mcp

In keyed mode:

  • All requests validated against api_keys table
  • Per-key daily rate limiting
  • Usage logged to usage_log table

Data Sources

Source Provider API Data
Day-ahead auction prices SMARD (BNetzA) Open REST Live, 15-min resolution
Solar generation SMARD Chart API Live, hourly
Wind generation SMARD Chart API Live, hourly
Grid load SMARD Chart API Live, hourly

Planned for v0.3:

  • ENTSO-E Transparency (cross-border exchange, network constraints)
  • DWD BrightSky (weather: solar radiation, wind speed, temperature)
  • ML model (Random Forest on accumulated DB data)

License

MIT


Built by @DasClown — German electricity prices for AI agents.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选