header-replay
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@header-replay scan example.com and simulate a strict CSP to see what breaks"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
header-replay
Rehearse HTTP security headers in a real browser before you ship them.
header-replay opens your page in Chromium, applies candidate response headers
locally, and compares it with the real response. It shows CSP violations,
failed requests, JavaScript errors and before/after screenshots, then suggests
the smallest policy change that would unblock the page.
No server changes. No proxy. No deploy-and-pray.
Why
A security-header scanner can tell you that a header is missing. It cannot tell you whether fixing it will break login, checkout, analytics or a third-party widget. That is why CSP rollouts stall.
header-replay tests the browser behavior directly:
Load the real page as a baseline.
Load it again with your candidate headers injected into every response.
Capture CSP violation events, failed requests and JavaScript errors.
Report only issues that appear with the candidate policy.
Export a self-contained HTML report with evidence and screenshots.
Related MCP server: web-security-guard
Install
With uv:
uv tool install git+https://github.com/htsecurity/header-replay.git
header-replay setupsetup downloads the Chromium build used by Playwright. On Linux, use
header-replay setup --with-deps if the system libraries are missing.
Or with pipx:
pipx install git+https://github.com/htsecurity/header-replay.git
header-replay setupUsage
See what a site currently sends:
header-replay scan https://example.com
header-replay scan https://example.com --jsonTest a CSP without touching the server:
header-replay simulate https://example.com \
--csp "default-src 'self'; script-src 'self'; object-src 'none'"Test an HSTS value or several headers:
header-replay simulate https://example.com \
--hsts \
--header "X-Content-Type-Options: nosniff" \
--header "Referrer-Policy: strict-origin-when-cross-origin"Start from a practical baseline set:
header-replay simulate https://example.com --strict-baselineGenerate an HTML report:
header-replay simulate https://example.com \
--csp "default-src 'self'; script-src 'self'" \
--format html --output header-report.htmlUse a headers file:
{
"Content-Security-Policy": "default-src 'self'; script-src 'self'",
"X-Content-Type-Options": "nosniff"
}header-replay simulate https://example.com --headers-file headers.jsonTest a local app:
header-replay simulate http://localhost:3000 \
--allow-private \
--csp "default-src 'self'; script-src 'self'"Output formats
text: terminal summary and recommendations.json: full structured report for automation.html: self-contained report with before/after screenshots.
Exit codes:
0: no new browser issue observed.1: the candidate caused new CSP violations, failed requests or JS errors.2: invalid input, network/browser error or AI configuration error.
AI review (real models, optional)
The simulation is deterministic. AI is only used when you ask for a second opinion:
# Local first
header-replay simulate https://example.com --csp "default-src 'self'" --ai-review
# Specific local model
header-replay simulate https://example.com --csp "default-src 'self'" \
--ai-review --ai-provider ollama --model qwen2.5:14b
# OpenRouter
export OPENROUTER_API_KEY=...
header-replay simulate https://example.com --csp "default-src 'self'" \
--ai-review --ai-provider openrouterThe model receives the candidate headers, violations and recommendations, not the page HTML or screenshots. It returns structured JSON with a risk level, whether the policy looks safe for the tested flow, and concrete changes.
Example from a real local run:
AI review (ollama/qwen2.5:14b): medium risk · safe_to_deploy=False
The current CSP blocks necessary resources and inline scripts, leading to
functional issues.That run used 1,269 prompt tokens and 191 completion tokens. The models
command lists local Ollama models and live OpenRouter models with prices:
header-replay models --provider openrouterMCP server
header-replay exposes the same functionality to Claude, Cursor and other MCP
clients:
Tool | Purpose |
| Read the current response headers. |
| Run a real-browser before/after simulation. |
| Ask a real LLM to review the simulation. |
| List headers and recommended starting values. |
| List local and hosted models. |
Claude Code:
claude mcp add header-replay -- uvx --from git+https://github.com/htsecurity/header-replay header-replay-mcpClaude Desktop / Cursor:
{
"mcpServers": {
"header-replay": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/htsecurity/header-replay",
"header-replay-mcp"
]
}
}
}Run header-replay setup once before using the MCP server so Chromium is
available.
GitHub Action
Test a preview deployment before merging:
- uses: htsecurity/header-replay@v0.1.0
with:
url: https://preview.example.com
headers: '{"Content-Security-Policy":"default-src ''self''; script-src ''self'' ''https://cdn.example.com''"}'
fail-on-violation: trueFor local/private preview URLs, set allow-private: true only when the runner
can reach that URL and it is your own app.
Safety
Only
http://andhttps://URLs are accepted.Public DNS is required by default. Loopback, private, link-local, reserved, multicast and metadata addresses are blocked to reduce SSRF risk.
--allow-privateis explicit and intended for your own local app.Every subresource request is checked. Redirects are followed by the browser, not by a separate crawler.
Downloads are disabled.
The tool does not exploit anything, submit forms, log in, or crawl links.
No telemetry. AI review is opt-in.
Limitations
This tests one URL and one browser flow. It does not crawl authenticated areas, checkout, modals or every route.
Third-party content can vary between runs. A clean run is evidence, not proof.
CSP is the strongest signal. HSTS, COOP, CORP and Permissions-Policy still need deployment-specific verification.
It does not replace report-only monitoring, cross-browser testing or a full security review.
A page can look visually similar while a script is broken. Check the violation list, not only the screenshots.
Development
git clone https://github.com/htsecurity/header-replay.git
cd header-replay
uv sync
uv run playwright install chromium
uv run pytest
uv run ruff check .
uv run ruff format --check .Tests use local HTTP servers and real Chromium runs. No external network access is required for the test suite.
License
MIT. See LICENSE.
Available Tools
5 toolsmodelsC
List local Ollama models and live OpenRouter models with prices.
Inputs: provider. Returns: object
reviewA
Ask a real LLM to review a simulation report.
The report is sent to the selected provider. Use provider=ollama to keep it on this machine.
Inputs: report (required), model, provider. Returns: object
scanC
Fetch a URL and return its current response headers. Read-only.
Inputs: url (required), allow_private. Returns: object
security_headersA
List supported security headers and recommended starting values.
Inputs: no named parameters. Returns: object
simulate_headersA
Load a URL in Chromium with candidate headers and report browser breakage.
Private/local URLs are blocked unless allow_private is true. Only the exact
URL is tested; this is not a crawler.
Inputs: url (required), headers (required), wait_ms, allow_private, +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
scan and simulate_headers both take a URL and involve headers, so an agent could briefly hesitate between them, but the descriptions clearly separate read-only inspection from browser-based candidate testing. review, security_headers, and models each target distinct resources with no real overlap.
The set mixes bare verbs (scan, review) with verb_noun compounds (simulate_headers) and noun phrases (security_headers, models). It is still readable, but there is no single predictable pattern an agent can rely on to infer a tool's role from its name alone.
Five tools is well within the healthy range and each maps to a concrete step or lookup in the header-testing workflow. Nothing appears redundant or padded.
The set covers the full core loop: fetch current headers, simulate candidates in a browser, and get an LLM review, plus reference lookups for supported headers and available models. Minor gaps exist (no diff/compare or saved-report retrieval), but the primary workflow has no dead ends.
Maintenance
Related MCP Connectors
Scan a website's HTTP security headers (HSTS, CSP, framing, COOP/CORP, cookies). Score + fixes.
Caelara Labs Compliance & Trust tools over remote MCP. Calls need an X-Caelara-Key API key.
Security, SEO and AI-visibility scanner for web apps · free scans and focused checks via MCP.
See what AI and search crawlers receive from a website. Compare crawler responses, inspect robots.txt and discovery files, and verify crawler log identities. Use Resolve for a signed domain record or Preflight for a decision before an agent reads, cites, connects, or transacts. Verify signed results offline with CrawlCheck’s published keys. Connect via Streamable HTTP at https://crawlcheck.io/mcp. Docs: https://crawlcheck.io/docs/api.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables users to check HTTP status codes, find broken same-origin links, review SEO basics, and inspect common security headers with polite, permission-based crawling from any MCP client.4MIT
- AlicenseBqualityBmaintenanceEnables AI agents to audit URLs for security headers, generate CSP Level 3 policies, compute SRI hashes, evaluate WCAG 2.2 contrast, and remediate headers.12MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to scan any website's HTTP security headers — HSTS, CSP, framing, COOP/CORP, and cookies — returning a score along with fix snippets.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to run scored website security audits and receive ready-to-commit, platform-specific header fixes through MCP tools.292 PyPI1MIT