Security Headers

v0.3.0
io.github.basitalisandhu/mcp-security-headers Checked 1 day ago Published 1 month ago

Fetch a URL's response headers and grade CSP, HSTS, X-Frame-Options and related security headers.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

check_url_headers Fetch and grade a URL's security headers

Send a HEAD request (GET when the server answers 405 or 501, or when method is GET) to a public http or https URL, follow up to max_redirects redirects (default 5) and grade the final response's security headers. Returns the final URL, status, redirect chain, every response header, and per-header pass/warn/fail/info checks with explanations, recommendations and an overall grade from A+ to F. Refuses URLs whose host is localhost, a .local or .internal name, or resolves to a private, loopback, link-local or cloud-metadata address. The response body is never downloaded.

ParameterTypeDescription
url *stringAbsolute http:// or https:// URL.
max_redirectsintegerDefault 5.
methodstringDefault HEAD.

grade_headers Grade a supplied header set

Grade response headers you already have, without any network access. Pass headers as an object of name to value (names are case-insensitive; Set-Cookie may be an array). Returns the same per-header checks and overall grade as check_url_headers. Set https to false when the response came over plain HTTP.

ParameterTypeDescription
headers *objectResponse headers, name to value.
httpsbooleanWhether the response was served over HTTPS. Default true.

explain_header Explain a security header

Describe what one response header does, the recommended value and a reference link. Headers: content-security-policy, strict-transport-security, x-frame-options, x-content-type-options, referrer-policy, permissions-policy, cross-origin-opener-policy, cross-origin-resource-policy, x-xss-protection, server, x-powered-by, set-cookie.

ParameterTypeDescription
header *string