Skip to content

Commit d9784e5

Browse files
committed
v0.5.0: Multi-format support, ML dedup, code quality & docs update
Added: - Multi-format signal loading (CSV, MAT, WAV, NPY, Parquet) via unified load_signal_data() - python -m predictive_maintenance_mcp entry point (__main__.py) - Ollama integration guide (docs/OLLAMA_GUIDE.md) - 3 Copilot Skills (bearing-diagnosis, quick-screening, report-generation) - MANIFEST.in updated for new data formats Changed: - ML training code deduplicated (4 shared helpers, ~163 statements removed) - PyPDF2 migrated to pypdf - ISO metadata double-read eliminated - pd.read_csv calls hardened with engine/dtype/on_bad_lines - pytest config consolidated into pyproject.toml (pytest.ini removed) - Version bumped 0.4.1 -> 0.5.0 across all files - Comprehensive docs update (README, CHANGELOG, QUICKSTART, CONTRIBUTING, INSTALL) Fixed: - Envelope analysis band_start/band_end validation - FFT frequency axis off-by-one - ISO unit-confirmation flow - ML predict tool missing model guard - Anomaly plot data alignment Tests: 44 passed, 3 skipped, 0 warnings
1 parent c25882e commit d9784e5

33 files changed

+1116
-570
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ STATISTICS_WINDOW_SIZE=1024 # For windowed statistics (future feature)
2222

2323
# Server configuration
2424
SERVER_NAME=Predictive Maintenance
25-
SERVER_VERSION=0.4.1
25+
SERVER_VERSION=0.5.0

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ venv.bak/
4343
# Testing
4444
.pytest_cache/
4545
.coverage
46+
coverage.xml
4647
htmlcov/
4748
*.cover
4849
.hypothesis/
50+
tests/data/
4951

