Skip to main content
Glama
Polish Studio MCP

Polish Studio MCP

README.md
# Polish Studio MCP

![Polish Studio — visual systems workshop](assets/logo.svg)

A local design-token workshop for web developers using coding agents.

**Audit the system → propose a direction → adapt the CSS → verify the rendered interface.**

---

## Studio notes / Case 001

**Dashboard redesign, illustrative example**

![A token-based dashboard mockup showing a before and proposed visual direction](assets/case-study.svg)

The illustration is an original conceptual mockup, not a screenshot or an automatically rendered transformation. The following measurements are reproduced by the included [demo](examples/demo.py) using the actual scoring algorithm.

| Design decision | Before | Proposed |
|---|---:|---:|
| Body type | 13px | 16px |
| Primary heading | 18px | 32px |
| Spacing examples | 5, 10, 15px | 4, 8, 12, 16, 24…64px |
| Routine motion | 600ms | 180ms |
| Reduced-motion support | no | yes |
| Limited token rubric | 56.67 / 100 | 100 / 100 |

The proposal prioritizes the text contrast and reduced-motion failures, followed by typography and spacing. A coding agent can adapt these values to an existing project without changing business logic. The rubric is a limited token checklist, not a universal design quality or accessibility score.

`v0.1.0` / Python 3.10+ / MCP over stdio / [MIT](LICENSE)

## The toolkit

A polished interface comes from consistent visual decisions, not arbitrary decoration. Polish Studio is a local Model Context Protocol server that evaluates explicitly provided design tokens and produces actionable design improvements for existing web applications.

- **Contrast:** deterministic text and focus contrast ratios with prioritized fixes.
- **Typography:** role hierarchy, reading size, line height and headline scale.
- **Rhythm:** spacing, radius consistency, motion duration and content density.
- **Responsive foundations:** bounded containers and mobile grid reflow.
- **Design proposals:** 54 distinct combinations of dashboard, landing and e-commerce systems across three densities, three moods and light/dark themes.
- **CSS:** namespaced design variables, optional components and accessible-motion foundations.

No API key, browser, remote site inspection or runtime network access is required. The server only handles explicitly passed structured information. It does not edit projects, execute commands, read arbitrary files or access websites.

## Install the workshop

Clone this repository and install from its directory into a virtual environment:

```sh
python -m venv .venv
# macOS/Linux: source .venv/bin/activate
# Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install .
```

After installation, `python -m polish_studio` starts the stdio server. It waits for an MCP client; it does not expose an HTTP port. Use the absolute path to the environment's Python interpreter in your MCP client, so the client does not depend on shell activation.

### Codex

```sh
codex mcp add polish-studio -- /absolute/path/to/.venv/bin/python -m polish_studio
codex mcp list
```

Or configure `~/.codex/config.toml`:

```toml
[mcp_servers.polish-studio]
command = "/absolute/path/to/.venv/bin/python"
args = ["-m", "polish_studio"]
```

On Windows substitute e.g. `C:/dev/polish-studio-mcp/.venv/Scripts/python.exe`.

### Claude Code

```sh
claude mcp add --transport stdio polish-studio -- /absolute/path/to/.venv/bin/python -m polish_studio
claude mcp list
```

Use the same Windows interpreter substitution. Reopen the agent session if necessary, then check MCP tool discovery. See [Codex MCP docs](https://developers.openai.com/codex/mcp) and [Claude Code MCP docs](https://code.claude.com/docs/en/mcp). Configuration examples follow the documented syntax; actual Codex/Claude host sessions have not been independently tested. An official SDK client integration test verifies the stdio protocol.

## Working with a coding agent

Tell your coding agent:

> Review my existing design tokens. Call audit_design using the supplied colors, type sizes, spacing, radius, layout and motion settings. Show high-priority issues first. Use propose_design for a calm, balanced dashboard. Compare both systems and adapt the returned CSS to my current components, preserving behavior. Verify the rendered site at desktop and mobile sizes and with keyboard navigation.

The server provides the analysis and proposal only. Your coding agent reviews and applies changes to the actual project within its permissions.

### Tool catalog

| Tool | Input | Output |
|---|---|---|
| `audit_design` | Design tokens and brief | Weighted rubric, measured contrast ratios, prioritized actions |
| `propose_design` | Brief | Complete tokens, rubric, CSS, integration checklist |
| `generate_css` | Design tokens | Namespaced CSS; optional grid, focus, shadow and motion classes |

Brief structure:

```json
{"brief":{"kind":"dashboard","density":"balanced","mood":"calm","theme":"light"}}
```

Accepted kinds: `dashboard`, `landing`, `ecommerce`. Densities: `compact`, `balanced`, `airy`. Moods: `calm`, `bold`, `warm`. Themes: `light`, `dark`.

Example audit input:

```json
{
  "brief": {"kind":"dashboard","density":"balanced","mood":"calm","theme":"light"},
  "tokens": {
    "background":"#f6f8fb", "surface":"#ffffff", "text":"#17212f",
    "muted":"#475569", "accent":"#2649b5", "on_accent":"#ffffff", "focus":"#2649b5",
    "fonts":{"caption":12,"body":16,"h3":20,"h2":25,"h1":32},
    "spacing":[4,8,12,16,24,32,48,64], "radius":[4,8,12],
    "motion_ms":180,"reduced_motion":true,"line_height":1.6,
    "columns":4,"mobile_columns":1,"content_width":1440,
    "body_font":"system","heading_font":"system"
  }
}
```

Colors must be six-digit hex values. Sizes, columns and scales are bounded numbers; fonts are predefined family roles. Raw CSS is not accepted.

## Reading the measurements

| Category | Maximum points |
|---|---:|
| Text and focus contrast | 35 |
| Typography | 20 |
| Spacing | 15 |
| Shape | 10 |
| Motion | 10 |
| Layout | 10 |

Category points equal its weight multiplied by the fraction of checks passed. Actions are sorted by explicit priority, then category and stable identifier. The normal text target is 4.5:1; the focus token target against background and surface is 3:1. Other thresholds are documented project heuristics.

**100 rubric points means the supplied values satisfy this limited checklist.** It does not mean a site is fully professional, accessible or certified. Rendered contrast over imagery, target sizes, keyboard order, semantic markup, actual font rendering, actual component state colors, browser zoom, responsive wrapping and actual reduced-motion behavior require separate review.

## Reproduce and test

```sh
python -m unittest discover -s tests -v
python examples/demo.py
```

Tests include reference contrast ratios, every preset combination, priority ordering, input rejection, responsive CSS and a live stdio round-trip for all three tools. CI is configured for Linux and Windows with Python 3.10/3.12. No platform-specific claims are made until CI runs.

## License

MIT. See [LICENSE](LICENSE) and [third-party acknowledgments](THIRD_PARTY.md).

TDQS

B3.4/5.0

Scored across 3 tools

Disambiguation4/5

The three tools target distinct phases: proposing a redesign, auditing an existing design, and generating CSS from tokens. generate_css and propose_design could be slightly confused if a user expects proposed changes to include generated CSS, but the descriptions clarify the boundary reasonably well.

Naming Consistency5/5

All tool names follow a clear verb_noun pattern: generate_css, audit_design, propose_design. The convention is consistent and predictable.

Tool Count5/5

Three tools is a tight, well-scoped set for a design polish workflow: propose, audit, and generate CSS. Each tool has a clear role without unnecessary surface area.

Completeness4/5

The surface covers proposal, audit, and CSS generation, which are the core operations for this domain. A token validation or token parsing tool is implied by 'validated tokens' but not exposed, leaving a minor gap.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues