Skip to main content
Glama
emqx

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: OT-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
ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description states it returns the sum, which is clear. With no annotations, the description covers basic behavior well. However, it does not address edge cases like overflow or NaN handling, but for a simple arithmetic tool this is acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with only two lines plus an optional docstring. It is front-loaded with the core purpose and includes the necessary args and returns sections with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (2 required numeric parameters, no output schema, no annotations), the description fully explains what the tool does and what it returns. It is complete for its scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers both parameters with types, but schema description coverage is 0%. The description adds that it returns the sum, which is not in the schema. However, the schema already defines the parameters as numbers, so the description adds minimal extra meaning beyond stating the operation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'Add two numbers together,' which is a specific verb and resource. It clearly distinguishes itself from sibling tools (subtract, multiply, divide) that perform different operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. The context implies basic arithmetic use, but there is no mention of when not to use it or comparisons with siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

divideA
Divide the first number by the second.

Args:
    a: Numerator
    b: Denominator
    
Returns:
    The result of a / b
ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the burden. It only states the basic operation and return value, omitting potential issues like division by zero, error handling, or precision. Minimal behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief, with a clear main sentence and docstring-style args. Every word is necessary, and it is front-loaded. No extraneous content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (dividing two numbers), the description covers input parameters and return value. It lacks mention of edge cases like division by zero, but overall it is sufficient for an arithmetic operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Parameters have zero schema description coverage, but the description adds semantic roles ('Numerator', 'Denominator') beyond the schema titles ('A', 'B'). This meaningfully aids the agent in understanding parameter purposes.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Divide the first number by the second.' which clearly identifies the verb (divide) and resources (two numbers). It distinguishes from sibling tools (add, subtract, multiply).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for division but lacks explicit guidance on when to use alternatives or when not to use it (e.g., division by zero). For a simple arithmetic tool, it is adequate but not exemplary.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

multiplyA
Multiply two numbers together.

Args:
    a: First number
    b: Second number
    
Returns:
    The product of a and b
ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It clearly states the return value (product), but could mention behavior with zero or negative numbers.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise with only necessary information, but could be more streamlined (e.g., eliminate Args/Returns headers for a one-line description).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given simplicity (2 numeric params, no output schema), description is complete enough: purpose, parameters, return value are all covered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but description adds 'First number' and 'Second number' to parameters. This marginally improves understanding beyond the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states it multiplies two numbers, using a clear verb and resource. It distinguishes from sibling tools (add, subtract, divide) by specifying multiplication.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or alternatives are given, but the simple math context implies usage. It does not differentiate from potential edge cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

subtractA
Subtract the second number from the first.

Args:
    a: Number to subtract from
    b: Number to subtract
    
Returns:
    The result of a - b
ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description discloses core behavior (subtract b from a) but lacks details on potential edge cases like negative results or precision, and no annotations are provided to compensate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is brief and to the point, but includes some redundant formatting (Args/Returns) that could be streamlined.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequately explains parameters and return value for a simple arithmetic tool; lacks edge case handling but sufficient for basic use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Clear explanation of each parameter: 'a: Number to subtract from' and 'b: Number to subtract', adding meaning beyond the type-only schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description explicitly states subtraction operation and distinguishes from siblings (add, multiply, divide) by naming the specific arithmetic action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use subtract vs alternatives; usage is implied by the operation but no comparative context provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.1.0
    • First observedadd
    • First observeddivide
    • First observedmultiply
    • First observedsubtract

TDQS

A4.2/5.0
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.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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
    A
    quality
    A
    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.
    2
    153
    1
    MIT
  • F
    license
    Not graded
    quality
    C
    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.
    -
  • A
    license
    A
    quality
    F
    maintenance
    MCP server for industrial PLC integration, enabling AI to read tags, monitor alarms, and interact with Allen-Bradley ControlLogix PLCs via natural language.
    9
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/emqx/uns-demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server