
Motor Current Signature Analysis
io.github.LGDiMaggioPublished by GitHub account LGDiMaggiov0.2.1Updated Oct 24, 2026
MCP server for Motor Current Signature Analysis — fault detection in electric motors
Overview
A local MCP server for Motor Current Signature Analysis that lets an assistant load motor current signals, run spectral analysis and classify motor faults.
- What you can do
- Inspect and load current signals from CSV, TSV, WAV or NumPy files, and generate synthetic test signals with injected faults, storing them under short IDs on disk and listing or clearing stored data. Compute motor parameters (slip, synchronous speed, rotor frequency) and expected fault and bearing defect frequencies. Preprocess signals with DC removal, filtering, normalisation and windowing. Compute FFT spectra, Welch PSD, spectral peaks, band energy, Hilbert envelope spectra and STFT time-frequency views. Detect broken rotor bars, eccentricity, stator faults and bearing faults with severity classification, or run a full one-shot diagnosis from a file or stored signal.
- When to use it
- Useful for predictive-maintenance and condition-monitoring work on electric motors, where you want an assistant to analyse measured stator-current recordings, check expected fault frequencies, or produce a severity-classified diagnostic report without vibration sensors or downtime.
- Requirements
- Runs locally over stdio as a Python package (mcp-server-mcsa), typically launched with uvx or pip; no accounts, API keys or headers are declared. Signal files must be supplied by the user. Stored data goes to ~/.mcsa_data/ by default, configurable via the MCSA_DATA_DIR environment variable.
Installation
In SourceWeft
- Open Motor Current Signature Analysis in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
mcp-server-mcsa
[License: MIT] [Python 3.10+] [MCP]
A Model Context Protocol (MCP) server for Motor Current Signature Analysis (MCSA) — non-invasive spectral analysis and fault detection in electric motors using stator-current signals.
mcp-server-mcsa turns any LLM into a predictive-maintenance expert. By integrating advanced techniques such as Fast Fourier Transform (FFT) and envelope analysis, the system can listen to a motor's electrical signature and automatically identify mechanical and electrical anomalies — all through natural language.
MCSA is an industry-standard condition-monitoring technique that analyses the harmonic content of the stator current to detect rotor, stator, bearing, and air-gap faults in electric motors — without requiring vibration sensors, downtime, or physical access to the machine. This server brings the full MCSA diagnostic workflow to any MCP-compatible AI assistant (Claude Desktop, VS Code Copilot, and others), enabling both interactive expert analysis and automated condition-monitoring pipelines.
Features
- Real signal loading — read measured data from CSV, TSV, WAV, and NumPy
.npyfiles - Motor parameter calculation — slip, synchronous speed, rotor frequency from nameplate data
- Fault frequency computation — broken rotor bars, eccentricity, stator faults, mixed eccentricity
- Bearing defect frequencies — BPFO, BPFI, BSF, FTF from bearing geometry
- Signal preprocessing — DC removal, normalisation, windowing, bandpass/notch filtering
- Spectral analysis — FFT spectrum, Welch PSD, spectral peak detection
- Envelope analysis — Hilbert-transform demodulation for mechanical/bearing faults
- Time-frequency analysis — STFT with frequency tracking for non-stationary conditions
- Fault detection — automated severity classification (healthy / incipient / moderate / severe)
- One-shot diagnostics — full pipeline from signal array or directly from file
- Test signal generation — synthetic signals with configurable fault injection for demos and benchmarking
- Persistent data store — signals and spectra saved to
~/.mcsa_data/as compressed.npzfiles; referenced by short IDs (sig_xxxx,spec_xxxx) to keep large arrays out of the chat context; data survives server restarts
Tools (21)
Resources
Prompts
Installation & Setup
Step 1 — Install uv (one-time, if you don't have it)
uv is the recommended Python package manager. It handles everything (Python, packages, virtual environments) in a single tool and is used throughout the MCP ecosystem.
Windows (PowerShell):
macOS / Linux:
After installing, restart your terminal so the
uv/uvxcommands are available.
Step 2 — Verify it works
You should see the help text. That's it — no pip install needed. uvx downloads and runs the package automatically in an isolated environment.
Step 3 — Add to your MCP client
Pick your client and add the configuration below. No other steps are required.
Claude Desktop
Open the config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add mcsa inside the mcpServers object (create the file if it doesn't exist):
Then restart Claude Desktop.
VS Code (Copilot / Continue)
Create (or edit) .vscode/mcp.json in your workspace:
Cursor
Go to Settings → MCP Servers → Add new server:
- Type:
command - Command:
uvx mcp-server-mcsa
Step 4 — Test
In your MCP client, try:
"Generate a test signal with a broken rotor bar fault and run a full diagnosis. Motor: 4 poles, 50 Hz, 1470 RPM."
If the server responds with a diagnostic report, you're all set.
Alternative: install with pip (not recommended — see note)
Then configure your client with:
⚠️ Common issue on Windows: if you installed Python from the Microsoft Store, the
mcp-server-mcsacommand may not be in your PATH, causing a "server disconnected" error. In that case, find your Python path withpython -c "import sys; print(sys.executable)"and use the full path in the config:Using
uvxavoids this problem entirely.
Alternative: install from source (for development)
Configure the client to point to the local repo:
Run tests:
Debug with MCP Inspector:
Troubleshooting
Data Store
Signals and spectra are persisted to disk as compressed .npz files
in ~/.mcsa_data/ (configurable via the MCSA_DATA_DIR environment
variable). This means:
- Large arrays never enter the chat — only short IDs (
sig_xxxx,spec_xxxx) and compact summaries are returned to the LLM. - Data survives server restarts — reopen Claude Desktop tomorrow and your signals are still there.
- All data in one place — loaded measurements and generated test signals live side by side in the same folder.
Use list_stored_data to see everything on disk and clear_stored_data
to remove items.
Usage Examples
Real Signal — One-Shot Diagnosis
The fastest way to analyse a measured signal is the diagnose_from_file
tool. Simply provide the file path and motor nameplate data:
"Diagnose the motor from
C:\data\motor_phaseA.csv— 50 Hz supply, 4 poles, 1470 RPM"
The server loads the file, preprocesses the signal, computes the spectrum, runs all fault detectors, and returns a complete JSON report with severity-classified results.
Step-by-Step Workflow (with signal IDs)
-
Load a measured signal (or generate a synthetic one):
"Load the signal from
measurement.wav" → returnssignal_id: sig_a1b2or: "Generate a test signal with a broken-rotor-bar fault" →sig_c3d4 -
Calculate motor parameters:
"Calculate motor parameters for a 4-pole motor, 50 Hz supply, running at 1470 RPM"
-
Compute expected fault frequencies:
"What are the expected fault frequencies for this motor?"
-
Preprocess the signal:
"Preprocess signal sig_a1b2" → returns new
signal_id: sig_e5f6 -
Analyse the spectrum:
"Compute the FFT spectrum of sig_e5f6" → returns
spectrum_id: spec_g7h8 -
Detect specific faults:
"Check for broken rotor bars in spec_g7h8"
-
Envelope analysis (optional):
"Compute the envelope spectrum of sig_e5f6"
Quick Diagnosis from Stored Signal
The run_full_diagnosis tool runs the entire pipeline on a stored signal
in a single call:
Bearing Analysis
For bearing fault analysis, you need the bearing geometry (number of balls, ball diameter, pitch diameter, contact angle). The server will:
- Calculate characteristic defect frequencies (BPFO, BPFI, BSF, FTF)
- Compute expected current sidebands
- Search the spectrum for those sidebands
Supported File Formats
Fault Detection Theory
Broken Rotor Bars (BRB)
Sidebands at $(1 \pm 2s) \cdot f_s$ where $s$ is slip and $f_s$ is supply frequency. Severity is classified by the dB ratio of sideband to fundamental amplitude.
Eccentricity
Sidebands at $f_s \pm k \cdot f_r$ where $f_r$ is the rotor mechanical frequency.
Stator Inter-Turn Faults
Sidebands at $f_s \pm 2k \cdot f_r$ due to winding asymmetry.
Bearing Defects
Torque oscillations modulate the stator current, creating sidebands at $f_s \pm k \cdot f_{defect}$. Defect frequencies depend on bearing geometry (BPFO, BPFI, BSF, FTF).
Severity Thresholds (dB below fundamental)
Note: These are general guidelines. Actual thresholds should be adapted to the specific motor, load, and application based on baseline measurements.
Development
Setup
Run tests
Run with MCP Inspector
Lint and type check
Dependencies
- mcp — Model Context Protocol SDK
- numpy — numerical computing
- scipy — signal processing (FFT, filtering, Hilbert transform)
- pydantic — data validation
Documentation
For a detailed reference of every tool, resource, and prompt — including parameter tables, diagnostic workflows, integration patterns, and severity thresholds — see the Usage Guide.
Citation
If you use this software in your research, please cite it:
GitHub shows a "Cite this repository" button automatically from the
CITATION.cfffile.
License
MIT — see LICENSE for details.
Source: README.md at commit d8aabc7
Tools
0Version history
1- v0.2.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts