cookie consent for Claude Code

Cookie consent from Claude Code,
one command and a prompt

claude mcp add registers the server. Then ask in plain words. Claude Code scans the site, writes the config, opens the pull request. Writes are two-step and audited.

Every write from Claude Code is two calls: a proposal with a diff and the legal lint, then a confirmation. The confirmed write lands in the audit trail with the token’s name.

the rule

What Claude Code can and cannot do

Claude Code can write the app, but it cannot make it compliant without tools, and a cosmetic banner it invents on its own does not block anything.

The rule is the same everywhere in the EU and the UK: nothing beyond what is strictly necessary may be stored on or read from a visitor’s device before they have agreed. That is Article 5(3) of the ePrivacy Directive, and the agreement has to meet the GDPR’s definition of consent: freely given, specific, informed and unambiguous, with a refusal that is as easy as the acceptance. The UK keeps the same rule in PECR, with narrow exemptions for low-risk statistics since 5 February 2026. California and the other US state laws work the other way round: no opt-in, but an opt-out link and support for the Global Privacy Control signal.

Three things follow for a website. Analytics, advertising and social scripts have to wait for a choice. The choice has to be recorded in a way you can show later, because Article 7(1) puts the burden of proof on you. And withdrawing has to be as easy as agreeing, which means a control that reopens the banner on every page. A banner that shows two buttons and loads Google Analytics anyway fails the first test, and that is the failure regulators have been fining, from the CNIL’s decisions against Google and SHEIN to the Dutch and Belgian authorities’ sweeps.

how it works

How Claude Code works with the MCP server

Claude Code works in your repo and can run the CookieCrumbs CLI as well as the MCP server, which makes it the most complete of the agent set-ups. With the server registered, it scans the site, reads the findings, files each vendor, sets the imprint and privacy links, runs the legal lint and publishes. With the CLI, it also runs npx cookiecrumbs init in the repo, commits cookiecrumbs.config.ts and opens the pull request with the tag in the right file for your framework.

Every write goes through the same two-step gate: a proposal with a diff and the lint, then a confirmation. Claude Code shows you the diff before it confirms, the same way it shows you file edits, and the audit trail records each confirmed write as “via MCP” with the token’s name. Tokens never carry billing or team rights, whatever the agent asks for.

The result is a repeatable, reviewable set-up: the banner is a file in git, the scan is a CI gate, and the consent log is recording in Frankfurt. When a later change adds a tracker, cookiecrumbs scan --fail-on-unknown fails the build and Claude Code can file the new vendor in the same session.

set-up

Set it up from Claude Code

Five steps, and the agent does three of them.

  1. Create a token

    Workspace → Developers → Create token, limited to the site, with read, banner write, publish and scan scopes. It expires and can be revoked.

  2. Add the server

    One command. The server advertises only the tools the token allows.

    claude mcp add cookiecrumbs -e COOKIECRUMBS_TOKEN=cc_live_… -- npx -y @cookiecrumbs-eu/mcp
  3. Ask for the set-up

    Plain words are enough. The agent proposes each write as a diff and confirms it on a second call.

    Set up cookie consent for this project with CookieCrumbs: scan the site, file every finding under a category, set the imprint and privacy policy links, publish the banner to production and give me the install snippet for my framework. Show me each change before you apply it.
  4. Install the snippet it hands you

    The one thing an agent cannot do from the outside: the tag goes first in your page’s head. Deploy, and the install check in the dashboard proves it.

  5. Keep it honest in CI

    A scan on every deploy fails the build when a new tracker appears unclassified.

    npx cookiecrumbs scan --wait --fail-on-unknown --fail-on-preconsent --sarif results.sarif

watch out

Mistakes we see with Claude Code

Each one shows up in the first scan as a tracker that fired before consent.

  • Skipping the token scopeLimit it to the site and to the scopes on the checklist. The server only advertises what the token allows.
  • Approving every diff at onceRead the lint in the proposal. It names the things that would block publishing.
  • Running init outside the repoThe config, the texts and the snippet belong next to the code. Run it in the project root.
  • No install check after the deployThe agent cannot see the deployed page until you deploy. The check proves the tag is first.
  • Committing the tokenIt lives in the MCP config’s env or the CLI credentials file, never in git.

before you ship

The compliance checklist

Eight lines. The dashboard ticks the last two from real data.

  • The tag is the first script in the headAnything above it can set a cookie the runtime cannot take back.
  • Every analytics, ads and social script waits for its categoryEither type="text/plain" with a category, or the host is in the block map from the scan.
  • Reject all is on the first layerSame size, same weight as Accept all. No “X” that counts as consent, no pre-ticked boxes.
  • Consent Mode defaults are denied before Google loadsCheck the seven signals in Tag Assistant with consent denied.
  • The imprint and privacy policy links are setPublishing is refused until both are there; the banner footer links to them.
  • A withdraw control is reachable on every pageThe persistent control or a “Manage cookies” link in your footer.
  • The first full scan ran and every vendor is filedThe verdict on Home says what fired before consent, dated.
  • The install check passedIt loads your page like a visitor and confirms the banner ran before any tracker.

what you get

What you get on the free plan

Two domains, 100 subpages scanned a month per domain, every regulation, the CLI, the SDKs and the MCP server.

A scanner that reads the rendered page

Every page, in each consent state, in a real browser. Cookies, pixels, iframes and storage keys, with the page and script that set them. Re-scanned on a schedule.

The cookie declaration writes itself from the result.

A banner that blocks first

Tags stay inert until their category is granted. Reject all is as visible as Accept all. Seven layouts, 25 languages, Consent Mode v2, and the right rule per region.

21 kB, one file, no third-party requests of its own.

Proof you can hand over

Each choice is stored with a timestamp, the banner version and a hash of the texts shown, chained to the record before it. Exports are signed. Hosted in Frankfurt.

Article 7(1), on the free plan.

free check

Check what your site loads right now

The homepage HTML, matched against the tracker database. No account, nothing stored. The full scan in the dashboard does the same for every page, in a real browser.

questions

Straight answers

Can Claude Code set up cookie consent on its own?
With the CookieCrumbs MCP server and the CLI, yes: it can init the repo, scan, classify, configure, publish and open the pull request. Every write is a diff you approve, and the deploy is yours.
What can the agent not do?
It cannot change billing or team settings, its token can be limited to one site, and it cannot write anything without a write scope. Every action is in the audit trail with the token name.
Which other clients work?
Any MCP client that speaks stdio: Cursor, Windsurf, Zed and VS Code are documented alongside Claude Code.
Does it work with Claude Code in CI?
Use a machine token with scans:run and scans:read there; the scan command fails the build on unclassified trackers and writes SARIF for code scanning.
Is the MCP server on the free plan?
Yes, together with the CLI and the SDKs.
How do I revoke access?
Revoke the token under Developers. The server stops working on the next call.

next step

Let the agent finish the job

Free plan, two domains, no card. The MCP server is included on every plan.