opticquiz-cvd-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/package.json +38 -0
  4. package/server.js +50 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vince Gonzalez (OpticQuiz)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # opticquiz-cvd-mcp
2
+
3
+ An [MCP](https://modelcontextprotocol.io) server that lets an LLM call the OpticQuiz
4
+ colorblind-safe checker as a native tool. Built on the `opticquiz-cvd` engine
5
+ (Machado 2009 + CIEDE2000). Runs locally over stdio; nothing leaves your machine.
6
+
7
+ ## Tools
8
+ - **check_palette** — `{ colors: string[] }` → whether the palette stays distinguishable under protan/deutan/tritan, with the conflicting pairs.
9
+ - **simulate_color** — `{ color: string, type: "protan"|"deutan"|"tritan" }` → how that color appears under that deficiency.
10
+
11
+ ## Add it to Claude Desktop
12
+ Edit `claude_desktop_config.json` (Settings → Developer → Edit Config) and add:
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "opticquiz-cvd": {
17
+ "command": "npx",
18
+ "args": ["-y", "opticquiz-cvd-mcp"]
19
+ }
20
+ }
21
+ }
22
+ ```
23
+ Restart Claude Desktop. Then ask, e.g., *"Is this palette colorblind-safe: #d7191c, #1a9641, #2166ac?"* — it calls the tool. Same config shape works in Cursor and other MCP clients.
24
+
25
+ ## Note
26
+ A screening aid, not a legal accessibility (ADA/WCAG) audit. Method:
27
+ Machado, Oliveira & Fernandes (2009) + CIEDE2000 — https://doi.org/10.5281/zenodo.21310578
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "opticquiz-cvd-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server that exposes the OpticQuiz colorblind-safe palette checker as callable tools for LLMs (Claude, Cursor, etc.).",
5
+ "type": "module",
6
+ "bin": {
7
+ "opticquiz-cvd-mcp": "server.js"
8
+ },
9
+ "main": "server.js",
10
+ "files": [
11
+ "server.js",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "keywords": [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "colorblind",
19
+ "accessibility",
20
+ "a11y",
21
+ "llm",
22
+ "tool",
23
+ "opticquiz",
24
+ "cvd"
25
+ ],
26
+ "author": "Vince Gonzalez",
27
+ "license": "MIT",
28
+ "homepage": "https://opticquiz.com/checker/",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/zengineco/opticquiz.com"
32
+ },
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.0.0",
35
+ "opticquiz-cvd": "^1.0.0",
36
+ "zod": "^3.23.0"
37
+ }
38
+ }
package/server.js ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+ import cvd from "opticquiz-cvd";
6
+
7
+ const server = new McpServer({ name: "opticquiz-cvd", version: "1.0.0" });
8
+
9
+ server.registerTool(
10
+ "check_palette",
11
+ {
12
+ title: "Check a color palette for colorblind-safety",
13
+ description:
14
+ "Check whether a set of colors stays distinguishable for people with color-vision deficiency (colorblindness). Simulates protanopia, deuteranopia and tritanopia and flags the pairs whose perceptual difference collapses under simulation. A screening aid, not a legal accessibility (ADA/WCAG) audit.",
15
+ inputSchema: {
16
+ colors: z
17
+ .array(z.string())
18
+ .describe('Hex colors to check together, e.g. ["#d7191c","#1a9641","#2166ac"]')
19
+ }
20
+ },
21
+ async ({ colors }) => {
22
+ const r = cvd.checkPalette(colors);
23
+ const lines = [r.pass ? "PASS - colorblind-safe." : "FAIL - color conflicts found."];
24
+ for (const t of ["protan", "deutan", "tritan"]) {
25
+ const c = r.types[t].conflicts;
26
+ if (c.length)
27
+ lines.push(`${t}: ` + c.map((x) => `${x.a}/${x.b} (delta ${x.normal}->${x.sim}, ${x.severity})`).join("; "));
28
+ }
29
+ return { content: [{ type: "text", text: lines.join("\n") + "\n\n" + JSON.stringify(r) }] };
30
+ }
31
+ );
32
+
33
+ server.registerTool(
34
+ "simulate_color",
35
+ {
36
+ title: "Simulate a color under colorblindness",
37
+ description: "Return how a single hex color appears to someone with a given type of color blindness (protan, deutan, or tritan).",
38
+ inputSchema: {
39
+ color: z.string().describe("Hex color, e.g. #d7191c"),
40
+ type: z.enum(["protan", "deutan", "tritan"]).describe("Color-vision deficiency type")
41
+ }
42
+ },
43
+ async ({ color, type }) => ({
44
+ content: [{ type: "text", text: `${color} -> ${cvd.simulate(color, type)} (as seen with ${type})` }]
45
+ })
46
+ );
47
+
48
+ const transport = new StdioServerTransport();
49
+ await server.connect(transport);
50
+ console.error("opticquiz-cvd MCP server running on stdio");