5052
# ML Models (generated during testing)
5153
models/*.pkl

CHANGELOG.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ All notable changes to the Predictive Maintenance MCP Server project will be doc
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.0] - 2026-02-16
9+
10+
### Added
11+
- **Multi-format signal loading**`load_signal_data()` now supports CSV, TXT, NPY, MAT (MATLAB), WAV, and Parquet formats
12+
- **`__main__.py`** — Server can now be run as `python -m predictive_maintenance_mcp`
13+
- **Ollama Guide** added to documentation table in README
14+
15+
### Changed
16+
- **Unified signal loading** — All 16 `pd.read_csv()` call sites refactored to use `load_signal_data()`, enabling all tools to accept any supported format
17+
- **ML code deduplication** — Extracted 4 helper functions (`_resolve_sampling_rate`, `_segment_and_extract_features`, `_extract_features_from_files`, `_extract_and_transform_validation_features`), reducing ~163 statements in `train_anomaly_model`
18+
- **ISO metadata consolidation**`evaluate_iso_20816` now reads metadata file once instead of twice
19+
- **PyPDF2 → pypdf migration** — Replaced deprecated PyPDF2 with pypdf in `document_reader.py`
20+
- **Pytest config consolidation** — Merged `pytest.ini` into `pyproject.toml` (`[tool.pytest.ini_options]`)
21+
- **Logging to stderr** — Server logging now uses `stderr` to avoid polluting MCP stdio transport
22+
- **Report filenames**`report_generator.py` uses `Path.stem` for all filename sanitizations
23+
24+
### Fixed
25+
- **Packaging** — Corrected `pyproject.toml` package-dir mapping (`src/``predictive_maintenance_mcp`)
26+
- **Metadata paths**`get_metadata_path()` now uses `Path.stem` to work with all signal extensions
27+
- **Plot output directories** — Report generator creates output directories before writing files
28+
- **Flaky ML test** — Fixed `test_predict_anomalies` instability with deterministic seed
29+
830
## [0.4.1] - 2026-02-15
931

1032
### Fixed
@@ -116,14 +138,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
116138

117139
## Roadmap
118140

119-
### Planned for v0.5.0
141+
### Planned for v0.6.0
120142
- **📦 Docker image** for zero-install setup
121-
- **📂 Parquet/HDF5 data format support**
122143
- **📏 Customizable ISO report thresholds**
123144
- Multi-signal comparison tools
124145
- Advanced trending and monitoring
125146
- Additional diagnostic workflows (pumps, motors, gearboxes)
126-
- Enhanced ML models with hyperparameter tuning
127147
- Extended dataset with more fault types
128148

129149
### Future Enhancements

CITATION.cff

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cff-version: 1.2.0
22
message: "If you use this software, please cite it as below."
33
title: "Predictive Maintenance MCP Server: An open-source framework for integrating Large Language Models with predictive maintenance and fault diagnosis workflows"
4-
version: 0.4.1
5-
date-released: 2026-02-15
4+
version: 0.5.0
5+
date-released: 2026-02-16
66
authors:
77
- family-names: Di Maggio
88
given-names: Luigi Gianpio
@@ -52,7 +52,7 @@ preferred-citation:
5252
- family-names: Di Maggio
5353
given-names: Luigi Gianpio
5454
year: 2025
55-
version: 0.4.1
55+
version: 0.5.0
5656
repository-code: "https://github.com/LGDiMaggio/predictive-maintenance-mcp"
5757
license: MIT
5858
doi: "10.5281/zenodo.17611542"

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Closes #42"
232232

233233
| Task | What You'll Learn | Issue |
234234
|------|-------------------|-------|
235-
| **Add Parquet data format support** | Signal loading pipeline, pandas I/O | [Browse issues](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
235+
| ~~**Add Parquet data format support**~~ | ~~Signal loading pipeline, pandas I/O~~ | ✅ Done in v0.5.0 |
236236
| **Make ISO thresholds configurable** | Tool parameter design, ISO standard | [Browse issues](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
237237
| **Add unit conversion tool** | MCP tool pattern, unit systems | [Browse issues](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
238238
| **Improve error messages** | Error handling best practices | [Browse issues](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
@@ -315,7 +315,7 @@ What actually happens (include full error message)
315315
**Environment:**
316316
- OS: Windows 11 / macOS 14 / Ubuntu 22.04
317317
- Python: 3.11.x / 3.12.x
318-
- Server version: 0.4.1
318+
- Server version: 0.5.0
319319
```
320320

321321
---

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ pip install -e .
186186
-`"command": "C:/path/.venv/Scripts/python.exe"` (Windows)
187187
-`"command": "/path/.venv/bin/python"` (macOS/Linux)
188188

189-
4. **Don't use `-m` module import**: The package isn't installed as a module:
190-
- `"args": ["-m", "machinery_diagnostics_server"]`
189+
4. **Module import**: If installed via `pip install -e .`, you can also use:
190+
- `"args": ["-m", "predictive_maintenance_mcp"]`
191191
-`"args": ["C:/path/src/machinery_diagnostics_server.py"]`
192192

193193
5. **Restart Claude Desktop completely** after config changes

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ include CHANGELOG.md
77
include INSTALL.md
88

99
# Include configuration files
10-
include pytest.ini
1110
include pyproject.toml
1211
include setup_venv.py
1312

1413
# Include data files
15-
recursive-include data *.csv *.json *.txt
14+
recursive-include data *.csv *.json *.txt *.mat *.wav *.npy *.parquet
1615
recursive-include data/signals/samples README.md
1716

1817
# Include tests

README.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ This project is built around the **Model Context Protocol (MCP)** — an open st
9292
- [🚀 Installation](#-installation)
9393
- [⚙️ Configuration](#️-configuration)
9494
- [🔧 Available Tools & Resources](#-available-tools--resources)
95+
- [🤖 Copilot Skills](#copilot-skills-guided-workflows)
9596
- [📐 Detailed Architecture](#-detailed-architecture)
9697
- [📊 Sample Dataset](#-sample-dataset)
9798
- [💡 Usage Examples](#-usage-examples)
@@ -163,14 +164,16 @@ This project serves two audiences. Pick the door that fits you:
163164
![ISO Compliance](assets/iso.png)
164165
- **🔍 Advanced Diagnostics** — FFT spectrum analysis, envelope analysis for bearing faults, time-domain feature extraction
165166
<details>
167+
166168
<summary><b>Example analysis</b></summary>
167169

168170
![Envelope analysis 1](assets/envelope_analysis.png)
169171
![Envelope analysis 2](assets/envelope_signals.png)
170172
![Envelope analysis 3](assets/envelope_list.png)
171173

172174
</details>
173-
- **🚀 Zero Configuration** — Works out of the box with sample data, auto-detects sampling rates from metadata
175+
- **� Multi-Format Support** — Load signals from CSV, MAT (MATLAB), WAV, NPY, and Parquet files
176+
- **�🚀 Zero Configuration** — Works out of the box with sample data, auto-detects sampling rates from metadata
174177

175178
---
176179

@@ -247,6 +250,14 @@ cd predictive-maintenance-mcp
247250
pip install -e .
248251
```
249252

253+
### Run as Module
254+
255+
After installation, you can also run the server directly:
256+
257+
```bash
258+
python -m predictive_maintenance_mcp
259+
```
260+
250261
---
251262

252263
## ⚙️ Configuration
@@ -307,7 +318,7 @@ Resources provide **direct read access** for Claude to examine data:
307318
<summary><b>📊 Vibration Signals</b></summary>
308319

309320
- **`signal://list`** — Browse all available signal files with metadata
310-
- **`signal://read/{filename}`** — Read signal data directly (first 1000 samples preview)
321+
- **`signal://read/{filename}`** — Read signal data directly (supports CSV, MAT, WAV, NPY, Parquet)
311322

312323
**Usage:** Claude can directly read signals without calling tools first.
313324

@@ -390,6 +401,20 @@ Tools perform **computations and generate outputs**:
390401

391402
---
392403

404+
### Copilot Skills (Guided Workflows)
405+
406+
The `skills/` directory contains pre-built guided workflows that orchestrate multiple MCP tools into structured diagnostic procedures:
407+
408+
| Skill | Steps | Description |
409+
|-------|:-----:|-------------|
410+
| [**bearing-diagnosis**](skills/bearing-diagnosis/SKILL.md) | 8 | Complete bearing fault detection: statistics → FFT → envelope → frequency matching → ISO severity → report |
411+
| [**quick-screening**](skills/quick-screening/SKILL.md) | 5 | Fast health screening with clear Healthy/Suspicious/Critical classification |
412+
| [**report-generation**](skills/report-generation/SKILL.md) | 6 | Professional HTML report generation with composite multi-report option |
413+
414+
> 💡 Skills are standalone markdown files that any MCP-compatible LLM client can use as system instructions to coordinate multi-step diagnostic workflows.
415+
416+
---
417+
393418
## 📐 Detailed Architecture
394419

395420
The system follows a **hybrid MCP architecture** combining Resources (direct data access) and Tools (computational processing):
@@ -437,7 +462,7 @@ The system follows a **hybrid MCP architecture** combining Resources (direct dat
437462
│ SIGNAL ANALYSIS │ │ DOCUMENT READER MODULE │
438463
│ MODULE │ │ ┌────────────┐ ┌────────────┐ │
439464
│ • FFT Engine │ │ │ PDF Extract│ │ ISO Formulas│ │
440-
│ • Envelope │ │ │ (PyPDF2) │ │ BPFO/BPFI │ │
465+
│ • Envelope │ │ │ (pypdf) │ │ BPFO/BPFI │ │
441466
│ • Filters │ │ └────────────┘ └────────────┘ │
442467
│ • Statistics │ │ ┌─────────────────────────────┐ │
443468
│ • ML Models │ │ │ Bearing Catalog DB │ │
@@ -467,7 +492,8 @@ The system follows a **hybrid MCP architecture** combining Resources (direct dat
467492

468493
**Key Features:**
469494
-**4 MCP Resources** — Direct read access to signals and manuals
470-
-**25+ MCP Tools** — Complete diagnostic workflow
495+
-**25 MCP Tools** — Complete diagnostic workflow
496+
-**4 MCP Prompts** — Guided diagnostic workflows
471497
-**Hybrid Architecture** — Resources for reading, Tools for processing
472498
-**Local-First** — All data stays on your machine (privacy-preserving)
473499

@@ -568,8 +594,10 @@ Generate FFT report for baseline_1.csv
568594
| [EXAMPLES.md](EXAMPLES.md) | Everyone | Complete diagnostic workflows with step-by-step tutorials |
569595
| [INSTALL.md](INSTALL.md) | Everyone | Detailed installation and troubleshooting guide |
570596
| [CONTRIBUTING.md](CONTRIBUTING.md) | Contributors | How to contribute (for every skill level) |
597+
| [Ollama Guide](docs/OLLAMA_GUIDE.md) | Engineers | Use with local LLMs (fully air-gapped) |
571598
| [CHANGELOG.md](CHANGELOG.md) | Everyone | Version history |
572599
| [data/README.md](data/README.md) | Everyone | Dataset documentation |
600+
| [skills/](skills/) | 🤖 LLM Clients | Copilot Skills — guided diagnostic workflows (bearing, screening, reporting) |
573601

574602
---
575603

@@ -642,21 +670,21 @@ uv run mcp dev src/machinery_diagnostics_server.py
642670

643671
## 🚀 Roadmap
644672

645-
### ✨ Recent: v0.2.1Machine Documentation Reader
673+
### ✨ Recent: v0.5.0Code Quality & Multi-Format Support
646674

647-
AI-powered extraction of machine specifications from equipment manuals:
648-
- 📄 **Direct PDF Access** via MCP Resources
649-
- 🔍 **Smart Extraction**Regex patterns for bearings, RPM, power ratings
650-
- 🧮 **Auto-Calculation**Bearing fault frequencies from geometry (ISO 15243:2017)
651-
- 💾 **Caching System**Fast repeated queries with JSON caching
675+
- 📂 **Multi-format signal loading** — CSV, MAT, WAV, NPY, Parquet via unified `load_signal_data()`
676+
- 🔧 **ML code deduplication** — 4 helper functions reduce ~163 statements
677+
- 📦 **pypdf migration**Replaced deprecated PyPDF2 with pypdf
678+
- ▶️ **`python -m` support**Run as `python -m predictive_maintenance_mcp`
679+
- 🧹 **Consolidated metadata reads**ISO evaluation no longer double-reads metadata files
652680

653681
### 🔮 Planned Enhancements
654682

655683
Each item below links to an open issue where you can **discuss, contribute, or claim the task**:
656684

657685
| Priority | Enhancement | Status | Get Involved |
658686
|----------|-------------|--------|--------------|
659-
| 🔴 High | **Parquet/HDF5 data format support** | Open | [Good First Issue](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
687+
| ✅ Done | **Parquet/MAT/WAV/NPY data format support** | v0.5.0 | |
660688
| 🔴 High | **Customizable ISO report thresholds** | Open | [Good First Issue](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
661689
| 🔴 High | **Docker image for zero-install setup** | Open | [Help Wanted](https://github.com/LGDiMaggio/predictive-maintenance-mcp/issues) |
662690
| 🟡 Medium | **Vector search for large documents** (ChromaDB/FAISS) | Planned | [Discuss](https://github.com/LGDiMaggio/predictive-maintenance-mcp/discussions) |
@@ -707,7 +735,7 @@ If you use this server in your research or projects, please cite:
707735
title = {Predictive Maintenance MCP Server: An open-source framework for integrating Large Language Models with predictive maintenance and fault diagnosis workflows},
708736
author = {Di Maggio, Luigi Gianpio},
709737
year = {2025},
710-
version = {0.4.1},
738+
version = {0.5.0},
711739
url = {https://github.com/LGDiMaggio/predictive-maintenance-mcp},
712740
doi = {10.5281/zenodo.17611542}
713741
}

SECURITY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
| Version | Supported |
66
| ------- | ------------------ |
7+
| 0.5.x | :white_check_mark: |
78
| 0.4.x | :white_check_mark: |
8-
| 0.3.x | :white_check_mark: |
9-
| 0.2.x | :x: |
10-
| < 0.2 | :x: |
9+
| 0.3.x | :x: |
10+
| < 0.3 | :x: |
1111

1212
## Reporting a Vulnerability
1313

data/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ Perfect for:
2121

2222
## 📁 Directory Structure
2323

24-
- **`signals/`** - Processed CSV signals ready for analysis (exposed via MCP resources)
24+
- **`signals/`** - Signal files ready for analysis (CSV, MAT, WAV, NPY, Parquet — exposed via MCP resources)
2525
- `real_train/` - Training dataset (2 healthy + 12 faulty signals)
2626
- `real_test/` - Test dataset for validation (1 healthy + 5 faulty signals)
2727
- **`real_bearings/`** - Source MAT files from MathWorks (archive only, not used by MCP server)
2828
- `train/` - Original MATLAB .mat files
2929
- `test/` - Original MATLAB .mat files
3030

31-
> **Note**: The MCP server only uses CSV files in `signals/` directory. The `real_bearings/` folder is kept as source archive.
31+
> **Note**: The MCP server reads signal files from the `signals/` directory (supports CSV, MAT, WAV, NPY, Parquet). The `real_bearings/` folder is kept as source archive.
3232
3333
## 📊 Dataset Information
3434

0 commit comments

Comments
 (0)