Skip to main content

Crate bacnet_mcp

Crate bacnet_mcp 

Source
Expand description

A Model Context Protocol server for BACnet sites (#2066), so an AI agent host (Claude Code, Codex and others) can discover devices and read them through the same engine and request limits as the bacnet tool’s terminal UI, and, when a profile opts in, write through the TUI’s preview tiers, ledger and audit log (#2068).

The server is built on the official rmcp SDK and targets the 2026-07-28 revision of the protocol, while still answering clients that open with the older initialize handshake. bacnet mcp serve --stdio (the CLI’s mcp feature) runs it; docs/design/mcp.md has the design.

  • Every tool reaches the network only through bacnet_ops::engine::Engine, under its per-device gate and global rate, a rate per network, and a token bucket per principal (Policy). Each result reports what it cost.
  • Device-supplied text comes back in an untrusted envelope: cleaned of control and bidirectional characters, defanged and capped.
  • Results are paged with cursors signed by a per-process key.
  • Passive mode builds no client and lists only the tools that send nothing.
  • Writes are off by default. With mcp_writes = "elicit" the client’s confirmation may approve a T1 write and a plan grant the writes it names; T2 and T3 need a verifiable approver. The confirmation state is sealed for its caller, single use and short-lived.

Stdout carries only JSON-RPC: this crate never prints, and its logs go through tracing, which the host process points at stderr.

Re-exports§

pub use policy::Policy;

Modules§

policy
What the server may reach, and how fast: the launch configuration a front end builds from a profile’s [mcp] table or its flags (design §4.4, §7.6). It is fixed for the life of the server, so the tool list never depends on runtime state.

Structs§

McpServer
An MCP server over one BACnet client’s engine, read-only unless the profile offers writes.
ServeError
Why the server stopped other than its client going away.