Skip to main content
Glama
pserein
by pserein

Skincare MCP — Ingredient-Based Recommendation Engine

A custom Model Context Protocol (MCP) server that connects a Python recommendation engine to Claude. Built to explore NLP-based product matching and sequential decision-making for skincare.


What It Does

Exposes two tools to Claude via MCP:

  • find_similar_products — Vectorizes ingredient lists with TF-IDF and returns the top 5 most similar products by cosine similarity

  • check_red_flags — Scans a product's ingredients for known irritants and flags them for sensitive skin users


Related MCP server: BeauticsLab MCP

Architecture

skincare-mcp/
├── mcp_server.py            ← MCP interface (exposes tools to Claude)
├── engine.py                ← TF-IDF vectorization + cosine similarity
├── processor.py             ← Data loading, cleaning, fuzzy name matching
├── generate_user_history.py ← Synthetic RL interaction dataset generator
├── cosmetic_p.csv           ← Source dataset, 1884 Sephora products [not committed]
└── user_history.csv         ← Generated interaction logs [not committed]

Technical Details

TF-IDF Ingredient Embeddings

Treats each product's ingredient list as a text document and vectorizes it with TfidfVectorizer from scikit-learn. Common ingredients like Water are down-weighted automatically while rare, distinctive ingredients receive higher weight. Similarity is computed via cosine similarity with bigram support for multi-word INCI names.

Fuzzy Product Name Matching

Uses thefuzz (Levenshtein distance) to resolve product names in three steps: exact match, partial match, then fuzzy match with a configurable threshold. Queries like "creme de la mer" (missing accent) resolve correctly.

Synthetic User History for Offline RL

Generates a structured interaction dataset to support Offline Reinforcement Learning:

Column

Description

user_id

Simulated user

timestep

Step in the user's skincare journey

dryness, acne, sensitivity, oiliness

State — skin concern levels (0.0–1.0)

product_name

Action — product applied at this timestep

reward

Reward — skin improvement score at T+1

The reward function accounts for product rating, skin type compatibility, and irritant penalties for sensitive users. The dataset structure is compatible with Batch-Constrained Q-learning (BCQ) and similar offline RL algorithms.


Stack

Tool

Purpose

FastMCP

MCP server framework

scikit-learn

TF-IDF vectorization, cosine similarity

thefuzz

Fuzzy string matching

pandas / numpy

Data processing

uv

Package management


Setup

Prerequisites: Python 3.11+, uv

git clone https://github.com/pserein/skincare-mcp.git
cd skincare-mcp
uv sync

# Download cosmetic_p.csv from Kaggle and place it in the project root
# https://www.kaggle.com/datasets/eward96/skincare-products-clean-dataset

.venv/bin/python generate_user_history.py

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "skincare-recommender": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/skincare-mcp/mcp_server.py"]
    }
  }
}

Roadmap

  • MCP server with ingredient-based product similarity

  • TF-IDF + cosine similarity for NLP-based matching

  • Fuzzy product name resolution

  • Synthetic user history dataset (State, Action, Reward)

  • Offline RL policy (BCQ) trained on user history

  • Skin-type filtering in similarity search


Resume Description

Developed a custom MCP Server to bridge a Python recommendation engine with Claude. Engineered TF-IDF ingredient embeddings with cosine similarity for NLP-based product matching. Generated a synthetic sequential interaction dataset (State, Action, Reward) to support an Offline Reinforcement Learning policy using Batch-Constrained Q-learning (BCQ).

Available Tools

4 tools
check_red_flagsB

Check if a product contains known irritants for sensitive skin

ParametersJSON Schema
NameRequiredDescriptionDefault
product_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Only states it checks for irritants, but does not disclose how it behaves (e.g., whether it returns a boolean, what happens if product not found, or any permissions needed).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no wasted words. However, it is so brief it borders on under-specification, but conciseness itself is good.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the existence of an output schema, description does not need to explain return values. However, it lacks usage context and behavioral details, making it only minimally complete for a simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and description adds no meaning beyond the parameter name 'product_name'. Does not specify format, allowed values, or any constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool checks for irritants in a product, using specific verb 'check' and resource 'product'. It implicitly distinguishes from sibling tools like find_similar_products and search_live_products which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. Does not provide context or exclusions for using check_red_flags compared to sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

find_similar_productsB

Find skincare products with similar ingredients using Jaccard similarity

