bayernwerk-mcp

bayernwerk-mcp

Enables interaction with Bayernwerk Netz's MAP and e-fix portals, providing tools to list and retrieve orders, documents, installer data, and more through natural language.

Category
访问服务器

README

bayernwerk-mcp

Tests License: MIT Renovate uv Ruff

MCP server for the Bayernwerk Netz Mein.Auftragsportal (MAP) and e-fix Installateur-Portal, exposing both via the Model Context Protocol.

Built on top of the bayernwerk-client library, which also ships a standalone CLI and can be used directly as a Python library. This repository only adds the MCP interface on top - it's an inoffizieller (unofficial) integration, reverse-engineered, not supported or authorized by Bayernwerk/E.ON. Use at your own risk, only with your own, authorized account.

Looking for the Python library or CLI? Head over to bayernwerk-client.

Authentication

Both portals sit behind a Cloudflare-JS-challenge and a Salesforce Aura login, so logging in always means a real, Playwright-driven browser - there's no way around that. This server just decides when that browser opens, in one of two modes:

Automatic login (recommended if you're at the keyboard)

Set MAP_EMAIL/MAP_PASSWORD as environment variables on the MCP server itself (in your MCP client's server config, e.g. claude_desktop_config.json or .vscode/mcp.json - see Configuration below). Whenever a tool call finds no cached token, or a cached token has expired, the server logs in for you automatically - a Chromium window briefly opens on the machine the server runs on (headed by default, so you can see and intervene if e.g. an unexpected MFA/consent prompt shows up), fills in the credentials, and closes again once the token is captured. MAP and e-fix share one Bayernwerk-Netz account, so one pair of env vars covers both.

Set BAYERNWERK_LOGIN_HEADLESS=true to suppress the visible window - only worth it on a host nobody is watching, and more likely to get stuck on the Cloudflare challenge (see the bayernwerk-client README for why headed is the default).

Access tokens last about an hour and there's no reliable silent refresh, so expect a browser flash roughly every hour during a long session - that's normal, not a bug.

Manual login (no credentials on the server)

Without MAP_EMAIL/MAP_PASSWORD configured, tool calls never open a browser themselves. Install bayernwerk-client with its login extra and run the CLI login once per service, outside of any MCP client, in a normal terminal:

uv tool install "bayernwerk-client[login]"
playwright install chromium
bayernwerk map login
bayernwerk efix login

This caches a token under ~/.cache/bayernwerk-client/{map,efix}-tokens.json, which this server's tools then read directly. If a tool call reports an authentication error (missing or expired token), re-run the matching login command and retry.

Tools

MAP - Mein.Auftragsportal

Tool Description
map_list_orders List all orders, optionally filtered to finished=True/False
map_get_order Fetch a single order by ID
map_get_order_details Additional detail data for an order
map_get_order_documents List an order's documents (for download, see map_sync_order_documents)
map_get_order_notes List an order's notes
map_get_order_instances Raw "Anschluss" tree (meter → consumers/generators → inverters → storages/PV)
map_list_order_instance_items Same tree, flattened into one deduplicated list
map_sync_order_documents Download an order's missing documents into a local folder
map_get_installer Own installer master data known to MAP
map_list_inverters Inverter master data, filtered by primary_energy_forms
map_list_storages Storage master data
map_list_product_orders Product orders (separate from regular orders)

e-fix - Installateur-Portal

Tool Description
efix_get_installer Own installer master data known to e-fix (more extensive than map_get_installer)
efix_list_installer_antraege Own "Anträge" (applications) with status/type/date
efix_get_user_status Account status: role, notification counters, subscription
efix_list_my_registered_events Registered events/training sessions

Installation

Prerequisites

  • Python ≥ 3.11
  • uv
  • A cached login token from bayernwerk-client (see Authentication)

Install dependencies

uv sync

bayernwerk-client isn't published on PyPI yet, so pyproject.toml currently pins it to a local editable checkout via [tool.uv.sources]. Once it's on PyPI, that override (and this note) go away.

Start the server (development)

uv run bayernwerk-mcp
# or
uv run python -m bayernwerk_mcp.server

Test with MCP Inspector

uv run mcp dev src/bayernwerk_mcp/server.py

Configuration in VS Code / Claude Desktop

Add the server to your MCP configuration (.vscode/mcp.json or claude_desktop_config.json). The env block is optional - add it to enable automatic login; leave it out for manual login via the CLI instead.

Local development (workspace checkout):

{
  "servers": {
    "bayernwerk": {
      "command": "bash",
      "args": [
        "-l",
        "-c",
        "uv --directory ${workspaceFolder} run bayernwerk-mcp"
      ],
      "env": {
        "MAP_EMAIL": "your@email.de",
        "MAP_PASSWORD": "your-password"
      }
    }
  }
}

Install from GitHub (latest unreleased):

{
  "servers": {
    "bayernwerk": {
      "command": "bash",
      "args": [
        "-l",
        "-c",
        "uvx --from git+https://github.com/the78mole/bayernwerk-mcp.git bayernwerk-mcp"
      ],
      "env": {
        "MAP_EMAIL": "your@email.de",
        "MAP_PASSWORD": "your-password"
      }
    }
  }
}

Once both bayernwerk-client and bayernwerk-mcp are published on PyPI, uvx bayernwerk-mcp will work directly without the git+ install.

Note: bash -l loads the login shell profile, which ensures uvx/uv are found in ~/.local/bin without any additional env configuration.

Credentials in plain text: MAP_EMAIL/MAP_PASSWORD end up unencrypted in your MCP client's config file (and in this process's environment) when set this way - treat that file like any other secret, and skip this if you'd rather keep credentials out of it entirely (use manual login instead).

Environment Variables

Variable Default Description
MAP_EMAIL - Bayernwerk-Netz account email. If set together with MAP_PASSWORD, enables automatic login for both MAP and e-fix.
MAP_PASSWORD - Bayernwerk-Netz account password.
BAYERNWERK_LOGIN_HEADLESS false Set to true to run the automatic login's browser headless instead of visibly.

Local Development

# Set up project environment
uv sync --extra dev

# Linting & formatting
uv run ruff format .
uv run ruff check --fix .

# Tests
uv run pytest

Related Projects

Project Description
bayernwerk-client Python client library (and CLI) this MCP server is built on

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选