Lewm Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Lewm Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
MCP server for LeWorldModel — visual anomaly detection for Claude Code agents and other MCP clients.
Uses a JEPA-style ViT encoder to compute surprise scores between frames, enabling agents to detect unexpected UI changes, video anomalies, and state mismatches.
npx lewm-mcpOr install globally:
npm install -g lewm-mcp
lewm-mcpThe model runs in a Python subprocess. Install dependencies:
pip install torch transformers Pillow numpy
# For video analysis:
pip install opencv-pythonRemote inference: To run on a GPU/MPS server (e.g.100.105.97.18), startlewm-mcpthere and connect via MCP over SSH or Tailscale.
load_modelLoad the ViT encoder into memory. Call once before other tools.
{ "checkpoint": "/path/to/checkpoint" }Returns model info (param count, device, embed_dim, status).
get_model_statusCheck if the model is loaded, which checkpoint, param count, device (mps/cuda/cpu).
analyze_screenshotEncode a screenshot and compute surprise vs a previous frame.
{
"source": "/path/to/screenshot.png",
"previous_source": "/path/to/previous.png",
"anomaly_threshold": 2.0
}source accepts a file path or base64-encoded image data.
Returns: embedding, surprise_score, normalized_surprise, cosine_similarity, mse, anomaly.
compare_statesCompare expected vs actual screen states in embedding space.
{
"expected": "/path/to/expected.png",
"actual": "/path/to/actual.png",
"anomaly_threshold": 0.1
}Returns: cosine_similarity, mse, surprise_score, match, anomaly.
analyze_videoExtract frames from a video, run through ViT, return surprise timeline.
{
"video_path": "/path/to/recording.mp4",
"frame_sample_rate": 1,
"sigma_threshold": 2.0,
"top_n": 5
}Returns: timestamps, surprise_scores, normalized_scores, anomaly_windows, top_anomalies.
run_surprise_detectionFull pipeline on a directory of screenshots or a video file.
{
"directory": "/path/to/screenshots/",
"threshold_multiplier": 2.0
}Returns: timeline, exceeded_threshold, stats.
Claude Code agent
│
│ MCP (stdio)
▼
lewm-mcp (TypeScript)
│
│ stdin/stdout JSON protocol
▼
model.py (Python subprocess)
│
▼
transformers ViTModel (tiny: hidden=192, layers=3, patch=16)
runs on: mps → cuda → cpuThe Python process stays alive between tool calls — the model loads once and stays warm.
Add to ~/.claude/claude_desktop_config.json (or equivalent MCP config):
{
"mcpServers": {
"lewm-mcp": {
"command": "npx",
"args": ["lewm-mcp"]
}
}
}Default model: tiny ViT initialized with random weights.
hidden_size: 192num_hidden_layers: 3num_attention_heads: 3patch_size: 16image_size: 224Pass a checkpoint path to load_model to use a fine-tuned or pretrained checkpoint (must be a transformers ViTModel checkpoint).
| Variable | Default | Description |
|---|---|---|
LEWM_PYTHON | python3 | Python executable to use for model subprocess |
MIT
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.