feat(cli): add exfig_export and exfig_download MCP tools#74
Conversation
Add two new MCP tools for AI-driven design system workflows: - exfig_export: runs platform code export as subprocess, returns structured JSON report (supports colors/icons/images/typography/all with cache, rate limit, and granular cache options) - exfig_download: exports W3C Design Tokens JSON inline without file I/O (supports colors/typography/tokens with w3c/raw formats) Includes 6 unit tests, updated DocC documentation, and CLAUDE.md guidance for adding future MCP tool handlers.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces two new MCP tools, Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two new MCP tools, exfig_export and exfig_download, which expose core ExFig functionality for programmatic use. The exfig_export tool runs exports as a subprocess, while exfig_download provides inline JSON output for design tokens. The implementation is solid, including good use of modern Swift concurrency for subprocess management. The changes also include necessary documentation updates and unit tests for input validation. My review includes a couple of suggestions for improvement in MCPToolHandlers.swift: one to enhance feature parity with the CLI and another to refactor a long function for better maintainability.
Link to exfig-plugins marketplace from README, DocC landing page, MCP Server article, and CLAUDE.md files.
- downloadColors now falls back to ColorsLoader (Styles API) when variablesColors is not configured, matching CLI behavior - Extract downloadAndMergeColors/Typography/Numbers helpers from downloadUnifiedTokens for better readability
…, and silent failures Fix critical subprocess race condition where terminationHandler was set after process.run(), causing potential infinite hangs. Read stderr concurrently to prevent pipe buffer deadlock. Add 5-minute subprocess timeout via withThrowingTaskGroup race pattern. Make encodeJSON and buildDownloadResponse throw instead of silently swallowing errors with try?. Replace .localizedDescription with String(describing:) in catch-all for better error messages. Add format parameter validation, skipped-section warnings in downloadUnifiedTokens, and raw-format warning passthrough. Extract requireResourceType helper, test expectError helper, and add private access control to match existing handler conventions.
Summary
exfig_exportMCP tool — runs platform code export (Swift/Kotlin/Dart/CSS) as subprocess, returns structured JSON report with support for cache, rate limiting, and granular cache optionsexfig_downloadMCP tool — exports W3C Design Tokens JSON inline (colors/typography/tokens) without file I/O, with w3c/raw format supportTest plan
./bin/mise run build— compiles cleanly./bin/mise run lint— no warnings or errors./bin/mise run format-check— passes./bin/mise run test:filter MCPTool— 15/15 tests pass (9 existing + 6 new)exfig.pkl+FIGMA_PERSONAL_TOKEN(requires Figma access)