Six pure, in-memory CSS color tools: parse, convert, WCAG/APCA contrast, gamut map, ramps, solver
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Color Engine MCP.
rgbCallable MCP tool function
aaNormalCallable MCP tool function
aaLargeCallable MCP tool function
aaaNormalCallable MCP tool function
aaaLargeCallable MCP tool function
stepsCallable MCP tool function
A Model Context Protocol (MCP) server providing 6 CSS color utilities: parsing, conversion, gamut mapping, WCAG contrast (with optional APCA), tint/shade ramp generation (with optional design-token output), and contrast-target solving. All tools operate purely in-memory β no network I/O, no filesystem writes.
| Tool | Purpose |
|---|---|
| parse_color | Parse any CSS color string into hex, RGB, OKLCH, and gamut info |
| convert_color | Convert a color into a canonical hex / rgb / hsl / oklch string |
| contrast | WCAG 2.1 contrast ratio and tier flags, with optional APCA Lc |
| gamut_map | Map wide-gamut colors into sRGB via perceptual OKLCH chroma reduction |
| generate_ramp | Tint-to-shade ramps with per-swatch contrast info and design-token output |
| solve_for_contrast | Find a foreground color that meets WCAG contrast targets against a background |
All JSON outputs shown in this README are genuine responses captured from the built server via the MCP Inspector CLI (
npx @modelcontextprotocol/inspector --cli).
Requires Node.js >= 20. The npm package exposes a color-engine-mcp bin, so no clone or build is needed β clients launch it via npx. This is a standard stdio MCP server using only the tools primitive, so any MCP-compatible client registers it the same way: point the client at the launch command, and the client spawns and manages the process itself.
For Claude Code, one command registers the server:
(The default scope is the local project; add --scope user to register it for all your projects, or --scope project to write the shared .mcp.json.)
Most other JSON-configured clients accept this shape verbatim:
Where the entry lives in a few common clients:
| Client | Config file |
|---|---|
| Claude Code | .mcp.json in the project root |
| Claude Desktop | claude_desktop_config.json (e.g. ~/Library/Application Support/Claude/ on macOS) |
| Cursor | .cursor/mcp.json (per-project) or ~/.cursor/mcp.json (global) |
| VS Code | .vscode/mcp.json β VS Code names the top-level key servers instead of mcpServers |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
Other clients (Zed, JetBrains, custom agents built on an MCP SDK, β¦) differ only in the file location and occasionally the top-level key name β see their MCP server registration docs.
Listed in the official MCP Registry as io.github.aimsise/color-engine-mcp.
Once connected, try asking your agent things like:
To run from a clone instead, see Development.
Every tool routes color strings through one shared parse boundary, so the rules below apply uniformly.
Accepted formats. Any CSS color string culori can parse, including named colors, hex (#rgb, #rgba, #rrggbb, #rrggbbaa), rgb()/rgba(), hsl()/hsla(), and oklch() β plus the wide-gamut / CSS Color 4 formats:
color(display-p3 r g b)lab(L a b) / lch(L C h)oklab(L a b)hwb(h w b)color(rec2020 r g b)color(a98-rgb r g b)color(xyz-d65 x y z)A wide-gamut input outside sRGB parses fine and reports inGamut: false:
Whitespace. Leading/trailing whitespace is trimmed before parsing β " #ff0000 " parses as #ff0000.
CSS Color 4 channel clamping (legacy spaces only). Out-of-range channels in hex / rgb() / hsl() inputs are clamped at the parse boundary, per CSS Color 4: rgb(-50 0 0) behaves exactly as rgb(0 0 0), and hsl() saturation/lightness clamp likewise (hue wraps). Inputs in other modes (oklch(), lab(), color(display-p3 β¦), β¦) are not clamped β their out-of-gamut values flow through raw, which is what makes gamut_map useful.
none channels. CSS Color 4 none channels are normalized to 0 in all six tools β oklch(0.5 none 30) behaves exactly as oklch(0.5 0 30).
Component magnitude. A parseable component with an absurd magnitude (above 1e6, e.g. oklch(0.5 1e30 30)) is rejected with COMPONENT_OUT_OF_RANGE β two tools (gamut_map, solve_for_contrast) surface it differently; see the error codes table. Real out-of-gamut values are many orders of magnitude below this guard and are never affected.
Alpha policy. contrast and solve_for_contrast reject translucent colors β any explicit alpha < 1, including rgba()/hsla() functional alpha and 4-/8-digit hex (#00000080) β with ALPHA_UNSUPPORTED, because the effective color of a translucent layer depends on an unknown backdrop; composite over the backdrop first. All other tools accept translucent input and simply ignore the alpha channel (computations use the opaque color; no output ever carries an alpha component).
Length cap. Color strings longer than 256 characters (after trimming) are rejected with INPUT_TOO_LONG.
Parse any CSS color string and return hex, RGB, OKLCH, and gamut info.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| input | string | yes | Any CSS color string, e.g. "#ff0000", "red", "oklch(0.6 0.2 30)" |
Output for { "input": "#ff0000" }
The rgb channels are the sRGB-clamped 0β255 integer projection (consistent with hex). For an out-of-gamut input (e.g. a wide-gamut oklch(...)), the channels are clamped into [0, 255] rather than reporting raw out-of-range values β use the inGamut flag to detect that the input fell outside sRGB. The oklch block, by contrast, is the raw (lossless, unrounded) OKLCH of the input, and oklch.h is 0 for achromatic colors.
Convert a CSS color string into a canonical hex, rgb, hsl, or oklch format string.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| input | string | yes | Any CSS color string |
| to | string | yes | Target format: "hex", "rgb", "hsl", or "oklch" |
Output for { "input": "#ff0000", "to": "oklch" }
Raw vs. clamped for out-of-gamut inputs
For a color that lies outside the sRGB gamut, the target formats diverge:
to: "oklch" returns the raw, lossless OKLCH triple, so an out-of-gamut color round-trips faithfully. E.g. { "input": "oklch(0.7 0.4 30)", "to": "oklch" } β "oklch(0.70000 0.40000 30.00)".to: "hex", "rgb", and "hsl" are all derived from the sRGB-clamped projection and report the in-gamut approximation. E.g. { "input": "oklch(0.7 0.4 30)", "to": "rgb" } β "rgb(255, 0, 0)". rgb channels are integers in [0, 255].(L/C are formatted to 5 decimal places and H to 2, which guarantees an exact hex round-trip across the full sRGB cube.)
Compute the WCAG 2.1 contrast ratio between two fully opaque CSS color strings and return tier flags. Optionally also computes the APCA Lc value (see APCA).
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| a | string | yes | First CSS color string (treated as the text/foreground for APCA), e.g. "#000000" |
| b | string | yes | Second CSS color string (treated as the background for APCA), e.g. "#ffffff" |
| apca | boolean | no | When true, additionally return the signed APCA-W3 apcaLc for text a over background b |
Output for { "a": "#000000", "b": "#ffffff" }
ratio is the 2-decimal display value. The four tier booleans are derived from the unrounded raw ratio (so a near-boundary raw 4.4999, which displays as 4.50, still yields aaNormal: false).
WCAG 2.1 tier thresholds:
aaNormal / aaLarge require ratio β₯ 4.5 / β₯ 3.0aaaNormal / aaaLarge require ratio β₯ 7.0 / β₯ 4.5Errors. A string that fails to parse yields a parameter-named error β PARSE_FAILED: could not parse the foreground color for a, PARSE_FAILED: could not parse the background color for b. Translucent input yields ALPHA_UNSUPPORTED (see Alpha policy).
Pass apca: true to additionally get apcaLc β the signed APCA-W3 (SAPC-4g) lightness contrast Lc, rounded to 2 decimals, for text a over background b (the argument order matters for APCA, unlike the symmetric WCAG ratio). The sign encodes polarity: positive for dark text on a light background, negative for light text on a dark background; compare magnitudes with |Lc|.
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/color-engine-mcp)<a href="https://allmcps.com/mcp/color-engine-mcp"><img src="https://allmcps.com/api/badge/color-engine-mcp?style=directory" alt="Color Engine MCP on AllMCPs" /></a>