EG4 Entra MCP Lab
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@EG4 Entra MCP LabShow me the current power flow and battery status for my inverter."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
EG4 Entra MCP Lab
A security-focused Model Context Protocol lab for an EG4 inverter. It replaces copied API keys at the MCP boundary with Microsoft Entra authentication and demonstrates three distinct authorization patterns:
Direct delegated access from a signed-in MCP client to Gateway API A.
True OAuth On-Behalf-Of (OBO) from Gateway A to Energy API B.
Application-only read access for a bounded automation client.
The final Energy API to EG4 Monitor hop uses a server-held EG4 portal credential because EG4 does not publish user-delegated OAuth. That hop is deliberately documented as service-credential access, not OBO.
Safety status
EG4 mode defaults to deterministic mock data.
Real cloud mode requires an explicit inverter serial allowlist.
All writes default to disabled: ENERGY_CONTROL_ENABLED=false.
Quick charge uses a short-lived plan/commit operation with state-drift detection.
No generic register-write, arbitrary HTTP, or shell tool is exposed.
EG4 and Entra credentials must never be put in Git, prompts, MCP arguments, logs, or browser storage.
Related MCP server: EG4 MCP Server
Architecture
VS Code/public client -- delegated token (aud=A) --> MCP Gateway A :8930
|
| Entra OBO
v
Energy API B :8931
|
| EG4 portal session
v
EG4 Monitor private APIOnly Gateway A has a host port. API B is reachable only on the Compose network and still validates its own Entra audience and permissions.
Entra applications
Provisioning creates four single-tenant applications:
App | Type | Permission |
EG4 Lab Interactive Client | Public native client | delegated Mcp.Read, optional Mcp.Control to A |
EG4 Lab MCP Gateway | Confidential API A | exposes MCP scopes; OBO client of B |
EG4 Lab Energy API | Resource API B | delegated Energy.Read/Energy.Control; app role Energy.Read.All |
EG4 Lab Automation Reader | Confidential daemon | B application role Energy.Read.All only |
See docs/architecture.md and docs/entra-setup.md.
For the verified security properties, live validation evidence, failure modes, and operational lessons, see docs/security-learnings.md.
MCP tools
whoami: inspect sanitized Entra authorization claims
list_inverters: read allow-listed plants/inverters
get_current_state: power flow, SOC, battery, online and quick-charge state
plan_quick_charge: no mutation
plan_stop_quick_charge: no mutation
commit_operation: mutation only when every server-side gate passes
Local mock development
Copy-Item .env.example .env
# In .env only for isolated local testing:
# GATEWAY_AUTH_DISABLED=true
# ENERGY_AUTH_DISABLED=true
# ENERGY_EG4_MODE=mock
# Create an empty ignored secrets/mock_gateway.pem only for mock Compose startup.
uv sync --extra dev
uv run pytestA local test MCP bearer is intentionally fixed as local-test-token; it is accepted only with mock auth explicitly enabled.
Container deployment
Copy
.env.exampleto a server-only.envand fill in only the documented identifiers and policy values.Run
scripts/new_gateway_certificate.ps1, upload onlygateway.crt.pemwith the provisioning script, and mount only the ignored privategateway.peminto Gateway A. Seedocs/entra-setup.md.Install EG4 credentials interactively with
scripts/install_eg4_credentials.sh; the secret directory is an optional first argument.Generate ignored
certs/eg4-gateway.crtandcerts/eg4-gateway.keyfiles with SANs for the published hostname. Trust only the public certificate on the client.Keep
ENERGY_EG4_MODE=mockandENERGY_CONTROL_ENABLED=falsefor the first deployment, then rundocker compose up -d --build.Verify
https://127.0.0.1:8930/healthzand the RFC 9728 metadata route. SetGATEWAY_BIND_ADDRESS,GATEWAY_PUBLIC_BASE_URL, andGATEWAY_ALLOWED_HOSTSexplicitly before publishing to another trusted host.
MCP clients
Copy .vscode/mcp.example.json to .vscode/mcp.json for an OAuth-capable client and substitute the generated public client ID. Do not put a client secret or bearer token in that file.
For clients that support stdio but not interactive remote MCP OAuth, this repo provides a local bridge. eg4-client-login performs Entra device-code or browser sign-in and stores the serialized MSAL cache in the OS credential store. eg4-client-bridge silently refreshes the session and proxies the authenticated remote MCP over stdio. Both commands take --tenant-id, --client-id, --scope api://GATEWAY-CLIENT-ID/Mcp.Read, and optionally --mcp-url.
EG4 caveat
EG4 Monitor has no public supported developer API found during research. This project calls a community reverse-engineered portal API through pylxpweb, pinned to a tested version. Read and control behavior can vary by role, model, and firmware.
License
MIT. This project is unaffiliated with EG4 Electronics or Microsoft.
This server cannot be installed
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 Connectors
Protocol-native energy infrastructure orchestration for AI data centers. Provides 46 MCP tools across 8 grid protocols (IEC-61850, DNP3, Modbus, OCPP, OpenADR, IEEE 2030.5, IEC 60870-5-104, ICCP) with 5 core API primitives: connect, dispatch, settle, comply, and intel. Enables AI agents to programmatically interact with substations, grid interfaces, and energy assets for real-time workload-grid coordination.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
One MCP URL for all your connectors — scoped writes, enforced constraints, and a full audit trail.
Remote MCP for Copilot CLI switch gate MCP, structured receipts, audit logs, and reviewer-ready evid
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to securely monitor and control MQTT devices for building automation, industrial control, and smart home systems through a standardized MCP interface.20MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for EG4 solar inverters, enabling real-time monitoring, performance analysis, battery health, alerts, maintenance insights, and historical data via natural language.MIT
- AlicenseAqualityCmaintenanceEnables access to Fronius solar inverter data via the MCP protocol, allowing real-time monitoring of energy production, consumption, and battery storage through natural language.14234MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for Solplanet ASW5-T inverter, enabling natural language queries about solar energy system status and control.
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/jLuPSP/eg4-entra-mcp-lab'
If you have feedback or need assistance with the MCP directory API, please join our Discord server