CookieGuard AI
A local MCP server for auditing authentication-cookie security with a fixed CookieGuard policy and allowed origins.
Describe the server’s checks, configuration, result/exit-code meanings, integrations, privacy properties, and limitations via
cookieguard_capabilities.Read the maintainer-configured allowed origins, policy, timeout, and HTTP-only scope via
cookieguard_policy; these cannot be changed by the client.Audit a configured-origin URL’s
Set-Cookieheaders or re-evaluate a sanitized CookieGuard evidence file viacookieguard_audit, returningpassed,failed, orincompletewith rule IDs, findings, and fixes but no cookie values.Scan a configured-origin URL’s
Set-Cookieheaders viacookieguard_scan, equivalent to auditing by URL.Explain CookieGuard rule IDs, incomplete reasons, error codes, or statuses via
cookieguard_explainusing static text only.Results use exit codes
0for pass,1for confirmed policy failure, and2for incomplete; audit/scan may make authorized network requests but do not log in or collect browser cookies.
Provides a GitHub Action for running CookieGuard's Set-Cookie header checks in CI, enabling automated cookie security validation during builds.
CookieGuard AI
Cookie security checks for AI browser agents, MCP clients, tests, and CI.
A successful agent login is not a secure session cookie.
Browser Use integration · MCP server · CI guide · Website
Quick start · How it works · Your policy · What it checks · MCP · Coding agents · More tools · FAQ · Documentation
pip install cookieguard==0.4.0
CookieGuard for Browser Use is a community integration, not an official Browser Use package. Audit only applications you are authorized to test.
Real run: Claude (claude-opus-5-5) drives a Browser Use agent through the same login twice. The insecure app gets FAIL — CG001 (exit 1); the secure app gets PASS (exit 0). Recording and test evidence
Your AI agent can log in to an app successfully while the session cookie it receives
is still unsafe, for example readable by JavaScript because it lacks HttpOnly.
CookieGuard watches the browser the agent drives, checks the authentication cookies
against your policy, and returns PASS / FAIL / INCOMPLETE with rule IDs,
explanations, and fixes.
The decision comes from the local CookieGuard engine and is enforced by your code, never by the model. Cookie values stay on your machine: they never reach the model, logs, or reports.
Quick start
Install
Needs Python 3.11+, Node.js 24+, and Chrome or Chromium. Install the published 0.4.0 release:
pip install cookieguard==0.4.0Code that uses cookieguard-browser-use or import cookieguard_browser_use keeps working:
that package now installs cookieguard and re-exports it.
Try the demo
Runs a real Browser Use agent against a local login app, with no API key needed:
python -m cookieguard.browser_use.demo # insecure: FAIL CG001 (exit 1) · secure: PASS (exit 0)Add it to your agent
from browser_use import Agent, BrowserProfile, BrowserSession, Tools
from cookieguard import CookieGuardAudit
audit = CookieGuardAudit(
allowed_origins=['http://127.0.0.1:3000'], # exact origins you are authorized to test
auth_cookies=['session_id'], # the real session cookie name(s)
fail_on='high',
)
session = BrowserSession(browser_profile=BrowserProfile(
keep_alive=True, # required: Agent.run() otherwise closes the browser
enable_default_extensions=False, # avoid the bundled cookie-consent extension
allowed_domains=audit.browser_allowed_domains(),
))
tools = Tools()
audit.register_tools(tools) # optional agent-visible check
await session.start()
await audit.start(session) # before the login
agent = Agent(task=..., llm=..., browser_session=session, tools=tools,
sensitive_data={'http://127.0.0.1': {'login_password': '...'}})
await agent.run()
result = await audit.finish() # decided by the CookieGuard engine
await session.kill()
print(result.summary)
result.assert_policy() # raises CookiePolicyError on FAIL or INCOMPLETEassert_policy() raises on FAIL or INCOMPLETE even if the agent never called the
audit tool, or reported success.
Install guide · Real-model example
Version 0.4.0 enables minimal usage reporting for accepted
audits by default. Set COOKIEGUARD_USAGE_METRICS=0, DO_NOT_TRACK=1, or
usage_metrics=False to disable it. Cookie data and audit results are never sent.
Related MCP server: Security Hunter MCP
How it works
CookieGuard reads the agent's browser over its own connection. It sees both what the
server declared (Set-Cookie) and what the browser stored. The published CookieGuard
engine then evaluates that evidence locally.
Details
Your policy decides what fails
fail_on sets the line: a confirmed finding at or above it fails the run; anything
below is reported. Only cookies you name in auth_cookies can be confirmed.
All policy options
What it checks
Rule | Checks | Severity | Policy option |
CG001 | Authentication cookie missing | high | always on |
CG002 | Authentication cookie missing | high | always on |
CG003 | Declared | medium |
|
CG004 |
| medium | review unless |
CG005 | Remaining lifetime above the limit | medium |
|
CG006 | Invalid | high | always on |
CG007 | A protection regressed since a baseline | high |
|
CG008 | Authentication role not confirmed | review | name it in |
CG009 | Evidence needs review | review | — |
CG010 | Session id not rotated at login | high | opt-in |
CG011 | Session still valid after logout | high | opt-in |
CG012 | Token in | high | review; confirmed with |
CG001–CG009 check cookie configuration. CG010 and CG011 replay the observed session against one protected URL you name, and CG012 reads Web Storage in the audited browser (Python 0.3.0 and Playwright 0.3.0). PASS means the configured checks passed, not that the application is secure. Full rule table · Limits & privacy
More ways to use CookieGuard
The same published policy engine powers every tool:
Tool | Use it for | Get started |
Browser Use | AI agents that log in and run browser workflows | |
MCP server | Letting an AI client scan your app's | |
Agent Skill | Teaching coding agents when and how to add these checks | |
Playwright | Cookies created during login in your existing tests | |
Playwright gate | Failing CI unless the login check ran and passed, even if a test was skipped | |
CLI |
| |
GitHub Action | Header checks, a build summary, and a sanitized report | |
Browser extension | Inspecting cookies interactively in Chrome |
With Node.js 24+, scan a local endpoint that sets your authentication cookie:
npx cookieguard-ci@0.4.0 scan http://localhost:3000 --auth-cookie session_idThe CLI, Action, and MCP server do not log in or execute JavaScript. Use Browser Use or
Playwright for authenticated workflows. Every tool reports 0 for a pass, 1 for a
confirmed policy failure, and 2 for an incomplete audit. The MCP server reports it as
the exitCode result field.
Use it from an MCP client
The CookieGuard MCP server lets an AI client, such as a coding agent, check the cookies your app sets. It runs locally over stdio. Your configuration file fixes the allowed origins and policy; the client can only choose which URL or evidence file to audit.
@aiscihub/cookieguard-mcp
0.4.0 is published on npm and active in the official MCP Registry as
io.github.aiscihub/cookieguard. See the release record.
It needs Node.js 24+.
Try it from a clone of this repository, with no API key or browser. The demo connects a real MCP client to the server:
npm ci && npm run demo:mcpMCP tools: cookieguard_audit, cookieguard_capabilities, cookieguard_explain, cookieguard_policy, cookieguard_scan
Capabilities: 9 checks; allowed origins: 1; evidence files: enabled
secure: PASSED (exitCode 0)
missing-httponly: FAILED (exitCode 1) — CG001 Missing HttpOnly
preference: INCOMPLETE (exitCode 2) — expected-auth-cookie-not-observed
Explain CG001: Set HttpOnly on the authentication cookie at the server.
Evidence login-report.json: FAILED (exitCode 1); observed by server: noTo connect your own client, write a config file (like this example) with your app's origin and session cookie names. Then add the server to your client's MCP settings:
{
"mcpServers": {
"cookieguard": {
"command": "npx",
"args": ["--yes", "@aiscihub/cookieguard-mcp@0.4.0",
"--config", "/absolute/path/cookieguard.json"]
}
}
}Tool | What it does | Available in |
| Shows the allowed origins and the policy in force | 0.1.0 |
| Scans one allowed URL's | 0.1.0 |
| Describes the checks, this server's configuration, result meanings, and limits | 0.2.0 |
| Audits one allowed URL, or one sanitized report your own Browser Use, Playwright, or CLI run wrote to the configured | 0.2.0 |
| Explains a rule ID, incomplete reason, or error code | 0.2.0 |
Results never contain cookie values. The agent decides whether to call the tool, so enforce results in your tests or CI when you need a gate. MCP guide
Use it from a coding agent
The CookieGuard Agent Skill tells coding agents when a task calls for these checks (Browser Use or Playwright logins, CI gates, MCP clients), which integration to pick, and how to read the result without exposing cookie values. In Claude Code:
/plugin install cookieguard --marketplace aiscihub/cookieguard-aiFor Codex, copy skills/cookieguard-browser-auth-security to .agents/skills/ in your
repository or to ~/.agents/skills/. Other agents that read SKILL.md can use the same
folder, and npm run package:skill builds a ZIP of it for skill marketplaces.
Automated tools can read cookieguard.capabilities.json:
a versioned, machine-readable description of every check, input, output schema, exit
code, privacy property, and limitation. Output schemas are in schemas/.
npx cookieguard-ci@0.4.0 capabilities --json and npx cookieguard-ci@0.4.0 explain CG001
print the same information.
Agent discovery details
Browser extension
Its classifier and explanations run in your browser, with no backend required.
Download or clone this repository.
Open
chrome://extensions/and enable Developer mode.Select Load unpacked, then choose the
extension-standalone/folder.Open a site you are authorized to inspect, click CookieGuard AI, and select Scan Cookies.
The popup shows AI Engine Ready or Rule-Based Mode.

