pixcel-mcp 0.0.0-stage → 0.1.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 +110 -3
  3. package/bundle/cli.js +7293 -0
  4. package/package.json +58 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Pixcel MCP server: proprietary licence
2
+
3
+ Copyright (c) 2026 Muhammad Umar Javed (Pixcel, https://www.pixcel.me). All rights reserved.
4
+
5
+ This software is not open source. It is made available through npm so that Pixcel
6
+ customers can run it in their code editors.
7
+
8
+ You may install and run this software only with a valid Pixcel key, and only while you
9
+ have an active Pixcel plan that includes it, under the Pixcel Terms of Service:
10
+ https://www.pixcel.me/terms
11
+
12
+ You may not copy, modify, redistribute, sublicense, sell or resell this software; remove
13
+ or bypass its key check; or use it to build a competing product, except where the law
14
+ expressly allows this.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18
+ PURPOSE AND NONINFRINGEMENT, AS FAR AS THE LAW ALLOWS. See the Terms of Service for the
19
+ limits of our liability.
20
+
21
+ Questions: support@pixcel.me
package/README.md CHANGED
@@ -1,3 +1,110 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Pixcel: design measurements for AI coding tools (MCP server)
2
+
3
+ Pixcel turns an image of your own UI design (a Figma or Canva export, a mockup, or your own app) into **exact measurements** your coding agent can build from: hex colours, font sizes and weights, borders, corner radii and a nested layout tree — for **web and mobile** (px, pt or dp). It also writes **theme files** into your project and lets your agent **verify its own build** against the design.
4
+
5
+ Works with **Claude Code, Cursor, VS Code, Windsurf, Claude Desktop, Google Antigravity and Gemini CLI**. Screenshots are measured on your machine and never uploaded.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ You need a **Pixcel Pro** plan ($9/month) and your key. Open https://www.pixcel.me/dashboard, click **Create key**, and copy the ready-made setup (your key is already filled in). Or set it up by hand:
12
+
13
+ ### Claude Code
14
+ ```bash
15
+ claude mcp add pixcel -e UI_COMPILER_KEY=your-key -- npx -y pixcel-mcp
16
+ ```
17
+ On Windows:
18
+ ```bash
19
+ claude mcp add pixcel -e UI_COMPILER_KEY=your-key -- cmd /c npx -y pixcel-mcp
20
+ ```
21
+
22
+ ### Cursor, VS Code, Windsurf, Claude Desktop, Antigravity, Gemini CLI
23
+ Add to your MCP config (`.cursor/mcp.json`, `.vscode/mcp.json`, `claude_desktop_config.json`, `.agents/mcp_config.json`, …):
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "pixcel": {
28
+ "command": "npx",
29
+ "args": ["-y", "pixcel-mcp"],
30
+ "env": { "UI_COMPILER_KEY": "your-key" }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+ On Windows use `"command": "cmd", "args": ["/c", "npx", "-y", "pixcel-mcp"]`.
36
+
37
+ Screenshots are measured on your machine and never uploaded. Each tool call checks your key with pixcel.me (that is all that is sent: the key, the tool name and the version).
38
+
39
+ Print a ready-made config for your editor: `npx -y pixcel-mcp --init cursor` (or `claude-code`, `vscode`, `antigravity`, `claude-desktop`, `gemini-cli`).
40
+
41
+ ---
42
+
43
+ ## Use it
44
+
45
+ Put the design screenshot in your project, e.g. `design-references/home.png`, then in Claude Code:
46
+
47
+ ```text
48
+ /mcp__pixcel__build-from-screenshot design-references/home.png
49
+ ```
50
+
51
+ or just ask: *“Build design-references/home.png using the Pixcel tools, then verify it.”*
52
+
53
+ ### Slash commands (MCP prompts)
54
+ | Prompt | What it does |
55
+ | :--- | :--- |
56
+ | `build-from-screenshot` | Measures the screenshot and hands the agent an exact brief plus a build → capture → verify loop. Optional `target`: `existing-project`, `nextjs-app-router`, `react-native-expo`, `swiftui`, `flutter`, `mobile-web`. |
57
+ | `extract-design-tokens` | Turns the screenshot into a theme file (`tailwind`, `css`, `json`, `react-native`, `swiftui`, `flutter`) and asks the agent to wire it in. |
58
+ | `ui_recreation_workflow` | Full closed-loop workflow with a target agreement score and iteration budget. |
59
+
60
+ ### Tools
61
+ | Tool | Description |
62
+ | :--- | :--- |
63
+ | `inspect_reference_image` | Measures a PNG/JPEG: palette, text (OCR) with size / weight / colour, surfaces (fill, border, radius), layout regions, device profile. |
64
+ | `compile_ui_prompt` | Compiles the measurements into an implementation brief for your stack. |
65
+ | `export_design_tokens` | Returns — and optionally writes — a theme file: CSS variables, Tailwind, W3C Design Tokens JSON, React Native, SwiftUI or Flutter. Never overwrites unless `overwrite: true`. |
66
+ | `capture_ui_screenshot` | Screenshots your app on localhost at a given size and pixel density with a sandboxed, network-locked headless Chrome/Edge. |
67
+ | `verify_ui_implementation` | Compares your build with the reference: pixel agreement, 4×4 hotspot grid and a correction prompt. |
68
+ | `analyze_reference_with_ai`, `critique_ui_comparison` | Optional qualitative analysis via Groq vision (off unless enabled). |
69
+
70
+ ---
71
+
72
+ ## Mobile screenshots
73
+
74
+ iPhone, Android and iPad screenshots are recognised automatically. Pixcel detects the pixel density (@2x, @3x), converts every value to **pt** (iOS) or **dp** (Android), ignores the status bar and home indicator, and adds stack rules for React Native, SwiftUI, Flutter or mobile web. Override with `screenshotScale` (1–4) or `platform` (`ios`, `android`, `web`) on any measuring tool.
75
+
76
+ ## Accuracy
77
+
78
+ Measured against DOM ground truth (benchmark in the repository):
79
+
80
+ | | Desktop (10 UIs) | iPhone @3x (3 app screens) |
81
+ | :--- | :---: | :---: |
82
+ | Words recovered | 93.9% | 98.2% |
83
+ | Text colour within ΔE 3 | 98.6% | 96.3% |
84
+ | Font size within ±1 (px / pt) | 93.1% | 98.8% |
85
+ | Font weight (regular / bold) | 92.8% | 83.8% |
86
+ | Layout containers found | 89.9% | 83.3% |
87
+
88
+ Font family cannot be identified from pixels; Pixcel tells the agent to use the project's font.
89
+
90
+ ---
91
+
92
+ ## Security
93
+
94
+ - Reads only PNG/JPEG images and JSON specs inside allowed folders. `../` traversal, symlink/junction escapes, UNC and device paths are rejected.
95
+ - Never auto-authorises your home folder or a drive root (some hosts launch servers from there); pass `--allow-dir` in that case.
96
+ - Writes only screenshots (`.png`) and theme files with the expected extension, inside allowed folders.
97
+ - `capture_ui_screenshot` accepts only `localhost`, `127.0.0.1` and `[::1]`; the browser keeps its sandbox and every non-loopback request is blocked, so redirects cannot reach the internet, your LAN or cloud metadata.
98
+ - Configuration comes only from the MCP host's `env` block — project `.env` files are never loaded.
99
+
100
+ ## Configuration
101
+
102
+ | Flag / variable | Default | Description |
103
+ | :--- | :--- | :--- |
104
+ | `--allow-dir <dirs>` | `design-references`, `references`, `screenshots` and the launch folder | Comma-separated folders the server may read and write. |
105
+ | `--workspace-root <dir>` | current directory | Project root for relative paths. |
106
+ | `UI_COMPILER_BROWSER_BIN` | auto-detected | Path to Chrome / Edge / Chromium for capture. |
107
+ | `PIXCEL_CHROME_NO_SANDBOX` | unset | Set to `1` only in Linux containers where Chrome cannot start its sandbox. |
108
+ | `GROQ_API_KEY`, `GROQ_AI_ENABLED` | unset / `false` | Optional AI vision tools. |
109
+
110
+ Website, free browser tool, guides and pricing: https://www.pixcel.me. Proprietary licence: see LICENSE and https://www.pixcel.me/terms.