slopbench-mcp
by lastnpcalex
README.md
# Slopbench
14-point forensic **Slopstrap** benchmark for AI agents, UI code (HTML, JSX/TSX, CSS), copy/Markdown, and live URLs.
> **Inspiration & Basis:** Slopbench is directly inspired by and based on [**Slopstrap**](https://slopstrap.mikelacher.com/) by Mike Lacher, expanded into a standalone **MCP server**, **CLI tool**, **Agent Skill**, and **companion Web Dashboard** with headless Chromium computed-style auditing.
---
## Features
- **Stdio MCP Server (`slopbench-mcp` / `mcp_server.py`):** Exposes 6 tools (`slopbench_analyze`, `slopbench_file`, `slopbench_url`, `slopbench_compare`, `slopbench_history`, `slopbench_spec`) for Claude Code, Claude Desktop, Codex, Cursor, Goose, Loom, and any MCP-compatible agent.
- **Agent Skill (`skills/slopbench/SKILL.md`):** Drop-in skill file teaching agents when and how to audit, interpret line-numbered evidence, and verify slop reduction.
- **CLI Tool (`slopbench` / `cli.py`):** Run audits, live URL scans, A/B comparisons, and rubric lookups directly from any terminal or CI pipeline.
- **Headless Chromium Live Scanner (Playwright):** Renders live `http(s)://` URLs or HTML files to measure `getComputedStyle()` (`backdropFilter`, `borderLeftWidth`, `backgroundClip`, font mismatches, grid tracks, wide SVG underlines, ambient blur orbs).
- **JSX/TSX & Tailwind v4 Support:** Parses `className={cn(...)}` tokens, `bg-linear-to-*`, `blur-[110px]`, `inset` left-border shadows, CSS `mask-image` squiggles, and `@property --angle` border beams.
- **SQLite WAL History & Leaderboard + Companion Web UI (`slopbench-server` / `server.py`):** Optional FastAPI dashboard on port `8106` with Analyzer, Live Scanner, A/B Compare, and Agent/Model Leaderboard.
---
## Installation
```bash
git clone <your-repo-url> slopbench
cd slopbench
pip install -e .
# Optional: enable headless Chromium live URL & computed-style scanning
pip install -e ".[browser]"
playwright install chromium
```
---
## 1. Use as an MCP Server
### Generic MCP Client (`mcpServers` JSON)
Works with Claude Desktop, Cursor, Windsurf, Cline, etc.:
```json
{
"mcpServers": {
"slopbench": {
"command": "python",
"args": ["/absolute/path/to/slopbench/mcp_server.py"]
}
}
}
```
Or if installed into your environment via `pip install -e .`:
```json
{
"mcpServers": {
"slopbench": {
"command": "slopbench-mcp"
}
}
}
```
### Claude Code / Codex
```bash
claude mcp add slopbench -- python /absolute/path/to/slopbench/mcp_server.py
```
### Loom (`exo.slopbench`)
`exo-extension.json` is included at the repository root. Register its path in Loom Admin (**Extensions** tab) to auto-attach `slopbench` to ordinary agent sessions and optionally run the companion dashboard.
### MCP Tools Exposed
| Tool | Purpose |
| --- | --- |
| `slopbench_analyze` | Score raw HTML, JSX/TSX, CSS, Markdown, or copy across all 14 Slopstrap elements, returning line-numbered evidence, de-slop fixes, and optional SQLite persistence (`save=True`). |
| `slopbench_file` | Read and benchmark a local file on disk (`render_browser=True` evaluates computed styles in headless Chromium for HTML files). |
| `slopbench_url` | Render a live `http(s)://` URL in headless Chromium and run computed-style + static Slopstrap checks. |
| `slopbench_compare` | Compare a `before` and `after` draft side-by-side (`delta`, `resolvedElements`, `introducedElements`). |
| `slopbench_history` | List recent benchmark runs, retrieve a saved run by `run_id`, or inspect per-agent/model leaderboard averages. |
| `slopbench_spec` | Return the 14-point Slopstrap rubric, scoring formula, and anti-pattern fixes. |
---
## 2. Use as an Agent Skill
Copy [`skills/slopbench/`](skills/slopbench/SKILL.md) into your agent harness's skills directory (for example `~/.claude/skills/slopbench/`, `~/.agents/skills/slopbench/`, or `.gemini/skills/slopbench/`):
```bash
cp -r skills/slopbench ~/.agents/skills/slopbench
```
---
## 3. Use as a CLI Tool
```bash
# Audit a local file (HTML, JSX/TSX, CSS, Markdown, or text)
slopbench analyze path/to/Hero.tsx
# Audit HTML with headless Chromium computed-style checks
slopbench analyze path/to/index.html --browser
# Audit a live URL
slopbench url http://127.0.0.1:3000/
# Compare before/after drafts
slopbench compare before.html after.html
# Print the 14-point rubric (add --json for machine-readable output)
slopbench spec
```
---
## 4. Companion Web Dashboard & HTTP API
```bash
slopbench serve --host 127.0.0.1 --port 8106
# or: python server.py --host 127.0.0.1 --port 8106
```
- `GET /` — Interactive Slopbench Dashboard (Analyzer, Manual Audit, Live Chromium URL Scanner, A/B Compare, Run Log & Leaderboard)
- `GET /health` — Service health & run totals
- `GET /llms.txt` — Agent quickstart & `curl` examples
- `GET /spec.md` — 14-point specification in Markdown
- `POST /api/analyze`, `POST /api/scan-url`, `POST /api/compare`
- `GET /api/runs`, `GET /api/runs/{id}`, `GET /api/leaderboard`
*(By default, `server.py` gates HTTP access to loopback and Tailscale CGNAT/ULA ranges; set `SLOPBENCH_ALLOW_ALL=1` to disable the network gate.)*
---
## Running Tests
```bash
pytest test_slopbench.py -v
```
---
## License
Licensed under the [MIT License](LICENSE).
Inspired by and based on [**Slopstrap**](https://slopstrap.mikelacher.com/) by Mike Lacher.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues