Contrast Checker Mcp

io.github.ogSINGH由 GitHub 帳號 ogSINGH 發布v1.0.1更新於 Oct 24, 2026

MCP - WCAG 2.1 color contrast checker - contrast ratios, compliance and accessible color suggestions

已驗證STDIO僅桌面開發者工具媒體與設計

概覽

AI 產生的概覽

一個本機 MCP 伺服器,讓助理檢查 WCAG 2.1 顏色對比度、判斷無障礙合規性,並提供可及性替代顏色建議。

可以做什麼
檢查前景色與背景色的對比度,並給出 WCAG 2.1 AA/AAA 的通過或未通過結果,包含含透明度時的合成有效顏色與解析後的顏色值。建議一個符合 AA 或 AAA 目標、且盡量接近原色相的前景色或背景色替代方案。將顏色字串解析為 hex、rgb 與 hsl 格式。支援 hex、rgb/rgba、hsl/hsla 以及 CSS 具名顏色。
適用情境
適合在設計或檢視介面配色、文字與背景時,快速取得與 WebAIM 一致的 WCAG 2.1 無障礙檢查結果與具體修正建議,不必離開助理。
執行需求
以 stdio 方式作為本機程序執行,通常透過 npm 套件 contrast-checker-mcp 以 npx 啟動,因此需要 Node.js 以及取得該套件的網路存取。未宣告任何驗證、環境變數或標頭。
安裝前請注意
屬於唯讀計算工具,不會修改檔案或將資料傳送給第三方。結果僅供參考,仍應依自身無障礙要求確認。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Contrast Checker Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

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.

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):

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

Claude Code

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

Cursor / VS Code

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

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

From source

bash
git clone https://github.com/ogSINGH/contrast-checker-mcp.gitcd contrast-checker-mcpnpm installnpm run buildnode 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

來源:README.md,提交 03d231e

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分