Every bottle of Dior, Chanel, CeraVe, or COSRX has a short alphanumeric string engraved on the glass or crimped into the tube — a batch code (like 4B01 or 38Z401). Under EU Cosmetic Regulation (EC) 1223/2009, products with a shelf life over 30 months don't have to print an expiration date; consumers and second-hand buyers have to decode that batch code instead.

While building CosmeScan (a free batch code decoder and recall checker covering 2,375 cosmetic, skincare, K-Beauty, and perfume brands), I noticed a growing pattern in our traffic: a significant share of users were coming directly from AI assistants like ChatGPT and Claude asking "When was Dior batch 4B01 made?" — and LLMs frequently hallucinated the manufacturing year because cosmetic conglomerates reuse 10-year cyclic codes and proprietary calendars.

To give AI agents deterministic, verified answers instead of guesses, I built and published cosmescan-mcp — a free, read-only, zero-API-key Model Context Protocol (MCP) server on npm and Glama.

Here is how it works and how you can wire it into Claude Desktop, Cursor, or any MCP-compatible client in 30 seconds.

Why LLMs Struggle with Cosmetic Batch Codes

Cosmetic batch codes are deceptively tricky for language models:

  • 10-year repeating cycles: LVMH (6B01 = Feb 2026 or Feb 2016), Estée Lauder (A66 = June 2026 or June 2016), and L'Oréal (38Z401) recycle year identifiers every decade.
  • Sequential registries: Chanel uses a rolling 4-digit monthly counter (~8-year cycle) that cannot be guessed from arithmetic alone.
  • Conglomerate M&A drift: Acquired brands (like Byredo under Puig, Maison Francis Kurkdjian under LVMH, or Aesop under L'Oréal) have two or three different historical encoding schemes depending on the production year.
  • Cloned counterfeit lots: On secondary marketplaces (Vinted, eBay, Depop), counterfeiters reuse valid vintage batch codes (for example, 19280 on Baccarat Rouge 540 or 19S01 on Creed Aventus). A naive date decoder tells the buyer "Valid date!" even though the code is a known counterfeit signature.

Architecture: Thin Stdio MCP Client + Edge REST API

I wanted cosmescan-mcp to have zero secrets, zero local database bloat, and instant npx startup:

Claude Desktop / Cursor / MCP Host │ (stdio JSON-RPC 2.0) ▼ cosmescan-mcp (Node.js + @modelcontextprotocol/sdk) │ (HTTPS GET, read-only, no API key) ▼ CosmeScan Public API (Cloudflare Worker + static JSON catalog) ├── /v1/decode?brand=dior&code=4B01 ├── /v1/brands?q=cerave └── /v1/brand/dior 

The package is just ~4.2 kB unpacked, uses @modelcontextprotocol/sdk over StdioServerTransport, and exposes 3 deterministic, read-only tools:

Tool Purpose
decode_batch_code Decodes manufacturing date, product age, PAO shelf-life status, cloned counterfeit lot warnings, and EU Safety Gate / US FDA recall alerts
search_brands Searches across all 2,375 supported cosmetic, skincare, K-Beauty, and fragrance brands
get_brand_info Returns brand metadata, parent conglomerate, batch format hints, and direct decoder URL

You can also inspect the underlying public REST endpoints directly in the CosmeScan Open API Docs.

Quick Setup (Claude Desktop / Cursor / Windsurf)

No account or API key is required. Add this block to your claude_desktop_config.json or .cursor/mcp.json:

{ "mcpServers": { "cosmescan": { "command": "npx", "args": ["-y", "cosmescan-mcp"] } } } 

Once connected, you can ask your assistant:

"Check Christian Dior batch code 4B01 — when was it manufactured, is it fresh, and are there any recalls or counterfeit warnings?"

The agent calls decode_batch_code({ brand: "dior", code: "4B01" }) and receives structured JSON with the exact manufacturing date (2024-02), formula age, EU PAO freshness status, and whether the lot matches any active EU Safety Gate (RAPEX), US FDA, or RappelConso recall — or any of the 306 known cloned counterfeit batch codes documented in our 2026 Counterfeit & Recall Observatory.

Passing Glama Introspection & awesome-mcp-servers Checks

A quick tip if you're publishing your own Node.js MCP server to directories like Glama or punkpeye/awesome-mcp-servers:

  1. Include a minimal Dockerfile (node:22-alpine, npm install --omit=dev, ENTRYPOINT ["node", "index.js"]) so automated registries can spin up your server in a container and run initialize + tools/list introspection.
  2. Write a fast end-to-end stdio smoke test spawning node index.js and piping real JSON-RPC frames (initialize → notifications/initialized → tools/list → tools/call) before publishing to npm.
  3. Never write logs to stdout — stdout is strictly reserved for JSON-RPC messages in stdio MCP servers; send all diagnostics to stderr.

Links & Open Resources

Feedback, PRs, and new brand decoding rules are always welcome!