Plug Your Broker Into Any MCP Tool
MCP (Model Context Protocol) is an open standard that defines how applications communicate with external tool servers. MCP Connectors let your Coreflux broker connect to any MCP-compatible server — file systems, messaging platforms, cloud storage, spreadsheets, and more — and call their tools directly from LoT Actions.A
DEFINE AGENT gets this connector’s tools only through ADD TOOL "mcp", one tool or all of them, and each call needs a rule. Actions call the tools with CALL MCP or run an ADD EVENT on the connector. See Agents and MCP Tools.Integration Architecture
MCP Connectors allow the Coreflux Broker to connect to external MCP servers as a client. This enables LoT Actions to call tools provided by any MCP server—file systems, cloud services, communication platforms, and more.How It Works
- Define MCP Connectors - Each connector connects to an external MCP server
- Discover Tools - The broker lists the server’s tools as soon as the handshake completes, and again when the server reports that the list changed
- Call from Actions - Use
CALL MCPin LoT Actions to invoke any tool - Reusable Connections - Multiple actions can share the same MCP connector
Basic Syntax
TheMCP connector type connects your Coreflux broker to an external MCP server, making that server’s tools callable from LoT Actions. Each connector manages one MCP server connection, and you can define multiple connectors to connect to different servers simultaneously.
CALL MCP to invoke the server’s tools — send Slack messages, read and write files, generate spreadsheet reports, or interact with any other MCP-compatible service.
MCP Configuration
MCP_CONFIG Parameters
A connector reaches its server in one of two ways. SetSERVER_COMMAND and SERVER_ARGUMENTS to start a local server process (stdio). Or set SERVER_URL to connect to a remote server over HTTP. When SERVER_URL is set, SERVER_COMMAND and SERVER_ARGUMENTS are not needed. Without it, -addConnector requires both.
Comma-separated server arguments (e.g.,
-y, @modelcontextprotocol/server-filesystem). Required unless SERVER_URL is set.URL of a remote MCP server (e.g.,
https://mcp.example.com/mcp). Replaces SERVER_COMMAND and SERVER_ARGUMENTS. Send a header to that server with SERVER_HEADER.WITH SERVER_HEADER "Name" <value> sends one HTTP header to a server reached with SERVER_URL. Repeat the line for each header. The value can be a string or GET SECRET "...". The value is masked in broker logs, the same way as SERVER_ENV.WITH SERVER_ENV "NAME" <value> sets one environment variable on the server process. Repeat the line for each variable. The value can be a string, a number, true/false, GET ENV "...", or GET SECRET "...", resolved when the connector starts. Applies only to a server started with SERVER_COMMAND. The value is masked in broker logs.Configuration Examples
- Filesystem Server
- Custom MCP Server
- Node.js Server
- Server Credentials
- Remote Server
Enable LoT Actions to perform file operations:
MCP Server Examples
The MCP ecosystem includes servers for various platforms and services. These examples show how to connect popular MCP servers to your Coreflux broker for IoT integration.- Node.js Servers (npx)
- Python Servers (uvx)
Node.js-based MCP servers can be run directly using
npx. These are the most common and include official Anthropic servers.Example: Slack Alerts for IoT Events
Calling MCP Tools
Once an MCP connector is defined, you can call its tools from within LoT Actions using theCALL MCP syntax. This enables AI-powered automation triggered by MQTT events.
Basic Syntax
The standard syntax to invoke an MCP tool from an Action:Return Value
RETURN AS always receives a JSON string, also when the call fails. Check success before you use result:
A failed call has
success: false and an error such as Tool 'X' not found. Available tools: ..., MCP client is not connected, or MCP route 'X' not found or not an MCP route.
Complete Example
This Action monitors a temperature sensor and uses an MCP tool to send a Slack message when the temperature exceeds a threshold:Syntax Variations
No Arguments
No Arguments
Some tools don’t require arguments:
Multiple Arguments
Multiple Arguments
Pass multiple named parameters:
String Concatenation
String Concatenation
Build dynamic values using expressions:
Who Can Call Tools
A rule on$SYS/Coreflux/Routes/<connector>/Tools/<tool>/Call governs CALL MCP for that tool. The tool name is percent-encoded into one topic level when it contains /, +, #, ., or % (files/read is files%2Fread). With no matching rule, CALL MCP behaves as before: any action that runs it can call any tool on any configured MCP connector.
$SYS topics use the PublishSys scope:
- Only let trusted administrators add MCP connectors. Every tool those servers expose becomes callable from LoT until a rule matches its Call topic.
- Restrict which roles can add or change actions. A role that can deploy actions can reach every tool that has no matching rule.
- An agent’s MCP tool call is checked on the same topic, but it needs a rule that allows it: with no matching rule the agent is refused. A rule you write for an agent also decides
CALL MCPon that tool, so keep the users your Actions run as in it. See Agents and MCP Tools.
Run a tool from an event
AnADD EVENT on an MCP connector runs that tool and publishes the result to the event’s DESTINATION_TOPIC. Name the event after the tool. Fire it from an Action with TRIGGER.
alerts/slack/result is the tool result for that event.
Agents and MCP Tools
Grant aDEFINE AGENT the connector’s tools with ADD TOOL "mcp". Each granted tool reaches the model as its own function, mcp__<connector>__<tool>, with the input schema the server sent.
Claude is a TYPE LLM connector. Create shift-reporter with -addUser before you add the agent. The agent reads line data and posts with two Slack tools. The tool names come from $SYS/Coreflux/Routes/MCPSlack/Tools. Use "MCPSlack.*" to grant every tool of the connector.
- Level —
"write_confirm", the default, waits for an approval on each call."write"runs at once."read"offers only the tools the server marks read-only. - Rule — the agent’s call is checked as
PublishSyson…/Tools/<tool>/Call, for the user the task runs as and forDEFAULT_USER. With no rule that allows both, the call is refused asunauthorized. The example task runs asshift-reporterwhen an Action starts it withCALL AGENT. Add the people who ask the agent over MQTT to the rule. - Actions — the rule also decides
CALL MCPonMCPSlacktools. An Action that calls them must run as a user the rule allows. - Tool list — when the server reports a change, or the connector restarts, the agent is rebuilt with the new list before its next run.
MCP_ROUTES is legacy. On DEFINE AGENT, WITH MCP_ROUTES "MCPSlack" is read as ADD TOOL "mcp" on MCPSlack.* at write_confirm. A TYPE LLM connector ignores it and logs a warning. Write ADD TOOL "mcp" instead. The full reference is MCP tools in Agent Syntax.
Tool Discovery
When the handshake with the MCP server completes, the broker lists that server’s tools and publishes them to MQTT system topics. It does not wait a fixed 10 seconds. Stopping the connector also closes the MCP server process it started. When the server sendsnotifications/tools/list_changed, the broker lists the tools again, republishes the retained tool topics, and clears the topics for tools that were removed.
System Topics
All three are retained. The broker republishes the summary and tool topics with its periodic status updates.
Tools Summary Payload
Subscribe to the summary topic to see all available tools:fast_tools counts tools rated FAST. reliable_tools counts tools rated EXCELLENT. The summary also includes tool_entries.
Individual Tool Payload
Each tool publishes its description, parameters, and call statistics:name, topic_segment, required, read_only, the full inputSchema, and function_name.
A tool name that contains /, +, #, ., or % is percent-encoded into one topic level. files/read is published at Tools/files%2Fread, and CALL MCP still addresses it as Docs.files.read (connector Docs, tool files.read).
Each parameter in parameters carries only type and description. An array parameter also carries items, which defaults to { "type": "string" }. inputSchema is the tool’s full input schema, and required is included on the same topic.
A tool that has never been called shows 0 counts, UNKNOWN ratings, and never for both dates. The first publish after discovery also carries usage_example (a ready CALL MCP block) and trigger_example (TRIGGER "MCPSlack" TO PAYLOAD FOR "send-message"). The periodic republish leaves them out.
Capability Payload
…/Tools/{tool}/Capability is published after every call to that tool:
Subscribing to Tool Discovery
Use MQTT Explorer or any MQTT client to discover available tools:Tool discovery topics are retained messages, so the information is immediately available when you subscribe—you don’t need to wait for the next update.
Use Cases
Alerting and Notifications
Alerting and Notifications
Connect to Slack, email, or other messaging MCP servers to send alerts directly from LoT Actions. When a sensor crosses a threshold, the Action calls the messaging tool — no external middleware needed.
File and Data Management
File and Data Management
Use filesystem MCP servers to read configuration files, write sensor logs, or manage data exports. LoT Actions can read a config file at startup or append readings to a log file on every event.
Cloud Integration
Cloud Integration
Connect to Google Drive, Excel, or other cloud MCP servers to back up IoT data, generate reports from sensor readings, or sync configurations with cloud storage.
External Automation
External Automation
Use Windows Control or custom MCP servers to automate HMI/SCADA interfaces, trigger external scripts, or interact with desktop applications as part of your IoT workflow.
Best Practices
Security Considerations
Security Considerations
- A rule on
$SYS/Coreflux/Routes/<connector>/Tools/<tool>/CallgovernsCALL MCP. With no matching rule, any action can call any tool on a configured MCP connector. See Who Can Call Tools SERVER_COMMANDstarts any program on the broker host. Only let trusted administrators add MCP connectors. Stopping the connector closes that process- Pass server credentials with
SERVER_ENVorSERVER_HEADERandGET SECRET, never as plain text in the connector. Both values are masked in broker logs - A
SERVER_URLwith noSERVER_HEADERsends no credential. Do not expose a remote MCP server that needs no key outside a trusted network - Monitor MCP tool calls through logging
- Implement rate limiting for MCP requests
Resource Management
Resource Management
- Configure appropriate timeouts for MCP operations
- Limit concurrent MCP connections if needed
- Monitor memory usage of MCP server processes
Error Handling
Error Handling
- Implement graceful fallbacks when the MCP server is unavailable
- Log MCP communication errors for debugging
- Set up alerts for repeated failures
Troubleshooting
MCP Server Won't Start
MCP Server Won't Start
- Verify SERVER_COMMAND path is correct
- Check SERVER_ARGUMENTS syntax (comma-separated)
- Ensure required packages are installed (npx, node, python)
- Check system PATH includes required executables
Connection Timeout
Connection Timeout
- Verify MCP server is running and responsive
- Check network/firewall settings
- Increase timeout values if server startup is slow
- Check server logs for errors
Tool Execution Fails
Tool Execution Fails
- Verify the requested tool is available
- Check permissions for the operation
- Review server logs for detailed error messages
- Ensure broker has required access rights
Next Steps
REST API Connectors
Connect to external REST APIs.
Python Integration
Add custom AI/ML logic with Python.

