Skip to main content
Glama
Sparkplug MCP Server

Sparkplug MCP Server

by emqx

Overview

This project demonstrates a Sparkplug B (SPB) implementation featuring a chat-based interface for industrial IoT monitoring and control. It combines a Sparkplug MCP server with a web application that allows users to query device data, analyze historical metrics, and monitor device status through natural language interactions. The system supports both real-time monitoring and historical analysis of device metrics, making it ideal for industrial automation and IoT applications.

Related MCP server: Industrial-AIops

Architect diagram

alt text

Setup workspace

Follow the steps below to set up and run the application:

  1. Clone the Repository

git clone https://github.com/emqx/uns-demo/
cd uns-demo
  1. The project use uv to manage libs and project, please install uv before getting start.

  2. Some dependencies need to be compiled through cmake, please install cmake before getting start.

  3. Install Dependencies and Activate Virtual Environment

uv sync
uv venv

Pre-conditions

Install software and configurations

Please refer to software preparation.

Run the application

Steps

  • Copy .env.example to .env and modify the values accordingly.

  • Run sparkplug mcp server

  uv run spb_server.py
  • Run biz mcp server

  uv run biz_app.py
  • Run main application

  uv run main.py

Demos

Refer to doc for detailed demo scenarios.

Available Tools

4 tools
addA
Add two numbers together.

Args:
    a: First number
    b: Second number
    
Returns:
    The sum of a and b

Inputs: a (required), b (required).

divideA
Divide the first number by the second.

Args:
    a: Numerator
    b: Denominator
    
Returns:
    The result of a / b

Inputs: a (required), b (required).

multiplyA
Multiply two numbers together.

Args:
    a: First number
    b: Second number
    
Returns:
    The product of a and b

Inputs: a (required), b (required).

subtractA
Subtract the second number from the first.

Args:
    a: Number to subtract from
    b: Number to subtract
    
Returns:
    The result of a - b

Inputs: a (required), b (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool performs a distinct arithmetic operation (addition, subtraction, multiplication, division) with no functional overlap.

    Naming Consistency5/5

    All tool names are single lowercase verbs describing the operation, following a consistent and predictable pattern.

    Tool Count5/5

    Four tools cover the core arithmetic operations without being excessive or insufficient for the server's purpose.

    Completeness5/5

    The tool set provides the four basic arithmetic operations, completely covering the expected functionality for simple numeric calculations.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects AI agents to OPC UA-enabled industrial systems for real-time monitoring and control of operational data. It enables users to read, write, and browse industrial device nodes through natural language interactions.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Provides AI agents with safe, governed read access to industrial control systems (OPC-UA, Modbus, S7, Mitsubishi, MTConnect, MQTT/Sparkplug) plus cross-protocol diagnostics for troubleshooting data breaks, alarm floods, and unhealthy tags.
      157
      13
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables engineers and plant managers to interact with manufacturing systems using natural language, providing machine health analysis, KPI dashboards, predictive maintenance, and automated workflow execution via MCP.
      -