cleanhar-mcp
# `cleanhar-mcp` — Correlation-Preserving HAR / cURL / JWT Sanitizer MCP Server + GitHub Action
[](https://glama.ai/mcp/servers/z121245017-ai/cleanhar-mcp)
Zero-dependency, 100% offline **Model Context Protocol (`MCP`) Server**, **CLI**, and **GitHub Action** enabling AI coding agents (Claude Desktop, Cursor, Windsurf, Antigravity) and CI pipelines to debug authentication race conditions, `4xx`/`5xx`/CORS failures, and DevTools `Copy as cURL` traces with **`0%` raw secret exposure**.
Instead of destructive `[REDACTED]` strings that hide token-refresh bugs, `cleanhar-mcp` replaces sensitive tokens with deterministic, ephemeral HMAC-SHA256 correlation tags such as `[JWT#1_9f4c · alg:HS256 · EXPIRED -10m]` vs `[JWT#2_3a81 · alg:HS256 · exp:+15m]`.
## MCP Tools Exposed (`stdio`)
| Tool | Purpose | Safety Annotations |
| :--- | :--- | :--- |
| `sanitize_har_archive` | Scrubs HAR 1.2 JSON (`log.entries` or single HAR entry) with correlation-preserving HMAC-SHA256 token tags across headers, cookies, query strings, JSON/form payloads, and Base64 response bodies so AI agents can debug auth race conditions with `0%` secret exposure. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
| `sanitize_curl_and_http_dump` | Scrubs browser DevTools `"Copy as cURL"` commands (including ANSI-C `$'...'` quoting), raw HTTP/1.1 traces, and `.env` / DSN strings into safe, shareable repro commands. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
| `diagnose_har_failures` | Extracts `4xx`/`5xx`/CORS/expired-JWT/slow requests, computes `P50`/`P95` waterfall latency, and generates sanitized GitHub/Jira Markdown incident summaries with reproducible `curl` commands. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
| `inspect_jwt_metadata_safe` | Decodes JWT `alg`, sanitized `iss` domain, and clock-skew/expiry status (`EXPIRED` vs `exp:+15m`, `alg:none`, `nbf` drift) without returning raw `sub`, PII claims, or signature bytes. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
## Quick Start (MCP Client & Local CLI)
```bash
# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/cleanhar-mcp
# List MCP tool schemas from terminal
npx -y github:z121245017-ai/cleanhar-mcp --list
# Scrub a DevTools cURL command from terminal
npx -y github:z121245017-ai/cleanhar-mcp --cli sanitize_curl_and_http_dump '{"rawInput":"curl https://api.acme.example/v1/orders -H \"Authorization: Bearer EXAMPLE_TOKEN_VALUE\""}'
```
### Claude Desktop / Cursor / Windsurf / Antigravity Config
```json
{
"mcpServers": {
"cleanhar": {
"command": "npx",
"args": ["-y", "github:z121245017-ai/cleanhar-mcp"]
}
}
}
```
### Docker (`node:22-alpine`, non-root `USER node`)
```bash
docker build -t cleanhar-mcp .
docker run -i --rm cleanhar-mcp
```
## GitHub Action (`z121245017-ai/cleanhar-mcp@v1`)
Add `cleanhar-mcp@v1` to `.github/workflows/` to block pull requests that accidentally commit unredacted `.har` captures, `curl` commands, `Authorization: Bearer` tokens, JWTs, `Cookie` headers, or live API keys inside test fixtures or Markdown docs—emitting inline `::error file=...,line=...::` PR annotations:
```yaml
name: CleanHAR Secret & HAR Leak Gate
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
har-and-curl-leak-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Block unredacted HAR captures, cURL dumps, and Bearer tokens
uses: z121245017-ai/cleanhar-mcp@v1
with:
paths: '.'
fail-on-secrets: 'true'
```
### Action Inputs & Outputs
| Name | Kind | Default | Description |
| :--- | :--- | :--- | :--- |
| `paths` | Input | `.` | Newline-, comma-, or space-separated files or directories to scan. |
| `fail-on-secrets` | Input | `true` | Exit `1` when unredacted credentials are found in `.har`, `.http`, `.curl`, `.json`, or `.md` files. |
| `ignore` | Input | `node_modules,.git,dist,build,coverage,vendor` | Comma-separated directory names skipped during recursive workspace scan. |
| `scanned-files` | Output | — | Number of HAR, HTTP, cURL, and documentation files inspected. |
| `secrets-found` | Output | — | Total count of unredacted credential leaks detected. |
| `report-json` | Output | — | Structured JSON summary of findings with file, line, kind, and masked preview. |
## Verification
```bash
npm test
```
## License
MIT License — `0` external npm dependencies, `0` network calls, `100%` local execution.
TDQS
Scored across 4 tools
The four tools have clearly distinct jobs: sanitizing HAR archives, sanitizing cURL/raw HTTP/.env/DSN inputs, inspecting JWT metadata safely, and diagnosing HAR failures. Although two tools both sanitize, their input types and outputs are explicitly differentiated.
All tool names use consistent snake_case with a leading verb followed by a noun phrase. The pattern is predictable: sanitize_*, inspect_*, and diagnose_*.
Four tools is well-scoped for a focused HAR sanitization and diagnostics server. Each tool covers a distinct workflow, and there are no redundant or filler tools.
The surface covers the core workflows: sanitizing HAR data, sanitizing related cURL/dump/DSN artifacts, safe JWT inspection, and HAR failure diagnosis. Minor gaps exist around generic log/console sanitization or configurable policy controls, but core use cases are covered.