Skip to main content
Glama
PaletteCraft MCP

PaletteCraft MCP

PaletteCraft MCP

PaletteCraft editorial wordmark

Start with one color. Build a complete design system.

Generated light and dark swatches, three real seed and mood combinations

Gallery: these six palettes come from actual runs of the project. The button labels show calculated foreground/background contrast, and each card reports the measured checks for its own theme.

An original, deterministic design-token engine for frontend and mobile development. Start with a brand color and a mood, produce coordinated light and dark semantic palettes, and receive measured contrast checks before using them in a UI.

  • 14 semantic colors per theme, including text, surfaces, buttons, status text, outlines, and focus.

  • 58 tested color pairs per generation: 29 in each theme.

  • Five moods: balanced, calm, vibrant, warm, and neutral.

  • Contrast checking and foreground adjustment with explicit pass/fail.

  • JSON, CSS custom properties, Tailwind CSS v4, and Flutter Material color roles.

  • Local computation only. No hosted service, API key, model, telemetry, arbitrary code execution, or network request from the tools.

  • Genuine MCP stdio via the official TypeScript SDK.

Quick start

Prerequisites: Node.js 20+ and an MCP client, such as Codex.

git clone https://github.com/ahmedsaeed1-eng/palettecraft-mcp.git
cd palettecraft-mcp
npm ci
npm run build

Connect the built server to Codex:

codex mcp add palettecraft -- node /absolute/path/to/palettecraft-mcp/dist/server.js

Alternatively configure the server in Codex's user config:

[mcp_servers.palettecraft]
command = "node"
args = ["/absolute/path/to/palettecraft-mcp/dist/server.js"]

Use your real absolute path. On Windows, forward slashes or escaped backslashes work in TOML. See the Codex MCP configuration reference.

Then ask your agent:

Generate a calm palette from #0F766E for my app, check light and dark contrast, and return the Tailwind v4 design token export.

Related MCP server: design-token-bridge-mcp

MCP tools

generate_palette

Parameter

Required

Values/default

seed

yes

Opaque six-digit color, e.g. #0F766E

mood

no

balanced (default), calm, vibrant, warm, neutral

format

no

json (default), css, tailwind, dart, all

Example input:

{
  "seed": "#0F766E",
  "mood": "calm",
  "format": "all"
}

Output is structured JSON with light and dark objects. Each has tokens, contrastChecks, and a pass-count summary. The exports object contains the requested integration snippets. JSON mode returns the tokens and checks without additional snippet strings. Every check reports the semantic foreground/background, ratio, threshold, pass flag, and usage.

check_contrast

Parameter

Required

Values/default

foreground

yes

#RRGGBB

background

yes

#RRGGBB

threshold

no

4.5 (default), 3, or 7

Example input:

{"foreground":"#777777","background":"#FFFFFF","threshold":4.5}

The input fails the 4.5:1 threshold. The tool returns a measured suggestion, its ratio, and its own passes flag. A suggestion can fail when the requested threshold is mathematically impossible for the chosen background; the tool does not label it as a pass.

Semantic token reference

Token

Intended use

background / surface / surfaceVariant

Canvas, panel, elevated/tinted panel

text / textMuted

Body and secondary text on the three surfaces

primary / onPrimary

Link or button fill, with label on button

secondary / onSecondary

Secondary action and its label

success / warning / error

Status text paired with an icon or label

outline / focus

Control boundary or focus visual against surfaces

Exports

CSS custom properties

Use the generated CSS in your app stylesheet, and set the theme attribute on the document root or theme container:

<body data-theme="dark">
  <button class="primary">Continue</button>
</body>
.primary {
  background: var(--pc-primary);
  color: var(--pc-on-primary);
}

Tailwind CSS v4

The export combines the generated custom properties with top-level @theme inline declarations. Tailwind utility classes reference the current theme at runtime:

<div class="bg-pc-background text-pc-text">
  <button class="bg-pc-primary text-pc-on-primary">Continue</button>
</div>

It is designed for Tailwind CSS v4, not v3.

Flutter

The Dart export provides paletteCraftLight and paletteCraftDark ThemeData values and explicit Material 3 color roles. Paste the snippet in a Dart file in your app, then integrate both:

MaterialApp(
  theme: paletteCraftLight,
  darkTheme: paletteCraftDark,
  themeMode: ThemeMode.system,
)

Core Material color roles are mapped using the ColorScheme API. Other Flutter theme roles rely on framework defaults and require their own review. Always validate real app screens, states, and text sizes.

Explore the output: calm teal

Seed #0F766E, mood calm. Palette swatches and check totals below are generated by the actual algorithm, not a hand-picked design mock.

Token

Light

Dark

background

#F9FAFA

#101414

surface

#FFFFFF

#1B2221

text

#1B2222

#EEF2F1

textMuted

#5A7270

#9EB3B1

primary

#267973

#87D9D3

onPrimary

#F9FAFA

#131616

secondary

#3D7396

#87B3CF

success

#257C4E

#7DD8A8

warning

#95630F

#F1C374

error

#AB2521

#E98E8B

Measured pairs passed: light 29/29, dark 29/29.

Run the included example for the entire structured JSON report and snippets:

npm run example

Contrast methodology

The engine converts each opaque sRGB input to relative luminance and calculates the ratio of the brighter and darker color. Normal text pairs use the WCAG AA minimum of 4.5:1. Outline/focus pairs use 3:1. The standalone checker also supports 7:1. See WCAG 2.2 contrast and non-text contrast.

To improve a failing foreground, it searches the same hue and saturation at 0.1% HSL lightness increments. The selected passing candidate minimizes lightness displacement among those candidates; for multiple surfaces it must pass against all of them. If none meets the threshold, the candidate with the highest observed minimum contrast is returned with passes=false. Pass/fail always uses the unrounded ratio.

PaletteCraft does not certify a UI as WCAG conformant. It checks listed opaque static color pairs, not alpha blending, gradients, rendered font size, focus geometry, dynamic states, color perception, or assistive technology. Never communicate status using color alone.

Development

npm ci
npm test

Tests cover reference luminance values, unrounded threshold decisions, hex/HSL conversion, feasible and impossible contrast adjustments, 45 seed/mood combinations across both themes, export consistency, and a real MCP client/server exchange including schema validation. Flutter and Tailwind snippets are inspected for token consistency; this test suite does not compile a Flutter app or build a Tailwind project.

No accounts or secrets are necessary.

License

MIT. Original design-token and contrast code by Ahmed Saeed. See THIRD_PARTY.md for independent dependency licenses and the referenced W3C specification.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive color conversion, manipulation, analysis, and WCAG accessibility tools supporting multiple formats (hex, rgb, hsl, oklch, oklab) for design systems and web development.
      32 npm
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Translates design tokens across platforms — extracts from Tailwind/CSS/Figma and generates native themes for Material 3, SwiftUI, and CSS variables with WCAG contrast validation.
      9
      82 npm
      5
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to generate complete, deterministic design systems from a single brand color — harmonious palettes, font pairings, type and spacing scales, elevation shadows, responsive grids, motion presets, dark-mode themes, and WCAG contrast audits — and export them as CSS, JSON, Tailwind, or SCSS through natural conversation.
      10
      60 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to work with color: converting between formats like HEX, OKLCH and Display P3, checking and fixing WCAG 2 and APCA contrast, auditing palettes for accessibility and color blindness, and generating palettes, gradients, scales and design tokens.
      18
      MIT