Extension JSON exports can include cookie values; review them before sharing. Extension and research background · Privacy
FAQ
No. Your code calls audit.finish() and assert_policy(); the local CookieGuard engine
decides. The agent's optional cookieguard_audit tool is read-only and provisional. In
testing, an agent that falsely claimed success without logging in still got INCOMPLETE.
No. Values go only to the local engine over a pipe, and every result is value-free. The
tests check this with synthetic tokens. Your model provider still receives the task and
page content. Pass credentials through Browser Use sensitive_data, and set
ANONYMIZED_TELEMETRY=false to turn off Browser Use telemetry.
Limits & privacy
CookieGuard 0.4.0 adds separate usage reporting, enabled
by default for accepted audit invocations. It attempts one minimal PostHog event,
without cookie data, URLs, audit results, or persistent identity. Disable it before
starting the process with COOKIEGUARD_USAGE_METRICS=0 or DO_NOT_TRACK=1, or use
the API's explicit false setting. Downloads and imports do not report. Existing
npm and Python 0.3.0 installations remain unchanged until upgraded.
Use Browser Use when an agent logs in and you need the browser's evidence: it sees the
cookies created during the real workflow, and your code enforces the result. Use the MCP
server to let an AI client check the Set-Cookie headers an endpoint returns, without a
browser or login. Its result is information for the agent, not an enforced gate.
Any model Browser Use supports. Verified with claude-opus-5-5, using Anthropic's
server-side fallback for intermittent safety-classifier refusals. The OpenAI and Browser
Use Cloud paths in the example have
not been run yet. The demo needs no model at all.
Only one you are authorized to test. Loopback origins are allowed by default. Others
need their exact origin plus allow_nonlocal_origins=True. CookieGuard never
navigates; use allowed_domains to keep the agent on the app.
Ubuntu 23.10+ blocks the user namespaces Chromium's sandbox needs. Run
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0, or use Google Chrome with
BrowserProfile(channel='chrome'). Avoid --no-sandbox.
Install guide
Version 0.1.0 is tested with Browser Use 0.13.14 and Chromium-family browsers:
Linux (GitHub
ubuntu-latest): Python 3.11, 3.12, and 3.13, Node.js 24, Chromium 156.macOS (Apple silicon): Python 3.12, Node.js 24 and 26, Chrome 156.
Windows, Browser Use cloud browsers, and other Browser Use versions are not tested yet. Tested environments and dependencies
Documentation
Area | Guides |
Browser Use | Overview · Install · Policy · How it works · Results · Limits & privacy · Demo & tests · Validation |
MCP server | |
CI tools | |
Extension & research | |
Project | Release notes · Contributing · Troubleshooting · Security · Privacy |
Project
The original CookieGuard AI extension won the Girls Who Code Challenge 2026: award announcement · original demo. CookieGuard is released under the MIT license.
Available Tools
5 toolscookieguard_auditADestructive
Audit authentication-cookie configuration with the fixed startup policy. Pass exactly one of: url (GET one URL on a configured origin and audit its Set-Cookie headers; makes network requests, sends no cookies or credentials) or evidenceFile (re-evaluate a sanitized CookieGuard JSON report that your own Browser Use, Playwright, or CLI run wrote to the configured evidence directory). Returns passed, failed, or incomplete (exitCode 0/1/2) with rule IDs and fixes, never cookie values.
Inputs: url, evidenceFile. Returns: error, issues, status, target, +7 more
cookieguard_capabilitiesARead-onlyIdempotent
Describe CookieGuard: the cookie checks it runs, this server's fixed origins and policy, result and exit-code semantics, integrations for authenticated browser workflows, privacy properties, and limitations. Takes no arguments and makes no network requests.
Inputs: no named parameters. Returns: tools, checks, server, privacy, +8 more
cookieguard_explainARead-onlyIdempotent
Explain a CookieGuard rule ID (CG001-CG009), incomplete reason, error code, or status (passed/failed/incomplete): what it means, when it is confirmed versus review, and how to fix it. Static text only; no network or cookie data.
Inputs: id (required). Returns: error, knownIds, explanation, schemaVersion
cookieguard_policyARead-onlyIdempotent
Read the maintainer-configured origins, cookie policy, timeout, and HTTP-only scope. This tool cannot change them.
Inputs: no named parameters.
cookieguard_scanADestructive
GET a URL on a configured origin and audit Set-Cookie headers with the fixed policy. Returns passed, failed, or incomplete (exitCode 0/1/2). Makes network requests; use authorized test endpoints. No login or browser cookies are collected. Same as cookieguard_audit with url.
Inputs: url (required). Returns: error, issues, status, target, +7 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
cookieguard_scan is explicitly documented as 'Same as cookieguard_audit with url', giving the agent two names for one behaviour with no stated rule for choosing between them. The remaining tools (capabilities, policy, explain) are distinct, but the audit/scan collision is a real misselection hazard.
All five tools use the same cookieguard_ snake_case prefix followed by a short noun/verb (audit, scan, policy, explain, capabilities). The pattern is predictable and readable throughout.
Five tools is a well-scoped surface for a focused cookie-auditing server. The only issue is that one of the five (scan) duplicates an existing mode of audit rather than earning its own place.
The lifecycle is covered: discover capabilities, read the fixed policy, run a live audit or re-evaluate evidence, and look up rule/exit-code meanings. Remaining gaps are minor — no batch/multi-URL auditing and no way to enumerate all rule IDs at once instead of explaining one at a time.
Maintenance
Related MCP Connectors
Cookie consent scanner: GDPR, CCPA, GCMv2. PASS/FAIL compliance checklists with fix recommendations.
Give your AI agent a clear picture of a website's privacy and tracking behavior. CertScore.ai checks public websites for cookies, trackers, consent controls, privacy-policy disclosures, and transport-security signals, then returns prioritized findings, retained evidence, and a shareable report. Use it before a website launch, when reviewing a vendor, or to investigate tracking and consent behavior. Start with CertScore MCP Light—no account, API key, or OAuth setup required. Try asking your agent: "Check my website's privacy and tracking behavior. Show me the top findings, supporting evidence, and report link." The simple three-tool workflow scans the site, checks progress, and retrieves the results. Connect in minutes: https://certscore.ai/mcp/light
EU cookie-consent & tracker audit, run like a real first-time visitor (EU proxies). Free quick check, no account. Finds trackers and tracking cookies before consent, missing first-layer Reject, what still fires after Reject, Google Consent Mode v2 state per signal, plus Google Fonts/YouTube/Maps/reCAPTCHA. Every finding comes with the exact request as evidence and a concrete fix, in 13 languages. Weekly monitoring, white-label PDF for agencies, private share links. Works with any CMP (Cookiebot, Usercentrics, Complianz, CookieYes, Borlabs…).
Governed security assessments, findings and signed reports for your domains, from your AI agent.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to audit JSON Web Tokens (JWTs) and other token formats for security vulnerabilities, including HMAC secret cracking, live JWKS verification, and CVE fingerprinting.MIT
- AlicenseNot gradedqualityCmaintenanceEnables autonomous AI agents and penetration testers to conduct authorized security audits with persistent cross-session memory, zero-trust secret scrubbing, dynamic OWASP/ASVS checklists, and hallucination-free exploit PoC generation from captured traffic.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to audit URLs for security headers, generate CSP Level 3 policies, compute SRI hashes, evaluate WCAG 2.2 contrast, and remediate headers.MIT
- AlicenseNot gradedqualityCmaintenanceExposes audit tools over the Model Context Protocol so MCP clients such as Claude Desktop can run scoped, sandboxed defensive web-security audits without an API key.MIT