design-tokens-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@design-tokens-mcp list all color tokens"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
design-tokens-mcp-server
デザイントークン(色・余白・フォント)を1つのJSONファイルで管理し、MCP経由でエージェントに読み書き・書き出し・ドリフト検知をさせる最小構成のMCPサーバーです。
FigmaのMCPサーバー+Skillエコシステムで注目される「デザイントークンをコードとデザインの間で同期し、ずれ(ドリフト)を検知する」というワークフローを、Figma契約なしで体験できる教材として実装しています。
できること
サーバーは5つのツールを公開します。
ツール | 内容 |
tokens_list | トークン一覧(type / 名前プレフィックスで絞り込み可) |
tokens_get | 1件取得。名前が違うときは近い候補を提示 |
tokens_set | 追加・更新。型ごとに値を検証(colorはhex、dimensionは単位付き数値など) |
tokens_export | css / tailwind / figma-variables 形式で書き出し |
tokens_check_drift | CSSファイル内のハードコードされた色・px値をトークンと照合し、ずれを最寄りトークン付きで報告 |
トークンファイルはW3C Design Tokens(DTCG)風の $type / $value 形式です。tokens.example.json を参照してください。
Related MCP server: eds-mcp-server
動作要件
Node.js 18以上(動作確認は v22)
セットアップ
git clone <このリポジトリのURL>
cd design-tokens-mcp
npm install
npm run build
npm testnpm test はビルド済みサーバーをstdioで起動し、5ツールすべて(バリデーションエラーとドリフト検知を含む16項目)を検証します。すべてPASSすれば準備完了です。
Claude Codeへの登録
claude mcp add design-tokens \
--env TOKENS_FILE=/絶対パス/tokens.json \
-- node /絶対パス/design-tokens-mcp/dist/index.jsTOKENS_FILE を省略するとカレントディレクトリの tokens.json を使います。初回は tokens.example.json をコピーして始めてください。
cp tokens.example.json tokens.json他のMCPクライアント(Cursor等)でも、stdioサーバーとして node dist/index.js を登録すれば動きます。
使用例
エージェントへの指示例:
「トークン一覧を見せて」→ tokens_list
「spacing.xl を 32px で追加して」→ tokens_set(
32だけを渡すと単位がないためエラーになり、修正方法が返ります)「トークンをCSS変数に書き出して styles/tokens.css に保存して」→ tokens_export
「src/app.css がトークンからずれていないか調べて」→ tokens_check_drift
ドリフト検知の出力例(実際の実行結果):
{
"checked_file": "/tmp/sample.css",
"matched": 2,
"drift_count": 2,
"drift": [
{
"value": "#0e7a6f",
"line": 3,
"kind": "color",
"nearest_token": "color.primary",
"nearest_value": "#0F766E"
},
{
"value": "23px",
"line": 5,
"kind": "dimension",
"nearest_token": "spacing.lg",
"nearest_value": "24px"
}
]
}設計メモ
Anthropicのmcp-builderスキルの指針に沿っています。
ツール名はサービス接頭辞付きのsnake_case(tokens_list など)
入力はZodスキーマで検証し、制約違反時は「次に何をすべきか」を含むエラーメッセージを返す
読み取り系ツールには readOnlyHint / idempotentHint のannotationsを付与
出力は structuredContent(構造化データ)とテキストの両方で返す
ライセンス
MIT License. 詳細は LICENSE を参照してください。
Available Tools
5 toolstokens_check_driftDetect token drift in a CSS fileARead-onlyIdempotent
Scan a CSS file for hardcoded hex colors and px values, and compare each against the design tokens. Values that exactly match a token are reported as 'matched'; values that match no token are reported as 'drift', each with the nearest token as a fix suggestion. Returns { checked_file, matched, drift: [{ value, line, kind, nearest_token, nearest_value }] }. Use this after editing styles to keep code and design tokens in sync.
Inputs: css_path (required).
tokens_exportExport tokens to codeAIdempotent
Export all design tokens in one of three formats: 'css' (CSS custom properties in a :root block), 'tailwind' (a Tailwind theme.extend fragment as CommonJS), or 'figma-variables' (a JSON shape close to Figma's Variables API with name/resolvedType/value). Returns { format, code }. Optionally pass out_path to also write the result to a file.
Inputs: format (required), out_path.
tokens_getGet one design tokenARead-onlyIdempotent
Get a single design token by its dot-path name, e.g. 'color.primary'. Returns { name, type, value }. If the token does not exist the error lists close matches; call tokens_list to see all names.
Inputs: name (required).
tokens_listList design tokensARead-onlyIdempotent
List all design tokens in the token file. Optionally filter by type (color, dimension, fontFamily, number) or by name prefix such as 'color.'. Returns { count, tokens: [{ name, type, value }] }. Use this first to discover token names before calling tokens_get or tokens_set.
Inputs: type, prefix.
tokens_setCreate or update a design tokenAIdempotent
Create or update a design token. The value is validated against the token type before writing: color must be hex (#0F766E), dimension must have a unit (16px, 1.5rem), fontFamily must be a non-empty string, number must be numeric. Writes the token file in place and returns { name, type, value, created }. This is the only tool in this server that modifies the token file.
Inputs: name (required), type (required), value (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: listing, getting, setting, exporting, and drift-checking. No overlap.
All tool names follow a consistent 'tokens_verb' pattern with snake_case, making the set predictable.
5 tools is well-scoped for a design token server; each tool covers a core operation without redundancy.
The set covers CRUD except deletion, and includes export and drift detection. A delete token tool is missing, but the surface is otherwise complete for common workflows.
Related MCP Connectors
On-demand drift checks: declared CSS color, radius, spacing & type vs your own tokens or a pack
Access and maintain design system docs, tokens, components, skills, and contexts across any project.
Give AI agents your deeepSpace design system: components, tokens, styles and code mappings.
Give your agent a real design system: tokens, measured WCAG contrast, and rules to follow.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that exposes your design system components and tokens to AI agents, preventing duplicate component creation and hardcoded token values.4 npm9MIT
- AlicenseBqualityCmaintenanceEnables AI agents to access design system tokens and component contracts through MCP, reducing token usage and ensuring consistency.29MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI IDEs to query Figma design tokens, component specs, and audit issues via MCP tools, without cloud subscriptions.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to validate design system constraints, including WCAG accessibility, token relationships, and consistency, through MCP tools like validate, explain, and suggest-fix.56 npmMIT