Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/check-mcp-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check MCP tools

# Tests the v2 truth-layer MCP tools: the pure WCAG logic and a live MCP
# round-trip against the server. Runs on PRs and pushes touching the tools.

on:
workflow_dispatch: {}
pull_request:
paths:
- "mcp-tools/**"
- ".github/workflows/check-mcp-tools.yml"
push:
branches: ["main"]
paths:
- "mcp-tools/**"

jobs:
accessibility-tool:
runs-on: ubuntu-latest
defaults:
run:
working-directory: mcp-tools/accessibility
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npm install
- run: npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
55 changes: 55 additions & 0 deletions mcp-tools/accessibility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Designpowers Accessibility MCP tool

The first **truth-layer** tool for Designpowers v2. It computes **WCAG 2.2 colour-contrast facts** — measured ratios and pass/fail — so an agent gets *evidence* instead of estimating contrast from a screenshot.

It speaks the [Model Context Protocol](https://modelcontextprotocol.io), so it works with **any MCP client — Claude and Gemini alike.** The design knowledge stays portable markdown; this supplies the checkable facts.

## Why this exists

Designpowers' workflow is mostly prose an LLM performs. Most of that is *judgment* (taste, craft) and rightly stays prose. But some claims have a **checkable answer** — contrast is the clearest. This tool turns "the reviewer says it's accessible" into "the Save button is 2.19:1 — FAIL AA," with no model guesswork. It's deliberately split into:

- `wcag.js` — pure, zero-dependency WCAG logic (the truth; unit-tested)
- `server.js` — a thin MCP adapter over it (the protocol plumbing)

## Tools

- **`check_contrast`** — one foreground/background pair → ratio + AA/AAA pass/fail. `textSize: "large"` uses the 3.0 threshold (≥18pt, or ≥14pt bold, and UI components).
- **`check_palette`** — many pairs at once (a whole screen or a `DESIGN.md` palette) → per-pair results + a pass/fail summary.

Both return human-readable text **and** `structuredContent` (machine-readable: `ratio`, `passAA`, `passAAA`, thresholds).

## Install

```bash
cd mcp-tools/accessibility
npm install
npm test # 16 checks: pure WCAG logic + a live MCP round-trip
```

## Wire it into an agent

### Claude Code / Claude Agent SDK
Add to your MCP config (e.g. `.mcp.json` or `claude mcp add`):
```json
{
"mcpServers": {
"designpowers-accessibility": {
"command": "node",
"args": ["mcp-tools/accessibility/server.js"]
}
}
}
```

### Gemini CLI
Gemini CLI also speaks MCP — add the same server to its `settings.json` `mcpServers` block (the command/args are identical). The tool is model-agnostic by construction; nothing in it is Claude-specific.

## Example

```
check_contrast { foreground: "#9aa0a6", background: "#e8eaed", label: "Save button" }
→ Save button: #9aa0a6 on #e8eaed (normal)
Contrast ratio: 2.19:1
WCAG AA (>=4.5): FAIL
Verdict: FAIL (below AA)
```
Loading
Loading