Header Abstract

Building an MCP-Powered Agent for Bearing Health Monitoring

genai matlab agents gemini-cli parquet hadoop python sprites

Intro

In this post, I’m turning a Gemini agent into an industrial health monitor. By nesting the agent in a sandbox, I’ve got it orchestrating a hand-off between MATLAB (for synthetic data generation) and Python (for health analysis) - all while keeping things efficient by passing file paths instead of bulky data chunks. If you've ever wondered how to make LLMs working with MATLAB, Python, Hadoop and Parquet this workflow is for you.

The workflow and its components

Workflow Components Diagram
Gemini CLI Screenshot

Sandbox

I'm using the as a stateful sandbox environnement. Sprites is a recent offering at the time of writing (January 2026). My experience with them has been quite positive; very simple to get started, sprites come with pre-installed gemini-cli and simple, friendly APIs. The downsides - the usage billing was not very transparent - I was charged $7.79 while working on this demo but I'm not sure what the change was for, and I couldn't find any insights in the cost explorer. Another issue was that I couldn't get the gemini-cli to work properly in interactive mode when connecting to the sprite from , other terminals worked great though.

MATLAB MCP Server and getSensorData tool

I had a to generate synthetic data with random noise, which is then stored into a Parquet file in Hadoop HDFS storage.

% Construct synthetic vibration signature:
% Component 1: 50Hz fundamental frequency
% Component 2: 120Hz higher-frequency fault harmonic
% Component 3: Random noise scaled by 0.5
sig = sin(2*pi*50*t) + 0.8*sin(2*pi*120*t) + 0.5*randn(size(t));

% --- Data Persistence ---
% Convert signal vector to a table for Parquet compatibility
% Variable name 'vibration' is used for schema consistency in HDFS
T = array2table(sig', 'VariableNames', {'vibration'});

% Write the file to the local working directory
parquetwrite(outPath, T);

Using Hadoop is not that fashionable nowadays but it is certainly a low key way to get data shared between MCP tools. Since MATLAB's supports HDFS out of the box, I decided to use it.

Industrial Server and analyzeBearingHealth tool

The analyzeBearingHealth tool receives path to the Parquet file, analyzes the data and assesses the health state ().

@mcp.tool()
def analyze_bearing_health(path: str, threshold: float = 0.5) -> dict:
    """
    Reads vibration data and judges bearing health based on RMS intensity at 120Hz.

    Args:
        path: URI or local path to the sensor data (Parquet format).
        threshold: RMS intensity limit (default 0.5).
    """
    # Load data from HDFS or local filesystem
    df = pd.read_parquet(path, engine='pyarrow')

    # Calculate intensity at the specific bearing fault frequency (120Hz)
    intensity = get_rms_at_freq(df['vibration'].values, fs=2000, target_freq=120)

    # Assess health and return the results ...

Code