npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lewm-mcp

v0.1.0

Published

MCP server for LeWorldModel — visual anomaly detection for Claude Code agents

Readme

lewm-mcp

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.

Quick start

npx lewm-mcp

Or install globally:

npm install -g lewm-mcp
lewm-mcp

Python requirements

The model runs in a Python subprocess. Install dependencies:

pip install torch transformers Pillow numpy
# For video analysis:
pip install opencv-python

Remote inference: To run on a GPU/MPS server (e.g. 100.105.97.18), start lewm-mcp there and connect via MCP over SSH or Tailscale.

Tools

load_model

Load 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_status

Check if the model is loaded, which checkpoint, param count, device (mps/cuda/cpu).

analyze_screenshot

Encode 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_states

Compare 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_video

Extract 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_detection

Full pipeline on a directory of screenshots or a video file.

{
  "directory": "/path/to/screenshots/",
  "threshold_multiplier": 2.0
}

Returns: timeline, exceeded_threshold, stats.

Architecture

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 → cpu

The Python process stays alive between tool calls — the model loads once and stays warm.

Configure in Claude Code

Add to ~/.claude/claude_desktop_config.json (or equivalent MCP config):

{
  "mcpServers": {
    "lewm-mcp": {
      "command": "npx",
      "args": ["lewm-mcp"]
    }
  }
}

Model details

Default model: tiny ViT initialized with random weights.

  • hidden_size: 192
  • num_hidden_layers: 3
  • num_attention_heads: 3
  • patch_size: 16
  • image_size: 224

Pass a checkpoint path to load_model to use a fine-tuned or pretrained checkpoint (must be a transformers ViTModel checkpoint).

Environment variables

| Variable | Default | Description | |---|---|---| | LEWM_PYTHON | python3 | Python executable to use for model subprocess |

License

MIT