Skip to main content
Glama
emqx

Sparkplug MCP Server

by emqx
README.md
## 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.

## Architect diagram
![alt text](./docs/arch.png)

## Setup workspace

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

1. Clone the Repository
```bash
git clone https://github.com/emqx/uns-demo/
cd uns-demo
```

2. The project use `uv` to manage libs and project, please install [uv](https://docs.astral.sh/uv/getting-started/installation/) before getting start.

3. Some dependencies need to be compiled through cmake, please install [cmake](https://cmake.org/download/) before getting start.

4. Install Dependencies and Activate Virtual Environment
```bash
uv sync
uv venv
```

## Pre-conditions
### Install software and configurations
Please refer to [software preparation](docs/software.md).

## Run the application
**Steps**
- Copy `.env.example` to `.env` and modify the values accordingly.
- Run sparkplug mcp server
```bash
  uv run spb_server.py
```
- Run biz mcp server
```bash
  uv run biz_app.py
```
- Run main application
```bash
  uv run main.py
```
- Open http://localhost:8000/ in browser.
- Type questions in the chatbox.

## Demos
Refer to [doc](docs/demo_scenario.md) for detailed demo scenarios.

![](docs/ui_1.png)

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.

Maintenance

ActivityInactive
ResponsivenessNo issues