energy-mcp
energy-mcp
米国電力需要と気象データのためのMCPサーバーです。データをMCPツール、リソース、プロンプトとして公開し、stdio上でローカルに実行され、任意のMCPクライアント(Claude Desktop、Claude Code、LangChainのMCPアダプター、MCP Inspector)と連携します。
データは実際の観測値を含む小さなSQLiteファイルとして提供されるため、リポジトリをクローンしてデータベースやAPIキーなしで実行できます。
Python 3.11+ · MCP SDK 1.x (FastMCP) · MIT
MCPとは
MCPはAnthropicによるオープンプロトコルです。AIクライアントに、アプリごとのカスタム統合ではなく、外部ツールを呼び出し外部データを読み取るための標準的な方法を1つ提供します。サーバーは提供内容を通知し、クライアントは接続して使用します。サーバーは以下の3つを提供できます:
ツール: モデルが呼び出せる関数。
リソース: クライアントがコンテキストとして読み込む読み取り専用コンテンツ。
プロンプト: ユーザーが選択できる再利用可能なテンプレート。
このサーバーはこれら3つすべてを提供します。
Related MCP server: euenergy-mcp
ツール、リソース、プロンプト
ツール:
list_regions(): 利用可能な地域と、行数および日付範囲。query_demand(region, start, end, limit=168): 指定された日付範囲の1時間ごとの需要(MWh)。daily_demand(region, start, end): 日ごとの平均、ピーク、最小値。peak_demand(region, start, end): 最も需要が高かった1時間。compare_regions(start, end, regions=None): 地域間の平均とピーク。demand_vs_weather(region, start, end): 日ごとの需要とその地域の気温を結合。
リソース:
schema://energy: テーブルのプレーンな説明。docs://coverage: 現在読み込まれている地域と日付。
プロンプト:
analyze_demand(region): ツールを通じて地域を調査するスターター。
クイックスタート
uvが必要です。
git clone https://github.com/visethchapman/energy-mcp
cd energy-mcp
uv run energy-mcp # starts the server on stdio; it waits for a clientUIでツールを試すには、MCP Inspectorを使用します:
uv run mcp dev src/energy_mcp/server.pyクライアントに接続する
Claude Desktop
以下をclaude_desktop_config.json(macOSでは~/Library/Application Support/Claude/claude_desktop_config.json)に追加し、Claude Desktopを再起動します:
{
"mcpServers": {
"energy": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/energy-mcp", "run", "energy-mcp"]
}
}
}Claude Code
claude mcp add energy -- uv --directory /absolute/path/to/energy-mcp run energy-mcpその後、平易な言葉で質問すると、クライアントがツールを選択します:
「2024年7月に平均需要が最も高かった米国グリッドは?」
「2024年にERCOTのピークはいつで、その日のヒューストンはどのくらい暑かった?」
「1月の最初の週のCISOとPJMの需要を比較して。」
出力例
クライアントがツールを呼び出したときの、バンドルされたデータからの実際の結果:
> peak_demand(region="ERCO", start="2024-01-01", end="2024-12-31")
{ "region": "ERCO", "period": "2024-08-20 23:00:00", "demand_mwh": 85544.0 }
> compare_regions(start="2024-07-01", end="2024-07-31")
[ {"region":"PJM", "avg_mwh":109674.4, "peak_mwh":153121.0},
{"region":"ERCO", "avg_mwh": 60200.6, "peak_mwh": 81200.0},
{"region":"CISO", "avg_mwh": 32008.4, "peak_mwh": 44727.0},
{"region":"NYIS", "avg_mwh": 21494.1, "peak_mwh": 28990.0} ]
> demand_vs_weather(region="ERCO", start="2024-07-01", end="2024-07-03")
[ {"day":"2024-07-01", "avg_mwh":67736.3, "tmax_c":37.8, "tmin_c":26.7},
{"day":"2024-07-02", "avg_mwh":68463.9, "tmax_c":36.1, "tmin_c":27.2},
{"day":"2024-07-03", "avg_mwh":68017.8, "tmax_c":34.4, "tmin_c":26.7} ]demand_vs_weatherが興味深いものです。ERCOTの需要は夏のヒューストンの気温とともに上昇し(エアコンの負荷)、ツールは両方の系列を返すため、モデルがその関連性を指摘できます。
データ
すべて実際のデータで、ファイルサイズを約5MBに抑えるため2024暦年にトリミングされています。
テーブル | ソース | 行数 |
| EIA Open Data API、4つのバランシングオーソリティ:ERCO、CISO、PJM、NYIS | ∼35k |
| NOAA GHCN-Daily、各地域の主要負荷ゾーン近くの1つの観測所 | ∼1.5k |
| NOAA観測所メタデータ | 4 |
| テーブルドキュメント | 3 |
SQLiteファイルはコミットされているため、実行時に何も取得されません。再構築するか、日付範囲を広げるには(無料のEIA APIキーが必要):
uv run --extra build python scripts/build_sample_db.py --start 2023-01-01 --end 2024-12-31ENERGY_MCP_DBを設定して、サーバーが別のSQLiteファイルを指すようにします。
安全性
読み取り専用。データベースはSQLite
mode=roで開かれるため、どのツールも書き込めません。パラメータ化されたSQL。引数はパラメータとしてバインドされ、クエリ文字列にフォーマットされないため、SQLインジェクションはできません。
検証済みの入力。地域と日付の引数はデータベースに到達する前にチェックされ、不正な入力はモデルが対処できる明確なエラーとして返されます。
実行にシークレットは不要。データはリポジトリ内にあり、EIAキーは再構築にのみ必要です。
開発
uv run pytest
uv run mcp dev src/energy_mcp/server.pyレイアウト:
src/energy_mcp/
server.py # FastMCP server: tools, resources, prompts
db.py # read-only SQLite access
data/energy_sample.sqlite # bundled real data
scripts/build_sample_db.py # how the sample was assembled
tests/test_tools.pyこのプロジェクトはMCP 1.x SDK(FastMCP API)を使用しており、これは現在のClaude Desktopドキュメントとmcp CLIが使用しているものです。2.x SDKは新しい再設計版です。
関連
energy-text2sqlは、同じEIAおよびNOAAデータに対するテキストからSQLへのエージェントです。同じデータ、異なるインターフェース:質問に答えるためにSQLを書くものと、このサーバーがデータをMCPツールとして提供するものです。
ライセンス
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA production-ready Python MCP server providing tools for fetching live weather data, querying local SQLite databases, reading files, summarizing webpages, and performing safe mathematical calculations. It enables MCP-compatible LLM clients to execute these tasks autonomously as part of agentic workflows.
- Flicense-qualityBmaintenanceA read-only MCP server that exposes European day-ahead electricity prices for ~41 bidding zones via tools like hourly prices, cheapest hours, current price, and cross-zone summary, enabling AI agents to query energy market data.
- Alicense-qualityCmaintenanceA no-API-key-required MCP server that wraps Open-Meteo APIs to provide geocoding and weather forecast data, enabling city lookups and multi-day forecasts through tools, resources, and prompts.MIT
- FlicenseAqualityCmaintenanceAn MCP server that exposes the U.S. Energy Information Administration (EIA) Open Data API, enabling LLMs to browse and query energy data across 17 datasets with generic, composable tools.4
Related MCP Connectors
Hosted MCP server exposing US hospital procedure cost data to AI assistants
GibsonAI MCP server: manage your databases with natural language
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/visethchapman/energy-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server