Skip to main content
Glama
contrast-checker-mcp

contrast-checker-mcp

by ogSINGH

contrast-checker-mcp

An MCP server that provides color contrast checking tools for AI assistants. Verify WCAG 2.1 accessibility compliance, compute contrast ratios with alpha transparency support, and get accessible color suggestions — all via the standard Model Context Protocol.

Contrast calculations match WebAIM's contrast checker — including alpha compositing, WCAG 0.03928 sRGB threshold, and truncated (not rounded) ratios.

Tools

check_contrast

Check the contrast ratio between two colors and evaluate WCAG 2.1 compliance.

Inputs:

  • foreground — Foreground color (e.g. #333, rgb(0,0,0), rgba(0,0,0,0.5), navy)

  • background — Background color (e.g. #fff, rgb(255,255,255), white)

Output: Contrast ratio, WCAG 2.1 pass/fail results (AA normal, AA large, AAA normal, AAA large), parsed color values. When the foreground has alpha, shows the effective composited color used for the calculation.

suggest_accessible_color

Suggest a replacement color that meets a WCAG contrast target, keeping the hue as close to the original as possible.

Inputs:

  • foreground — Foreground color

  • background — Background color

  • target_level — "AA" or "AAA" (default: "AA")

  • fix — "foreground" or "background" (default: "foreground")

Output: A suggested replacement color (in hex, rgb, hsl) that meets the target level, along with the new contrast ratio.

parse_color

Parse a color string and return it in multiple formats.

Inputs:

  • color — Color to parse (e.g. #ff6600, rgb(255,102,0), tomato)

Output: The color in hex, rgb, and hsl formats.

Related MCP server: WCAG Color Contrast MCP Server

Supported Color Formats

  • Hex: #rgb, #rrggbb, #rgba, #rrggbbaa

  • RGB: rgb(r, g, b), rgba(r, g, b, a)

  • HSL: hsl(h, s%, l%), hsla(h, s%, l%, a)

  • CSS named colors: red, cornflowerblue, rebeccapurple, etc.

Setup

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

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

Claude Code

claude mcp add contrast-checker npx -y contrast-checker-mcp

Cursor / VS Code

Add to .cursor/mcp.json or .vscode/mcp.json:

{
  "servers": {
    "contrast-checker": {
      "command": "npx",
      "args": ["-y", "contrast-checker-mcp"]
    }
  }
}

From source

git clone https://github.com/ogSINGH/contrast-checker-mcp.git
cd contrast-checker-mcp
npm install
npm run build
node dist/index.js

Examples

Black on white — 21:1 ratio, all WCAG levels pass:

check_contrast({ foreground: "#000000", background: "#ffffff" })

Semi-transparent text — alpha composited onto background before checking:

check_contrast({ foreground: "rgba(0,0,0,0.5)", background: "#ffffff" })
→ effective color #808080, ratio 3.94:1

Fix a failing color pair:

suggest_accessible_color({
  foreground: "#777777",
  background: "#ffffff",
  target_level: "AA"
})
→ suggests #757575 (4.61:1)

License

Apache-2.0

Available Tools

3 tools
check_contrastA

Check the contrast ratio between two colors and evaluate WCAG 2.1 compliance. Accepts hex (#fff, #ffffff), rgb(r,g,b), hsl(h,s%,l%), and CSS named colors.

Inputs: background (required), foreground (required).

parse_colorA

Parse a color string and return it in hex, rgb, and hsl formats. Accepts hex (#fff, #ffffff), rgb(r,g,b), hsl(h,s%,l%), and CSS named colors.

Inputs: color (required).

suggest_accessible_colorA

Suggest a replacement color that meets a WCAG contrast target. Adjusts lightness while preserving hue and saturation to stay as close to the original as possible.

Inputs: background (required), foreground (required), fix, target_level.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: checking contrast, suggesting accessible alternatives, and parsing color formats. No overlapping functionality exists.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (check_contrast, suggest_accessible_color, parse_color). Naming is predictable and uniform.

    Tool Count5/5

    Three tools is well-scoped for a focused utility server. Each tool earns its place without redundancy or bloat.

    Completeness5/5

    The tool surface covers the core workflows of the domain: analyzing contrast, generating accessible alternatives, and parsing colors. No obvious missing operations for the stated purpose.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables checking WCAG color contrast ratios and accessibility compliance between color pairs. Helps determine optimal text colors for backgrounds and validates color combinations meet accessibility standards.
      28 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables accurate WCAG color contrast checking and accessibility analysis by calculating actual contrast ratios between color pairs, checking compliance levels, and analyzing luminance values for web accessibility.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A comprehensive toolkit for color conversion, manipulation, and accessibility analysis supporting formats like OkLCH and WCAG compliance. It enables AI agents to manage design systems by generating harmonious palettes, transforming color spaces, and performing contrast checks.
      2
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to work with color: converting between formats like HEX, OKLCH and Display P3, checking and fixing WCAG 2 and APCA contrast, auditing palettes for accessibility and color blindness, and generating palettes, gradients, scales and design tokens.
      18
      MIT