Skip to main content
Glama
README.md
# ๐Ÿญ Industry 4.0 Machine Health MCP Server

![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)
![NitroStack](https://img.shields.io/badge/NitroStack-Hackathon%202026-FF6B00?style=for-the-badge)
![MCP](https://img.shields.io/badge/MCP-Model%20Context%20Protocol-000000?style=for-the-badge)
![ChatGPT](https://img.shields.io/badge/ChatGPT-Integration-74AA9C?style=for-the-badge)

> **Bridging the gap between Industrial IoT Data and Conversational AI**

---

## ๐Ÿ“– Table of Contents

- [๐ŸŒŸ Overview](#-overview)
- [โš ๏ธ Problem Statement](#-problem-statement)
- [๐Ÿ’ก Solution & AI Integration](#-solution--ai-integration)
- [๐Ÿ”„ Architecture & Flow](#-architecture--flow)
- [๐Ÿ“‚ Project Structure](#-project-structure)
- [๐Ÿ› ๏ธ Available MCP Tools](#-available-mcp-tools)
- [๐Ÿš€ Getting Started (Local Setup)](#-getting-started-local-setup)
- [๐Ÿงช Testing via NitroStudio](#-testing-via-nitrostudio)
- [โ˜๏ธ Deployment & ChatGPT Integration](#-deployment--chatgpt-integration)
- [๐Ÿ”ฎ Future Scope](#-future-scope)
- [๐Ÿค Community & Links](#-community--links)

---

## ๐ŸŒŸ Overview

The **Industry 4.0 Machine Health MCP Server** is a Model Context Protocol (MCP) based application built for the **NitroStack Hackathon**. 

It empowers factory operators and managers to interact with complex industrial telemetry data using simple natural language via **ChatGPT**.

> Instead of navigating through complex dashboards, a user can simply ask:
>
> **"What is the current temperature of Machine 1?"**
>
> And ChatGPT will fetch the real-time data through this MCP server.

---

## โš ๏ธ Problem Statement

In Industry 4.0 environments, factory machines generate telemetry data such as temperature, vibration, and RPM. In production, this would typically live in a time-series database like **InfluxDB**.

Today, this demo runs against an in-memory `PlantDatabase` in `industry.data.ts`, which means:
- Data access is already standardized through MCP Tools
- Non-technical users can query it through ChatGPT
- The same tool contract can later target a real time-series database without changing the AI workflow

---

## ๐Ÿ’ก Solution & AI Integration

We created an **MCP Server** using the NitroStack SDK. This server exposes structured tools that ChatGPT can call directly, while all machine data is served from the in-memory `PlantDatabase` defined in `src/modules/industry/industry.data.ts`.

This keeps the AI layer decoupled from storage:
- MCP Tools define the contract
- `PlantDatabase` acts as the current data source
- A future InfluxDB connector can replace it without changing the AI workflow

---

## ๐Ÿ”„ Architecture & Flow

```mermaid
flowchart LR
    A["Factory Machines / IoT Sensors"] -->|Telemetry Data| B["PlantDatabase industry.data.ts"]
    B -->|In-Memory Mock Data| C["NitroStack MCP Server TypeScript"]
    C -->|"@Tool Functions"| D["NitroCloud Hosted Deployment"]
    D -->|Exposes Server URL| E["ChatGPT MCP Client"]
    E -->|Natural Language Query| F["End User"]

    style A fill:#ff9f43,color:#fff
    style B fill:#54a0ff,color:#fff
    style C fill:#5f27cd,color:#fff
    style D fill:#00d2d3,color:#fff
    style E fill:#10ac84,color:#fff
    style F fill:#feca57,color:#333
```

### Data Flow

```mermaid
sequenceDiagram
    participant U as "User"
    participant C as "ChatGPT"
    participant S as "MCP Server"
    participant DB as "PlantDatabase"

    U->>C: "What is the health of MCH-001?"
    C->>S: Calls get_machine_health tool
    S->>S: Validates input with Zod
    S->>DB: Reads from industry.data.ts
    DB-->>S: Returns machine data
    S-->>C: JSON response
    C-->>U: "Machine MCH-001 is running at 72C..."
```

---

## ๐Ÿ“‚ Project Structure

```
industry4-mcp/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts                       # Application bootstrap
โ”‚   โ”œโ”€โ”€ app.module.ts                  # Root application module
โ”‚   โ””โ”€โ”€ modules/
โ”‚       โ””โ”€โ”€ industry/                  # Industry 4.0 module
โ”‚           โ”œโ”€โ”€ industry.module.ts
โ”‚           โ”œโ”€โ”€ industry.tools.ts      # MCP Tools (get_machine_health)
โ”‚           โ”œโ”€โ”€ industry.prompts.ts    # Plant orchestrator prompt
โ”‚           โ””โ”€โ”€ industry.data.ts       # In-memory PlantDatabase
โ”œโ”€โ”€ widgets/                           # NitroStudio UI Widgets (Next.js)
โ”œโ”€โ”€ package.json                       # Dependencies (@nitrostack/core, zod)
โ””โ”€โ”€ .env                               # Environment variables
```

---

## ๐Ÿ› ๏ธ Available MCP Tools

The server currently exposes the following tool to the AI:

### `get_machine_health`

| Property | Description |
|----------|-------------|
| **Purpose** | Fetches current health status, temperature, and vibration level of a specific machine |
| **Input** | `machine_id: string` (e.g., `"MCH-001"`) |
| **Output** | JSON object with telemetry data |

#### Input Schema (Zod)

```typescript
{
  machine_id: z.string() // e.g., "MCH-001"
}
```

#### Response Format

```json
{
  "machine_id": "MCH-001",
  "temperature": 72.5,
  "vibration_level": 0.45,
  "health_status": "healthy",
  "last_maintenance": "2026-07-15"
}
```

---

## ๐Ÿš€ Getting Started (Local Setup)

### Prerequisites

- ๐ŸŸข **Node.js** (v18+ required, v20.x recommended by NitroStack)
- ๐Ÿ“ฆ **npm** or **npx**

### Installation

```bash
# 1. Clone the repository
git clone https://github.com/AryanPROOO/industry4-mcp.git
cd industry4-mcp

# 2. Install dependencies
npm install

# 3. Start the development server
npm run dev
```

The server will start running locally on the default STDIO/HTTP port.

---

## ๐Ÿงช Testing via NitroStudio

**NitroStudio** is the official desktop IDE to test MCP servers before deploying them.

1. ๐Ÿ“ฅ **Download & Install** โ€” Get NitroStudio from [nitrostack.ai/studio](https://nitrostack.ai/studio)
2. ๐Ÿ”‘ **Sign In** โ€” Use your NitroCloud account
3. โž• **Add Server** โ€” Click `Add Server` โ†’ Select `Nitro Project` tab
4. ๐Ÿ“ **Browse Project** โ€” Select the `industry4-mcp` folder
5. ๐Ÿ–ฅ๏ธ **Open App Canvas** โ€” Navigate to the Studio App Canvas
6. ๐Ÿ”ง **Test Tool** โ€” Go to `Tools` โ†’ Select `get_machine_health`
7. โ–ถ๏ธ **Execute** โ€” Input `MCH-001` and click **Execute Tool**

---

## โ˜๏ธ Deployment & ChatGPT Integration

Once the tool is working locally, it's time to make it live!

### Step 1: Deploy to NitroCloud

1. In **NitroStudio**, click the **Deploy** button in the header
2. Follow the modal steps:
   - ๐Ÿ“ฆ Preparing bundle
   - โฌ†๏ธ Uploading
   - ๐Ÿ”จ Building
   - โœ… Live
3. Copy your **Service URL**

### Step 2: Connect to ChatGPT

1. Open **ChatGPT** (Plus/Pro account required)
2. Go to **Settings โ†’ Plugins (Apps)** and enable **Developer Mode**
3. Click the **+ (Add Plugin)** button
4. Select **Server URL** as the connection type
5. Paste your Service URL and add `/sse` at the end:
   ```
   https://xyz.nitrocloud.app/sse
   ```
6. Click **Create** and then **Connect**

### Step 3: Talk to your Factory! ๐Ÿ—ฃ๏ธ

Try asking ChatGPT:

- ๐Ÿ’ฌ *"What is the health of machine MCH-001?"*
- ๐Ÿ’ฌ *"Is machine 4 running hot?"*
- ๐Ÿ’ฌ *"Which machines need maintenance?"*

---

## ๐Ÿ”ฎ Future Scope

| Feature | Description |
|---------|-------------|
| ๐Ÿ—„๏ธ **Live InfluxDB Integration** | Replace `PlantDatabase` with actual InfluxDB client queries for real time-series data |
| ๐Ÿ”ฎ **Predictive Maintenance** | Add tools that analyze historical data to predict machine failure |
| ๐Ÿ”” **Alerting System** | Trigger alerts to maintenance teams if vibration exceeds threshold |

---

## ๐Ÿค Community & Links

| Resource | Link |
|----------|------|
| ๐Ÿ“š **NitroStack Documentation** | [docs.nitrostack.ai](https://docs.nitrostack.ai) |
| โ˜๏ธ **NitroCloud** | [nitrocloud.ai](https://nitrocloud.ai) |
| ๐Ÿ’ฌ **NitroStack Discord** | [Join Community](https://discord.gg/uVWey6UhuD) |
| ๐Ÿ™ **NitroStack GitHub** | [github.com/nitrocloudofficial/nitrostack](https://github.com/nitrocloudofficial/nitrostack) |
| ๐Ÿ“น **YouTube** | [@nitrostackai](https://www.youtube.com/@nitrostackai) |
| ๐Ÿ’ผ **LinkedIn** | [nitrostack-ai](https://linkedin.com/company/nitrostack-ai) |

---

<div align="center">

**Built with โค๏ธ for the NitroStack Hackathon 2026**

*Empowering Industry 4.0 with Conversational AI*

</div>

TDQS

A3.6/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a clearly distinct domain: sensor normalization, flow rerouting, energy optimization, maintenance prediction, parameter adjustment, and compliance reporting. There is no overlap in purpose, and an agent can easily select the right tool based on the task.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., normalize_sensor_tags, optimize_energy_schedule, generate_compliance_audit_trail). This predictability makes the toolset easy to navigate and understand.

Tool Count5/5

With 6 tools, the server is well-scoped for an Industry 4.0 domain without being overwhelming. Each tool earns its place by covering a different aspect of smart manufacturing operations.

Completeness4/5

The toolset covers a broad set of Industry 4.0 use cases: data normalization, dynamic rerouting, energy optimization, predictive maintenance, quality control, and compliance. Minor gaps exist (e.g., no explicit production monitoring or batch tracking), but agents can work around them with the provided capabilities.

Maintenance

ActivitySlowing
ResponsivenessNo issues