# color-engine-mcp [Health: Active]

**Category:** 📐 Architecture & Design  
**Repository:** https://github.com/aimsise/color-engine-mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 250  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/color-engine-mcp

## Description
Six pure, in-memory CSS color tools: parse, convert, WCAG/APCA contrast, gamut map, ramps, solver

## Tools
Capabilities this server exposes over MCP:

- **parse_color** — Parse a CSS color string and return hex, rgb, oklch, and gamut info.
- **convert_color** — Convert a CSS color string into a canonical hex, rgb, hsl, or oklch format string.
- **contrast** — Compute the WCAG 2.1 contrast ratio between two fully opaque CSS color strings and return WCAG tier flags (AA/AAA normal/large text). Set apca:true to also get the signed APCA-W3 Lc for text `a` over background `b`.
- **gamut_map** — Map any CSS color string into the sRGB gamut via perceptual OKLCH chroma reduction. Returns the nearest in-gamut hex, raw OKLCH components, and a `clamped` flag indicating whether the input was out-of-gamut.
- **generate_ramp** — Generate a tint-to-shade color ramp from a base CSS color. Returns an ordered list of swatches (light → dark) each with its in-gamut hex, display-rounded OKLCH components (l/c 5dp, h 2dp), WCAG contrast ratios (2dp) + tiers vs white and black, and an in-gamut flag. Optionally emits the ramp as design tokens via tokenFormat ("tailwind" JSON or a "css-variables" :root block).
- **solve_for_contrast** — Find a foreground color that meets one or more WCAG 2.1 contrast targets against a background. Binary-searches OKLCH lightness (holding hue/chroma fixed) and returns the nearest-compliant hex plus the achieved ratio. Pass `target` for one target or `targets` for several; `prefer` selects lighter/darker/either; `hue`/`chroma` pin the foreground chromaticity. If BOTH `target` and `targets` are provided, `targets` takes precedence. The response shape differs by mode: a single `target` returns `{ met, color, ratio }` (with an optional `nearMiss` flag); `targets` returns `{ results: [{ met, color, ratio, nearMiss? }, ...] }`. The output schema is an all-optional superset of both shapes (SDK 1.29 single-shape limitation). An unparseable background returns the PARSE_FAILED error; a translucent background (alpha < 1, e.g. rgba()/hsla()/#rgba/#rrggbbaa) returns ALPHA_UNSUPPORTED — composite it over its backdrop first.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "color-engine-mcp": {
    "command": "npx",
    "args": ["-y","color-engine-mcp"]
  }
}
```

## Documentation

## What color-engine-mcp MCP server does

The color-engine-mcp MCP server exposes six CSS color utilities through MCP:

- `parse_color` reads a CSS color and returns hexadecimal, sRGB, OKLCH, and gamut information.
- `convert_color` produces a canonical hex, RGB, HSL, or OKLCH string.
- `contrast` calculates WCAG 2.1 contrast and its AA/AAA tier flags, with optional APCA Lc output.
- `gamut_map` brings wide-gamut colors into sRGB by reducing OKLCH chroma.
- `generate_ramp` creates tint-to-shade ramps, including contrast data and optional design-token output.
- `solve_for_contrast` searches for a foreground color that satisfies a requested WCAG contrast target against a background.

All calculations are performed in memory. The server does not make network requests or write files, making it suitable for agents that need color calculations without access to external services.

## How it works

The color-engine-mcp MCP server uses a shared parsing boundary for all six utilities. Inputs may include named CSS colors, short or long hex values, `rgb()`, `hsl()`, `oklch()`, and several CSS Color 4 spaces such as Display-P3, Lab, LCH, OKLab, HWB, Rec. 2020, A98 RGB, and XYZ-D65.

Whitespace around an input is removed before parsing. Legacy hex, RGB, and HSL channels are clamped according to CSS Color 4 rules, while values in other color spaces remain raw so that gamut mapping can process them. CSS `none` channels become zero. Inputs longer than 256 characters are rejected, and extremely large component magnitudes can trigger a component-range error.

Parsed results report sRGB-clamped RGB and hexadecimal values alongside raw OKLCH data. The `inGamut` result indicates whether the source fits within sRGB. Conversion to OKLCH preserves the raw color, whereas hex, RGB, and HSL conversions use the sRGB-clamped projection.

## Setup and configuration

Node.js 20 or newer is required. The npm package provides a `color-engine-mcp` executable, so clients can launch it without cloning or building the repository:

```sh
npx -y color-engine-mcp
```

For Claude Code, register it with:

```sh
claude mcp add color-engine -- npx -y color-engine-mcp
```

JSON-configured clients generally use this server entry:

```json
{
  "mcpServers": {
    "color-engine": {
      "command": "npx",
      "args": ["-y", "color-engine-mcp"]
    }
  }
}
```

The server uses MCP's stdio transport and the `tools` primitive. Claude Desktop uses `claude_desktop_config.json`; Cursor uses `.cursor/mcp.json` or its global equivalent; VS Code uses `.vscode/mcp.json` with `servers` as the top-level key; and Windsurf uses `~/.codeium/windsurf/mcp_config.json`. Zed, JetBrains, and custom MCP clients use their own registration locations.

## Tools and capabilities

Use `contrast` for opaque foreground and background colors. It rejects translucent inputs because calculating their effective color requires a known backdrop. The other utilities accept translucent input but ignore alpha during computation. This means an alpha-bearing color can be parsed or converted, but it is not carried into output.

The contrast tool treats its first color as the text or foreground for APCA and the second as the background. `generate_ramp` supports per-swatch contrast information and design-token output, while `solve_for_contrast` is intended for finding an accessible foreground rather than merely measuring an existing pair.

The package is licensed under MIT and is listed in the official MCP Registry as `io.github.aimsise/color-engine-mcp`.

_Full upstream README: https://allmcps.com/mcp/color-engine-mcp/readme_

