Equipment Health MCP Server

Equipment Health MCP Server

An AI agent system that monitors manufacturing equipment health using the Model Context Protocol (MCP). Enables answering natural language questions about equipment status, maintenance, and anomalies through MCP tools.

Category
访问服务器

README

Equipment Health MCP Server

An AI agent system that monitors manufacturing equipment health using the Model Context Protocol (MCP). An LLM agent answers natural language questions about equipment by calling tools exposed through an MCP server — backed by real PostgreSQL data, RAG over equipment manuals, and a live observability dashboard.

Architecture

User Question
↓
AI Agent (LLaMA 3.3 70B via Groq)
↓
MCP Client
↓
MCP Server (Python MCP SDK)
↓
5 Tools
↓
PostgreSQL + ChromaDB
↓
Observability Layer → Streamlit Dashboard

Example agent conversations

Ask: Is equipment E004 showing any anomalies right now? → Yes, E004 (Lathe Machine D) has a temperature reading of 89.72C which exceeds the threshold of 80.0C. Anomaly detected.

Ask: Is E007 overdue for maintenance? → Yes, Compressor G has not been serviced in 90 days. Last event was a bearing replacement — vibration issue unresolved.

Ask: Which equipment has the highest average temperature this week? → E004 has the highest average temperature at 91.2C, significantly above the 80C safety threshold.

Ask: Flag an anomaly for E004 temperature reading of 91.5 → Anomaly successfully flagged for E004: temperature = 91.5 (threshold: 80.0)

5 MCP Tools

Tool Description
get_equipment_status Latest sensor readings with anomaly detection for temperature, vibration, and pressure
get_maintenance_history Last 5 maintenance events plus days since last service and overdue flag
flag_anomaly Log anomalous sensor readings to the database
get_production_metrics Aggregated min, max, and average metrics over a date range
query_knowledge_base RAG search over equipment manuals using ChromaDB

Tech Stack

Layer Technology
MCP Server Python MCP SDK
AI Agent LLaMA 3.3 70B via Groq API
REST API FastAPI with Swagger UI
Database PostgreSQL via SQLAlchemy
RAG ChromaDB + sentence-transformers
Observability JSONL logging + Streamlit dashboard
CI/CD GitHub Actions
Deployment Docker Compose

Project Structure

equipment-health-mcp/
├── server/
│   ├── main.py           # MCP server — registers and routes all 5 tools
│   ├── tools.py          # Tool implementations — all database queries
│   ├── database.py       # SQLAlchemy models and session management
│   ├── observability.py  # Logs every tool call to JSONL
│   └── api.py            # FastAPI REST layer on top of MCP tools
├── agent/
│   └── agent.py          # LLM agent that connects to MCP server
├── data/
│   ├── seed.py           # Populates 10 machines with 30 days of sensor data
│   ├── index_manuals.py  # Indexes manual text files into ChromaDB for RAG
│   └── manuals/          # Equipment manual text files for RAG
├── dashboard/
│   └── app.py            # Streamlit observability dashboard
├── tests/
│   └── test_tools.py     # Unit tests for all 5 tools
├── logs/
│   └── tool_calls.jsonl  # Auto-generated observability log
├── .github/
│   └── workflows/
│       └── ci.yml        # GitHub Actions CI pipeline
├── Dockerfile
├── docker-compose.yml
└── requirements.txt

Quick Start

1. Clone and install

git clone https://github.com/AankitPaudel/Equipment-Health-MCP
cd Equipment-Health-MCP
pip install -r requirements.txt

2. Configure environment

cp .env.example .env

Edit .env and add your Groq API key:

GROQ_API_KEY=your_groq_key_here
DATABASE_URL=postgresql://postgres:password@localhost:5432/equipment_db

3. Start the database and seed data

docker-compose up postgres -d
python -c "from server.database import init_db; init_db()"
python data/seed.py

4. Index the equipment manuals for RAG

python data/index_manuals.py

This creates the equipment_manuals ChromaDB collection used by the query_knowledge_base MCP tool.

5. Run the AI agent

python agent/agent.py

6. Run the REST API

uvicorn server.api:app --reload
# Swagger UI available at http://localhost:8000/docs

7. Run the observability dashboard

streamlit run dashboard/app.py
# Dashboard available at http://localhost:8501

8. Run with Docker Compose

docker-compose up

REST API Endpoints

Method Endpoint Description
GET /equipment/{id}/status Get current sensor readings
GET /equipment/{id}/maintenance Get maintenance history
POST /equipment/{id}/anomaly Flag an anomaly
GET /metrics Get production metrics over date range
GET /knowledge Search equipment manuals
GET /health Health check

RAG Knowledge Base

The knowledge base is populated from .txt manuals in data/manuals/. Run the indexer after adding or editing manuals:

python data/index_manuals.py

The script chunks the manuals and stores them in the local chroma_db/ directory. Tool 5, query_knowledge_base, searches that collection for manual-backed maintenance guidance.

Observability

Every tool call is logged automatically to logs/tool_calls.jsonl with:

  • Timestamp
  • Tool name
  • Input arguments
  • Response time in milliseconds
  • Success or failure status
  • Error message if failed

The Streamlit dashboard reads this log and displays live metrics including total calls, success rate, average response time, and a bar chart of calls per tool.

CI/CD

GitHub Actions runs on every push to main:

  • Spins up a real PostgreSQL instance
  • Installs all dependencies
  • Seeds the database
  • Runs all unit tests with pytest

Running Tests

python -m pytest tests/ -v

Why This Project

Many semiconductor manufacturers are implementing MCP to connect AI agents to production data, quality control systems, and maintenance records. This project demonstrates that architecture at a personal scale — showing how MCP enables AI agents to answer real operational questions using live manufacturing data without custom one-off integrations.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选