Skip to content

feat(cli): add exfig_export and exfig_download MCP tools#74

Merged
alexey1312 merged 5 commits intomainfrom
feature/mcp-export-tools
Mar 20, 2026
Merged

feat(cli): add exfig_export and exfig_download MCP tools#74
alexey1312 merged 5 commits intomainfrom
feature/mcp-export-tools

Conversation

@alexey1312
Copy link
Collaborator

@alexey1312 alexey1312 commented Mar 20, 2026

Summary

  • Add exfig_export MCP tool — runs platform code export (Swift/Kotlin/Dart/CSS) as subprocess, returns structured JSON report with support for cache, rate limiting, and granular cache options
  • Add exfig_download MCP tool — exports W3C Design Tokens JSON inline (colors/typography/tokens) without file I/O, with w3c/raw format support
  • Add 6 unit tests for input validation (missing/invalid params, missing config)
  • Update DocC MCP Server docs and CLAUDE.md with MCP handler development guidance

Test 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)
  • Manual test with real exfig.pkl + FIGMA_PERSONAL_TOKEN (requires Figma access)

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.
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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, exfig_export and exfig_download, enhancing the capabilities of the ExFig CLI. It also includes input validation tests and documentation updates to guide developers in using and extending the MCP server.

Highlights

  • New MCP Tools: Introduced exfig_export for platform code export and exfig_download for exporting W3C Design Tokens JSON.
  • Input Validation: Added six unit tests to validate input parameters for the new MCP tools.
  • Documentation Updates: Updated DocC MCP Server documentation and CLAUDE.md with MCP handler development guidance.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@alexey1312 alexey1312 merged commit b707deb into main Mar 20, 2026
1 check passed
@alexey1312 alexey1312 deleted the feature/mcp-export-tools branch March 20, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant