The AI Architecture

2025-09-07

Going with a web-based architecture as opposed to a desktop solution (LMStudio is also running here on the laptop) has the advantage that it's also available on the iPhone and generally externally to any browser. User's can make completely private AI queries with a vastly lower risk of being profiled by the FSB.

On the negative side, you'll need a cluster of computers of varying types and capabilities, not to mention the infrastucture to support them along with an AI Engineer (hopefully that's yourself - we used to be called software engineers btw [among other thing....]). So on the whole the architecture here tends to be less monolithic compared to running everything on the laptop.

What is MCP

AI MCP, or the Model Context Protocol, is an open standard designed to standardize how AI applications, especially large language models (LLMs), connect and communicate with external data sources and tools. It acts like a universal connector, allowing AIs to access new information and perform tasks they can't do alone, enabling them to provide more accurate, context-aware, and dynamic responses by integrating with things like databases, web APIs, and local files.

MCP connections relying on stdio connectivity just won't work in a larger dynamically allocated environment like docker swarm. Essentially most of the bits and pieces in the various software stacks move from machine to machine/node to node depending on all sorts of external factors such as hardware loading, ram availability, local storage requirements just to name a few. This is a pretty common scenario in a lot of organisations.


Current Docker schematic of part of the overall system at this early stage.

mcp-server-time

Below is a screenshot of Open-WebUI talking to Ollama and the MCP server for time.

Example of MCP connected to the OpenHAB Home Automation system:

List the items in openhab? Use TOOL:server:mcp-server-openhab with json {“filter”:nil}

This is a very large JSON array representing a system configuration, likely for a home automation system. Let's break down what it means and the likely purpose of each element.

**Overall Structure**

The array contains a list of "objects." Each object represents a defined entity within the system.  These entities can be:

*   **Points:**  Sensors, actuators (like lights or plugs), or other data sources that provide values or can be controlled.  These are the workhorses of a home automation system.
*   **Groups:** Logical groupings of points.  This allows you to control multiple points together (e.g., turning on all the lights in a room).*   **Other System Elements:** May include elements that control broader system behavior or represent overall configuration.

**Key Elements and Their Meaning**

Let's examine the key properties within each object.  These are the common attributes you're likely to see.

*   **`type`**:  This is *critical*. It tells you what kind of object it is (`Point`, `Group`, `Dimmer`, etc.).
*   **`name`**:  A user-friendly name for the entity.  This is how you'd refer to it in rules or interfaces.
*   **`state`**:  The current value of a point or the current configuration of a group (e.g. "ON", "OFF", a number, or a string).  For groups, often "NULL".
*   **`label`**: A more descriptive label.
*   **`tags`**:  Keywords associated with the entity.  Tags help with filtering, organization, and creating rules.
*   **`groupNames`**: The groups that the entity belongs to.

**Breakdown of Specific Examples**

Let's look at some specific examples to illustrate how these properties combine:

*   **`{ "type": "Point", "name": "tplinkHS11001_PowerWatts", "state": "0 W", "label": "tplink-HS110-01-PowerWatts", "tags": [ "Point" ], "groupNames": [ "tplink_hs110_01_group" ] }`**
    *   This is a point representing the power consumption (in Watts) of a TPLink HS110 smart plug.
    *   The `state` is currently "0 W" (no power consumption).
    *   The `groupNames` show that this point is part of the group named "tplink\_hs110\_01\_group".
*   **`{ "type": "Group", "name": "gHallAllLights", "state": "NULL", "label": "gHallAllLights", "tags": [], "groupNames": [] }`**
    *   This is a group representing all the lights in the hall.
    *   The `state` is "NULL" because it's a group – its state depends on the states of the points *within* the group.
    *   The empty `tags` and `groupNames` indicate it's a top-level group.
*   **`{ "type": "Dimmer", "name": "gCmdHallAllLightsDimmer", "state": "100", "label": "gCmdHallAllLightsDimmer", "tags": [ "Light", "Point" ], "groupNames": [ "gHallAllLights" ] }`**
    *   This controls the dimmer level of the hall lights (likely acting as a command).
    *   The `state` of "100" likely means 100% brightness.
    *   The `groupNames` show that this dimmer is associated with the `gHallAllLights` group.

**Common `type` Values and Their Implications**

*   **`Point`**:  A basic data source or controllable device.  This could be a temperature sensor, a light bulb, a switch, etc.
*   **`Group`**:  A logical container for grouping points.  Used to control multiple devices together.
*   **`Dimmer`**: A controllable dimming device.
*   **`Switch`**: A simple on/off device.
*   **`Sensor`**:  A device that reports a value (e.g., temperature, humidity).

**Possible Use Cases and System Functionality**

Based on the configuration, the system likely allows for:

*   **Remote Control:** Users can view and control devices through a user interface.
*   **Automation:**  Rules can be created to automatically control devices based on events (e.g., turn on lights at sunset, adjust thermostat based on temperature).
*   **Monitoring:** Users can monitor the status of devices and receive alerts.
*   **Scene Setting:** You can likely create "scenes" – predefined states for multiple devices that can be activated with a single command (e.g., "Movie Night" – dims lights, closes curtains).

**Important Considerations**

*   **System-Specific:** This configuration is specific to a particular home automation system. The exact properties and their meanings might vary.
*   **Hierarchical:** The `groupNames` attribute creates a hierarchy.  Points can belong to multiple groups.
*   **Dynamic:** This configuration is likely dynamic.  It can be modified through a user interface or API.

In summary, this JSON provides a complete picture of a smart home system's configuration, allowing for detailed monitoring and control of connected devices.

After quite a bit of playing around it became evident that the various models want to analyze the data coming back from the various MCP endpoints defined in the servers. Seeking to circumvent this by guiding the LLMs proved to be very frustrating and ultimately fruitless. By simply asking the LLM to carry out an action against a device seemed to be the way to go.