uisandbox-mcp 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.
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/server.mjs +9253 -0
- package/package.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alexander Kaan
|
|
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,48 @@
|
|
|
1
|
+
# UISandbox MCP server
|
|
2
|
+
|
|
3
|
+
The same engine the browser runs, as tools for an agent — no second implementation.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx uisandbox-mcp # the published package (stdio); add it to your client as below
|
|
7
|
+
UISANDBOX_URL=http://localhost:5190 npx uisandbox-mcp # render tools against a local app instead of uisandbox.org
|
|
8
|
+
|
|
9
|
+
# from a clone of the repo:
|
|
10
|
+
pnpm mcp # stdio server straight from the sources (tsx)
|
|
11
|
+
pnpm mcp:build && pnpm mcp:pack # bundle the engine into mcp/dist/server.mjs and pack uisandbox-mcp
|
|
12
|
+
npx tsx mcp/smoke.ts fixtures/x.zip # load → set → export → verify → screenshot (MCP_CMD to point at a build)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`verify` and `screenshot` need a browser: `npx playwright install chromium` once (playwright is an optional peer dependency — `load`/`set`/`export` work without it).
|
|
16
|
+
|
|
17
|
+
## Tools
|
|
18
|
+
|
|
19
|
+
| tool | input | returns |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `load` | `zipUrl` or `zipPath` | project id, screens, values, the baseline (brand, fonts, families, palette, canvas, dark mode) — or a refusal with the reason |
|
|
22
|
+
| `screens` | `id` | the screens |
|
|
23
|
+
| `set` | `id`, `knobs` — `cPrimary`, `fontDisplay`, `fontBody`, dials (`radius`, `space`, `type`, `lineHeight`, `tracking`, `weight`, `borderWidth`, `borderTone`, `shadow`, `motion`, `hue`, `sat`, `contrast`, `gradAngle`), `cBackground`, family colours, `dark`, `reset` | what moved (count, sample) |
|
|
24
|
+
| `export` | `id`, `format` — `sheet-css` · `sheet-json` · `patch` · `tokens-css` · `tokens-json` · `tailwind` · `shadcn` · `swift` · `android-xml` · `android-kotlin` | text |
|
|
25
|
+
| `verify` | `id`, `screen?`, `width?` | the 1:1 check in headless Chromium (untouched vs. tokenised, computed styles per element) + reach |
|
|
26
|
+
| `screenshot` | `id`, `screen?`, `width?` | PNG of the screen with the current knobs |
|
|
27
|
+
|
|
28
|
+
`load`/`set`/`export` are pure Node. `verify`/`screenshot` drive the real app (`UISANDBOX_URL`, default `https://uisandbox.org`) with the archive served from a route inside the headless browser — the number an agent gets is the number a visitor gets.
|
|
29
|
+
|
|
30
|
+
## Claude Desktop / Claude Code / Cursor
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"uisandbox": { "command": "npx", "args": ["-y", "uisandbox-mcp"] }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Claude Code: `claude mcp add uisandbox -- npx -y uisandbox-mcp`
|
|
41
|
+
|
|
42
|
+
## Publishing (maintainer)
|
|
43
|
+
|
|
44
|
+
`pnpm mcp:pack` → `cd mcp && npm publish` (the `files` field ships `dist/server.mjs`, README, LICENSE only). `mcp/server.json` is the manifest for the official MCP registry (`mcp-publisher publish` from `mcp/`); the other directories (Smithery, PulseMCP, Glama, mcp.so) take the npm name.
|
|
45
|
+
|
|
46
|
+
## A prompt to paste
|
|
47
|
+
|
|
48
|
+
> Test my design: load https://github.com/me/site/archive/refs/heads/gh-pages.zip in UISandbox, set the brand to #e11d48 and radius ×1.5, verify it is still 1:1, show me a screenshot, and give me the patch.
|