Part of #266 — Leonardo AI tooling initiative.
Summary
Create a new monorepo package packages/mcp/ published as @adobe/leonardo-mcp. This is an MCP (Model Context Protocol) server that wraps @adobe/leonardo-contrast-colors at runtime, so AI assistants can generate verified, executable color output rather than approximating from documentation.
Follows the same pattern as @adobe/spectrum-design-data-mcp and @react-spectrum/mcp.
What makes this different from the Agent Skill
The Agent Skill teaches an AI how to use the library. The MCP server runs the library on the AI's behalf — producing real hex values, real contrast ratios, and real theme JSON that can be dropped directly into a project.
Package structure
packages/mcp/
├── package.json # name: @adobe/leonardo-mcp, bin: src/cli.js
├── moon.yml # moon task definitions
└── src/
├── cli.js # #!/usr/bin/env node — npx entrypoint
├── server.js # MCP server using @modelcontextprotocol/sdk StdioServerTransport
└── tools/
├── generate-theme.js # Theme + contrastColors
├── check-contrast.js # contrast() wrapper with WCAG pass/fail
├── convert-color.js # convertColorValue() wrapper
└── create-palette.js # Color + createScale() wrapper
Tools to expose
generate-theme
Inputs: array of color definitions (name, colorKeys, ratios, colorspace), lightness, contrast multiplier, saturation, output format.
Output: theme.contrastColors JSON — ready to paste into a design token file.
check-contrast
Inputs: foreground color, background color, optional contrast method (wcag2 | wcag3).
Output: ratio value, WCAG 2 AA/AAA pass/fail, APCA Lc value if wcag3 selected.
convert-color
Inputs: color value (any supported format), target format.
Output: converted color string.
create-palette
Inputs: colorKeys, colorspace, number of steps.
Output: array of interpolated color values.
Key technical decisions
- Transport:
StdioServerTransport — works with npx @adobe/leonardo-mcp, no HTTP server required.
- Runtime dependency:
@adobe/leonardo-contrast-colors as a workspace sibling (workspace:*), bundled at publish time.
- Input validation:
zod schemas for each tool's inputs.
- SDK:
@modelcontextprotocol/sdk
Cursor integration
Add .cursor/mcp.json to the repo:
{
"mcpServers": {
"leonardo": {
"command": "node",
"args": ["packages/mcp/src/cli.js"]
}
}
}
Published usage (post-release):
{
"mcpServers": {
"leonardo": {
"command": "npx",
"args": ["@adobe/leonardo-mcp"]
}
}
}
Moon integration
Add mcp to the workspace project list and add a moon.yml with build and test tasks matching the pattern in packages/contrast-colors/moon.yml.
Acceptance criteria
Part of #266 — Leonardo AI tooling initiative.
Summary
Create a new monorepo package
packages/mcp/published as@adobe/leonardo-mcp. This is an MCP (Model Context Protocol) server that wraps@adobe/leonardo-contrast-colorsat runtime, so AI assistants can generate verified, executable color output rather than approximating from documentation.Follows the same pattern as
@adobe/spectrum-design-data-mcpand@react-spectrum/mcp.What makes this different from the Agent Skill
The Agent Skill teaches an AI how to use the library. The MCP server runs the library on the AI's behalf — producing real hex values, real contrast ratios, and real theme JSON that can be dropped directly into a project.
Package structure
Tools to expose
generate-themeInputs: array of color definitions (name, colorKeys, ratios, colorspace), lightness, contrast multiplier, saturation, output format.
Output:
theme.contrastColorsJSON — ready to paste into a design token file.check-contrastInputs: foreground color, background color, optional contrast method (
wcag2|wcag3).Output: ratio value, WCAG 2 AA/AAA pass/fail, APCA Lc value if wcag3 selected.
convert-colorInputs: color value (any supported format), target format.
Output: converted color string.
create-paletteInputs: colorKeys, colorspace, number of steps.
Output: array of interpolated color values.
Key technical decisions
StdioServerTransport— works withnpx @adobe/leonardo-mcp, no HTTP server required.@adobe/leonardo-contrast-colorsas a workspace sibling (workspace:*), bundled at publish time.zodschemas for each tool's inputs.@modelcontextprotocol/sdkCursor integration
Add
.cursor/mcp.jsonto the repo:{ "mcpServers": { "leonardo": { "command": "node", "args": ["packages/mcp/src/cli.js"] } } }Published usage (post-release):
{ "mcpServers": { "leonardo": { "command": "npx", "args": ["@adobe/leonardo-mcp"] } } }Moon integration
Add
mcpto the workspace project list and add amoon.ymlwithbuildandtesttasks matching the pattern inpackages/contrast-colors/moon.yml.Acceptance criteria
packages/mcp/exists as a valid monorepo packagenpx @adobe/leonardo-mcpstarts the server without errors#cacacabackground at lightness 97 with ratio 4.5 → expected hex).cursor/mcp.jsonadded to repo for local developmentmoon.ymladded withbuildandtesttasks