BACpypes provides a BACnet application layer and network layer written in Python for daemons, scripting, and graphical interfaces. This version is the next generation for Python3.8+, completely overhauled from the Python2.5+ version using async/await methods and asyncio for communications.
The bacpypes3.mcp module exposes the BACpypes3 CLI commands (whois,
read, write, rpm, wirtn, BBMD ops, …) as MCP tools with natural names
(who_is, read_property, write_property, read_property_multiple,
who_is_router_to_network, …). It has three personalities:
- Importable library. Each tool is a plain
asyncfunction returning JSON-serializable Python values. Inject anApplicationand call the tools directly. - Stand-alone MCP server.
python -m bacpypes3.mcp <BACpypes flags>builds anApplicationviaSimpleArgumentParserand serves the tools over stdio using FastMCP. - Embedded server. A long-running BACnet server can inject its own
Applicationand startmcp.serve_http(...)as a concurrent asyncio task, so an LLM agent can drive it over HTTP without fighting the host application's stdout. Seesamples/mini-device-mcp.pyfor the reference pattern.
The mcp and pydantic packages are declared as an optional extra and are
only imported when a server is actually built; the tool functions are usable
without them:
pip install -e ".[mcp]" # to run the server