ParametersJSON Schema
NameRequiredDescriptionDefault
product_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description bears full burden. It discloses the algorithm (Jaccard similarity), but does not mention authentication, rate limits, error behavior, or what happens if the product is not found. Some transparency is provided but insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence that is direct and contains no redundant information. Front-loaded with action and resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given an output schema exists, return value explanation is not needed. However, the description lacks input format details and usage context relative to sibling tools. It minimally covers the tool's purpose but leaves gaps in practical use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must clarify the parameter. It only states the parameter name product_name without explaining format, valid values, or how to specify the product. The algorithm hint helps infer purpose but adds little semantic detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool finds skincare products with similar ingredients using Jaccard similarity, specifying both the resource (skincare products) and method (Jaccard similarity). It distinguishes itself from siblings like search_live_products which likely do not use ingredient similarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool instead of siblings like search_live_products or check_red_flags. The description implies use for ingredient-based similarity but lacks exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_databaseA

Run a read-only SQL SELECT query against the local skincare SQLite database. The database has a 'products' table with columns: name, brand, Label (category), price, rank, ingredients, Combination, Dry, Normal, Oily, Sensitive (skin type flags, 0 or 1). Only SELECT statements are allowed. Example: SELECT name, brand, price FROM products WHERE Label = 'Moisturizer' AND rank >= 4.5 LIMIT 5

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It clearly states read-only behavior and provides the database schema. It does not mention error handling or output format, but the core behavioral trait (read-only SQL) is well-defined.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, uses plain language, includes a relevant example, and avoids redundant information. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (not detailed here), the description adequately covers input requirements and constraints. It could mention output format briefly, but for a simple SQL query tool, it is complete enough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% coverage, but the description compensates by explaining the `sql` parameter expects a SELECT query, listing available columns, and providing an example. This adds significant meaning beyond the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool runs a read-only SQL SELECT query against a specific local skincare SQLite database, listing the database schema. This distinguishes it from sibling tools which are higher-level search or check functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly restricts usage to SELECT statements and states the database is local and read-only. While it does not mention when to use siblings, it provides sufficient context for appropriate use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_live_productsA

Search Open Beauty Facts for real-time beauty product data. Useful for products not in the local database (e.g. CeraVe, La Roche-Posay). Returns product name, brand, and ingredients for each result. Limited to beauty and personal care products only.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavior. It states it returns product name, brand, and ingredients, which is helpful. However, it does not mention any side effects, rate limits, or error conditions, leaving some gaps for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with only 4 sentences, each adding value. It front-loads the purpose and ends with constraints. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no annotations, the description covers basic usage, output fields, and domain restriction. An output schema exists, so return value details are not needed. Parameter details are missing, but the tool is simple; overall, it is reasonably complete for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning the input schema has no descriptions for parameters. The description does not explain the 'query' or 'max_results' parameters beyond implicit context. It fails to add meaning to the parameters, leaving them unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches Open Beauty Facts for real-time beauty product data. It distinguishes from siblings by noting it's for products not in the local database, while siblings like query_database and find_similar_products handle different tasks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use the tool (for products not in local database, like CeraVe) and its domain limitation (beauty and personal care only). It lacks explicit when-not-to-use or alternative tool names, but the guidance is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedcheck_red_flags
    • First observedfind_similar_products
    • First observedquery_database
    • First observedsearch_live_products

TDQS

A3.8/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: checking irritants, finding similar products via Jaccard similarity, running SQL queries on a local database, and searching an external database. No overlap or ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., check_red_flags, find_similar_products, query_database, search_live_products), making them predictable and easy to parse.

Tool Count4/5

With 4 tools, the set is slightly on the low side but still well-scoped for a skincare-focused MCP covering local and live data, safety checks, and similarity search. Each tool serves a distinct need without redundancy.

Completeness4/5

The tool surface covers key operations: local query, live search, ingredient safety, and similarity search. Minor gaps like a dedicated product lookup are mitigated by the SQL query tool, but advanced operations (e.g., user profiles or updates) are absent, which is acceptable for a read-only analysis server.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables AI assistants to search beauty products from Korean catalogs (Olive Young, Daiso, e-commerce) and analyze personal skincare routines and ingredient compositions via BeauticsLab.
    -
  • A
    license
    A
    quality
    A
    maintenance
    Condition-aware ingredient & product safety intelligence for AI agents. Every answer carries a claim-level evidence attestation, verdict, an evidence tier, and a citation – curated against authoritative sources (LactMed, InfantRisk, PubMed, DSLD, DermNet, EU CosIng) by Health AI. Hosted MCP server – no install, no key. Endpoint: https://mcp.healthai.com (Streamable HTTP, JSON-RPC 2
    9
    1 npm
    MIT