Add disk cache to byass figma rate limits#256
Open
stone-w4tch3r wants to merge 6 commits intoGLips:mainfrom
Open
Add disk cache to byass figma rate limits#256stone-w4tch3r wants to merge 6 commits intoGLips:mainfrom
stone-w4tch3r wants to merge 6 commits intoGLips:mainfrom
Conversation
Implements disk-based caching for Figma file responses with configurable TTL to address Figma's strict rate limits for free tier users. When enabled, the server fetches each file once and serves subsequent requests from cache. Key features: - Atomic writes using temp files to prevent cache corruption - Async initialization with write permission validation - Platform-specific default cache directories (XDG compliant on Linux) - Configurable via FIGMA_CACHING environment variable - TTL support with multiple time units (ms, s, m, h, d) - Comprehensive error handling and logging Technical improvements: - Added race condition documentation for concurrent requests - Validates cache directory permissions on startup - Clear user-facing error messages for cache failures - Proper async/await initialization pattern 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Codex <noreply@openai.com>
When FIGMA_CACHING is enabled and cached data is served, AI agents now receive a clear notification prepended to the tool response indicating: - Data is from cache (not fresh from API) - When the data was originally fetched - When the cache will expire - That caching is enabled via FIGMA_CACHING environment variable Implementation: - Modified FigmaService.getRawFile/getRawNode to return cache metadata - Updated FigmaFileCache.get() to include cachedAt and ttlMs in response - Added formatCacheNotice() helper for human-readable time formatting - Prepends notice to YAML/JSON output in get_figma_data tool - Updated tests to handle new return structure Example output: ℹ️ Note: Using cached Figma data (fetched 2h 15m ago, expires in 27d 21h) due to FIGMA_CACHING environment variable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Support pre-caching of Figma document to reduce number of requests to real API from N to 1. This will allow to use this MCP with free Figma account without hitting rate limits.
Summary
Testing