Control the Broker Over MQTT
Instead of editing files and restarting, you publish a command string to a system topic and the broker applies the change immediately: users, LoT entities, Connectors, projects, secrets, and more.When to use broker commands
- Deploy or remove Actions, Models, Connectors, and Rules without downtime
- Run an Action on demand, or inspect what is loaded
- Manage users, groups, environment variables, and secrets
- Load LoT notebook projects and check their status
- Drive the same verbs from Coreflux HUB Command Console or any MQTT client
- Mint, list, and revoke MCP Server bearer tokens
Subscribe first, then publish. Replies are always JSON on a single output topic.
Quick Start
- Deploy an Action
- List Connectors
- Correlate replies
Subscribe to The broker replies with a JSON envelope.
$SYS/Coreflux/Command/Output, then publish the command. Use QoS 1 on both the command and the output subscription.success is true when the Action was registered:How Commands Work
Authorization uses the MQTT session username of the publishing client. Do not send
-requestUser in the payload.
Response Envelope
Every reply on$SYS/Coreflux/Command/Output is one JSON object. List and query payloads live in data. data is always present: {} when there is nothing structured to return, or [] for an empty list.
How to parse a reply
- Parse the payload as JSON (always a single object).
- Read
success,command, and optionalrequestIdfrom the root. - Read structured results from
data. - Read human text from
messageand failures fromerrors[].
Error objects
Parse failure example:
Global failures
Permission denied (command accepted at MQTT, then blocked by RBAC):-addConnector.
Unknown command:
CommandCall, the publish to $SYS/Coreflux/Command can be rejected before any Output message. Handle both MQTT-level denial and JSON success: false. See RBAC with LoT Rules.
Command Index
Most verbs also accept a dashed alias (-addConnector / --add-connector). The table lists the MQTT form you publish. Each Connector command also has a Route spelling (-addConnector and -addRoute run the same command), kept as an alias. See Connector command spellings.
-updateData refreshes broker $SYS statistics and does not publish a reply on $SYS/Coreflux/Command/Output.
User Management
Create a user, then assign groups forUSER IN GROUP in LoT Rules. Group commands require user-management permission on the authenticated MQTT session. See RBAC with LoT Rules.
These commands manage the local user store. An OIDC access token is not a local user: there is no command to create one, and -listUsers does not show token sessions.
-listUserGroups returns { username, groups, count } in data.
Permission flags for -changeUserSettings include AllowedUserManagement, AllowedSystemConfiguration, and AllowedLogManagement.
Rules
Rules define access control. See Rules Overview, Rules Syntax, and RBAC. Lower priority number wins.-addRule accepts priorities from 100 to 1 000 000 only; custom ACL rules require Growth or Enterprise.
Rules are LoT code and can also be deployed from a LoT Notebook by running the cell that contains the definition.
Locked built-in system rules cannot be removed. Seed catch-alls (
AllowPublishTopic / AllowSubscribeTopic / AllowConnect) may be removed to switch that operation toward default-deny — except Connect, where removing AllowConnect without a replacement leaves CONNECT ungated. See RBAC.-restoreRules puts AllowPublishTopic, AllowSubscribeTopic, and AllowConnect back to their shipped ALLOW definitions. Missing seeds are re-added; overrides of those names are reset; locked built-ins and your other custom rules are left alone. Requires root or AllowedSystemConfiguration. No arguments.
-removeAllProjectRules removes permission rules owned by the active project. Built-in rules and operator-authored custom rules stay in place.
Models
Actions
Run an Action on demand
-runAction runs an Action immediately, regardless of its trigger.
$SYS/Coreflux/Actions/<name>/Trace (if tracing is on) or $SYS/Coreflux/Actions/<name>/Error. data.traceId identifies this execution.
Callable Actions (those that declare INPUT) accept a JSON object of parameters:
ON TOPIC / ON CHANGE) accept trigger context instead of INPUT bindings when the JSON object contains a topic key. The Action runs synchronously; data includes status, published, durationMs, error, and traceId. You do not need to arm -actionTrace for this form.
The
topic value must match the Action’s trigger pattern (including wildcards). This topic form does not apply to callables — their JSON object is always INPUT bindings, even if it contains a topic key.
See Callable ACTIONs for INPUT / CALL ACTION.
Action tracing
$SYS/Coreflux/Actions/<name>/Trace. Arming auto-expires; data.expiresUtc tells you when. A { "topic": … } -runAction arms tracing for that one call and disarms afterward, unless a live -actionTrace session was already on.
Agents
Agents are their own LoT entity.-addConnector refuses a DEFINE AGENT block, and -listConnectors does not include agents. See AI Connectors and Agents.
-addAgent on a name that already exists updates that agent and keeps its conversations. -removeAgent cancels running tasks and forgets session memory. -removeConnector refuses to remove a TYPE LLM connector an agent still uses.
-addAgent requires AgentManagementCreation. -removeAgent requires AgentManagementRemove. root, admin, and AllowedSystemConfiguration pass those gates, as they do for connectors.
Connectors
Connector command spellings
Each Route command has a Connector spelling. The Route names (-addRoute, -listRoutes, and the rest) stay as aliases. Both forms run the same command, and the reply’s command field keeps the Route name (AddRoute, ListRoutes, …), so scripts that check it keep working.
-addConnector takes the same body as -addRoute, written with either DEFINE CONNECTOR or DEFINE ROUTE:
--lot-connectors <path>. -lotrt and --lot-routes remain supported aliases.
-listConnectors places entries in data (name, type, connection, health). Unmonitored connectors report "Unknown" for connection and health.
-checkConnectorConnection tests the named Connector. Details such as routeType and connectionTime are in data. What “connected” means depends on the Connector type — see the Connector page (for example OPC UA Client or Modbus TCP Server).
-connectorCode returns template LoT for that Connector type, or for a REST API app by its app code, in data. -listTemplates lists available templates.
-connectorCertificates manages PKI for Connectors that support certificate stores (OPC UA client and server). The argument is cert64: plus base64 of a minified JSON request (stores, list, inspect, trust, delete, export, import). Operation details are in data. See OPC UA Client — Certificate Management.
-discoverAIProviders probes configured LLM providers for reachability and models. API keys and host URLs come from secrets and environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, OLLAMA_HOST). An optional JSON object can override those values for the probe. Results are also published retained on $SYS/Coreflux/AI/Providers.
Disable and Enable
These commands switch an action, connector, or agent off or on without deleting it. Each one redeploys the stored definition with aDISABLE true line added right after the DEFINE line, or removed, through the normal add path. An entity already in the requested state is left alone and the command still succeeds.
ActionManagementCreation, ConnectorManagementCreation, AgentManagementCreation). RouteManagementCreation remains a supported alias of ConnectorManagementCreation. With a live project, the change is written back to its notebook cell. A connector, action, or agent that belongs to a Thing is refused: change the Thing instead. -disableConnector refuses a TYPE LLM connector that agents still use.
What a disabled entity does: Actions, Connectors, Agents.
Things
The children a Thing creates are read-only:
-addAction, -removeConnector, and the other per-entity commands refuse them and name the owning Thing. -removeAllActions, -removeAllModels, and -removeAllConnectors skip them. See LoT THING.
Diagnostics
-lotDiagnostic turns global LoT diagnostic tracing on or off. The only argument is true or false. Anything else returns Invalid diagnostic value.
Environment Variables and Secrets
See Environment Variables & Secrets for storage, substitution in LoT, and security notes.-listEnv returns name/value pairs in data. -listSecrets returns names only — secret values never appear in command output.
Python Integration
Python scripts must start with
# Script Name: YourScriptName. That name is what you pass to CALL PYTHON from a LoT Action.Panels and Themes
Deploy dashboards written asDEFINE PANEL. -addPanel and -addVisu are the same command. See Defining Panels.
-updateVisuState takes DRAFT, PUBLISHED, or ARCHIVED.
-addVisuFile lot64:<base64> deploys every DEFINE PANEL block from a .lot file encoded as base64.
Theme commands: -addTheme (full DEFINE THEME body), -removeTheme, -listThemes, -removeAllThemes.
-listPanels and -listThemes also publish catalog data on $SYS/Coreflux/VoT/Panels/ and $SYS/Coreflux/VoT/Themes/.
Projects
A project is a folder of.lotnb files under the broker data path. See Project organization.
-loadProject and -unloadProject remove only entities the broker attributes to that project. Actions, Models, Connectors, Python scripts, and panels you added with -addAction (and similar) while no project was active stay running.-loadProject Traceability System or -loadProject "Traceability System"). / is not allowed.
Quote a git URL so the address stays one argument. The branch name is the next argument: -addProject "https://git.example.com/factory-iot.git" main.
-listProjects returns name, active, git metadata, and related fields in data.
-loadProject returns { project, entities, counts } in data. counts.actions lists user-defined Actions only (not Connector-internal event Actions). Built-in permission rules are omitted. Per-entity failures appear in warnings[]; success can still be true when the load finished with partial errors.
The last loaded project is remembered across restarts unless you pass --project at startup. See Startup Options.
-unloadProject tears down owned runtime entities and returns the broker to standalone mode. The folder stays on disk. -removeProject also deletes the folder.
-getProject exports a zip (base64) on $SYS/Coreflux/Projects/<name>/download.
-projectManifest returns hashes of stored files and declared entities so clients can compare a working copy without downloading the zip. The same JSON is published retained on $SYS/Coreflux/Projects/{name}/manifest.
MCP Tokens
Bearer tokens for the MCP Server. These verbs are operator-only (McpTokenManagement) and are not advertised as MCP tools.
-createMcpToken <username> <token-name> [ttlDays] returns the plaintext once in data.token. The username must already exist; tool calls run as that user. Token names cannot contain whitespace. -listMcpTokens returns metadata in data.tokens — never the secret.
MQTT replies always land on $SYS/Coreflux/Command/Output. That topic’s default audience is wider than McpTokenManagement. Prefer the broker console or the HUB MCP tab when you need the plaintext off that lane.
License
Licenses are signed tokens. Register at portal.coreflux.org for a license — including a 30-day Growth-type trial — and manage your fleet of brokers there. Full operator guide: Licensing and Enrollment.-loadLicense treats the argument as the license itself when it has the shape of a compact JWS, and as a filesystem path otherwise. That is how Coreflux HUB installs an offline license without writing a file on the broker host.
Broker Certificates
-brokerCertificates manages the broker’s TLS server certificate, its Root CA, and the mTLS client trust store (ClientCertificateSourcePath). It is what HUB Certificates uses. It needs administrator rights (AllowedSystemConfiguration), and it is not exposed to the MCP server or to agents, because requests carry certificate bytes and passphrases. Changes are audit-logged.
The argument is cert64: plus base64 of a JSON request with an op and an optional requestId that is echoed back.
message is JSON: requestId, op, success, a human message, and data. Mutating ops also republish $SYS/Coreflux/Certificates/Summary.
Audit
-auditQuery takes a date (YYYY-MM-DD). Add -auditFilter field=value in the same payload to narrow results. -decryptAudit decrypts that day’s log; pair with -auditExport <path> to write JSON to a file. Decryption requires the audit key configured on the broker (COREFLUX_AUDIT_KEY).
Trace Logging
Capture broker log lines and republish matches to an MQTT topic.Command Authorization
Not every user can run every command. Management gates such asCommandCall and per-entity creation flags are defined in LoT Rules. See Rules overview and RBAC.
Next Steps
System ($SYS) Topics
Subscribe to command output, entity code, and broker telemetry.
Command Console
Run the same commands from Coreflux HUB without a separate MQTT client.

