Leneda能源MCP服务器
MCP服务器,用于通过Claude Desktop访问Leneda能源计量数据。
特性
- 详细时间序列:15分钟间隔测量
- 聚合数据:各时期的总计、平均值、峰值
- 友好名称:使用“active_power_export”而不是“1-1:2.29.0”
- 灵活的查询:多个聚合级别和转换模式
安装
cd ~/claudefiles/leneda-mcp-server
pip3 install -r requirements.txt配置
- 创建.env文件:
cp .env.example .env
nano .env- 添加您的凭据:
LENEDA_API_KEY=your-api-key
LENEDA_ENERGY_ID=your-energy-id
LENEDA_DEFAULT_METERING_POINT=your-metering-point-code- 测试它是否有效:
python3 test_server.py- 添加到克劳德桌面:
编辑: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"leneda-energy": {
"command": "python3",
"args": [
"/Users/marcdurbach/claudefiles/leneda-mcp-server/server.py"
],
"env": {
"LENEDA_API_KEY": "your-api-key",
"LENEDA_ENERGY_ID": "your-energy-id",
"LENEDA_DEFAULT_METERING_POINT": "your-metering-point"
}
}
}
}- 重新启动克劳德桌面
用法
问克劳德自然语言问题:
- “2025年1月我的总能耗是多少?”
- “显示我上周的平均每日发电量”
- “我昨天的峰值电力输出是多少?”
- “比较我1月和2月的消费情况”
可用工具
1.获取能源数据
获取15分钟间隔测量值。
参数:
obis_code(必填):测量类型start_datetime(必填):ISO格式(例如,“2024-01-01T00:00Z”)end_datetime(必填):ISO格式metering_point(可选):覆盖默认值
2.获取汇总的能源数据
获取不同时期的汇总数据。
参数:
obis_code(必填):测量类型start_date(必填):日期(例如,“2025-01-01”)end_date(必填):日期aggregation_level(可选):四分之一小时,小时,日,月,年,无限transformation_mode(可选):累积、平均、最大、最小metering_point(可选):覆盖默认值
3.双代码列表
列出所有可用的测量类型和使用提示。
OBIS代码
能量(kWh)
active_energy_import或1-1:1.8.0-能源消耗active_energy_export或1-1:2.8.0-发电量reactive_energy_import或1-1:3.8.0-被动导入reactive_energy_export或1-1:4.8.0-被动导出
功率(kW)
active_power_import或1-1:1.29.0-当前消耗量active_power_export或1-1:2.29.0-当前产量
聚合选项
等级:四分之一小时,小时,日,月,年,无限
模式:累积(总计)、平均值、最大值(峰值)、最小值
故障排除
服务器未在Claude中显示?
- 验证配置文件中的JSON语法
- 检查文件路径是否正确
- 查看日志:
~/Library/Logs/Claude/mcp*.log
API错误?
- 运行:
python3 test_server.py - 验证凭据
- 检查日期范围
没有数据?
- 确认Leneda门户中存在该期间的数据
- 尝试缩短时间范围
- 验证是否支持OBIS代码
例子
每月总消费量
"What was my total energy import for October 2024?"日平均值
"Show me average daily power production for last month"峰值分析
"What was my maximum power export in January?"比较
"Compare my consumption between January and February 2025"API 参考
详细端点
GET /api/metering-points/{code}/time-series
?startDateTime=2024-01-01T01:00:00Z
&endDateTime=2024-01-10T01:00:00Z
&obisCode=1-1:2.29.0聚合端点
GET /api/metering-points/{code}/time-series/aggregated
?startDate=2025-01-01
&endDate=2025-01-31
&obisCode=1-1:1.29.0
&aggregationLevel=Day
&transformationMode=Accumulation许可证
个人使用Claude Desktop。
支持
- Leneda API:联系Leneda支持
- MCP:https://modelcontextprotocol.io/
