sens-mcp
sens-mcp
用于 SENS Energy API 的 MCP(Model Context Protocol)服务器和开发者入门套件——波兰电力市场数据 API(内容包括:配电运营商、电价方案等)。
它解决了 LLM 和 AI 智能体(Claude Desktop、Cursor、LangChain、n8n……)在调用该 API 时遭遇的“冷启动”问题:波兰能源市场拥有自有一整套话术code(OSD 与 sprzedawca 之分、电价组 G11/G12/G12w/...),而模型并不能默认知道这些;同时原始 REST 响应又过于庞大,手动对照计算极易出错。
sens-mcp 提供以下能力:
零样本可发现性:通过一个 MCP 资源(
sens://market/cheat-sheet表和发现工具(resolve_operator、search_tariffs),让模型在不到 ~400 个 token 内掌握市场术语。可操作的自我修正:工具出错时返回带建议的结构化 JSON(比如
did you mean G12W?),而不是朴素的原始 HTTP 错误;因此处于 ReAct 循环里的智能体可以在下一次调用中自行修正。单一事实来源的计算:价格/电量的计算都在 SENS 的排布之后完成;本工具包绝不在客户端重新推导总需。
非阻塞启动:服务器挂在打入内嵌的备用市场 schema 后即可快速就绪;实时电价数据在后台刷新。
快速开始
使用 uvx 运行(推荐,无需安装)
export SENS_API_KEY=sens_live_your_key_here
uvx sens-mcp或 pip 安装
pip install sens-mcp
export SENS_API_KEY=sens_live_your_key_here
python -m sens_mcp环境变量
变量 | 必需 | 默认值 | 说明 |
| 是 | — | 你的 SENS API key。以 |
| 否 |
| 用于 staging/自托管部署时覆盖基础地址。 |
Related MCP server: US ISO Grid MCP
与 AI 智能体配合使用
Claude Desktop
将以下配置添加到 claude_desktop_config.json(参考 configs/claude_desktop_config.json):
{
"mcpServers": {
"sens-energy": {
"command": "uvx",
"args": ["sens-mcp"],
"env": {
"SENS_API_KEY": "sens_live_your_key_here"
}
}
}
}Cursor
将以下配置添加到 .cursor/mcp.json(参考 [configs/cc_urse_cc_mcck.crc}`)——格式与上面相同。
暴露的工具
工具 | 说明 |
| 对城市或公司名称做模糊匹配(可容忍错字),解析为 API 所要求的精确 |
| 查出一个客户类型(家庭 / 小企业 / 工业)可用的有效电价代码。 |
| 获取综合电价及费率构成明细;传入 |
| 查看某个电价方案经 URE 批准的列有固定/变动费率构成。 |
资源接口:sens://market/cheat-sheet —— 一个 Markdown 格式的电价方案速查,涵盖了波兰电力市场词汇(OSD、电价组、电价构成)。
开发者示例
直接调用 SENS REST API 的独立代码片段:
examples/python/async_ream.py— 通过since做增量 sync
API 参考(要点)
基础 URL:
https://api.get_sens.energy认证:以
X-API-KEY: <your key>这个请求头发送(不是 Bearer,也不是查询参数)。GET /api/v1/prices(参数):osd,sprzedawca,taryfa,market,date,annual_kwh,region,since,page,size。。GET /api/v1/tariffs——sinciding/If-Modified-Since用于增量查询,page、size。GET /api/v1/tariffs/components?tariff_id=.... — 单tarrif 的构成明细,也支持since。
完整 Swagger/OpenAPI 文档:https://api.get_sens.energy/api/docs。
完整开发者文档(快速入门、MCP 集成指南、市场术语):[arc] [docs.getsens.energy `。
开发
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest测试使用 respx mock 了所有 HTTP 调用——其中默认测试套件不会碰触任何真实 API。
Live integration suite(可选)
tests/test_live_integration.py 会在真实 MCP stdio 协议上把真实服务器作为子进程跑起来,向真实生产 SENS API 发起调用,并检查 MCP 工具返回与 httpx 直接请求到同一端点之间的逐字节一致性。默认排除掉;只有提供真实 key 才显式运行:
SENS_API_KEY=<a real key> pytest -m live tests/test_live_integration.py -vLicense
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
- AlicenseNot gradedqualityDmaintenanceProvides AI agents with structured access to the U.S. EIA Open Data API for energy data including power plants, operations, fuel prices, projections, and state CO2 emissions.MIT
- AlicenseNot gradedqualityCmaintenanceEnables real-time access to US electricity generation, fuel mix, and demand data through natural language queries.8MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to access and analyze Spanish electricity consumption data via the Datadis API, providing tools for supply management, consumption analysis, anomaly detection, and executive reporting.MIT
- AlicenseAqualityAmaintenanceEnables querying Tibber electricity prices, forecasts, consumption data, cheapest hours, and live Pulse measurements through natural language.7MIT
Related MCP Connectors
Real-time electricity prices for AI agents. 40+ countries, 100+ zones. No auth required.
Verified Polish open data for AI agents: debt, budget, 460 MPs, votings, judiciary search, RAG.
European day-ahead electricity prices (43 zones), accuracy-published forecasts, carbon, optimize.
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/SofiaFlux/sens-toolkit'
If you have feedback or need assistance with the MCP directory API, please join our Discord server