Repository navigation
feat: Blocks fork hardening — deps, no telemetry, per-request Figma token, rename to @blocksuser/mcp-figma - #1
Draft
cubeorgdev[bot] wants to merge 19 commits into
Draft
cubeorgdev[bot] wants to merge 19 commits into
cubeorgdev[bot] wants to merge 19 commits into
Conversation
CVE-2025-53967 and CVE-2025-15061 were a curl fallback built with child_process.exec. The code is already gone; this keeps it gone through future upstream cherry-picks. 🤖 Generated with BLOCKS!
- @modelcontextprotocol/sdk 1.29.0 -> ^1.32.2 (OAuth credential leak to the wrong AS, unbounded request body, task/session binding); server API unchanged - undici ^7.30.1, express ^5.3.0, js-yaml ^4.3.2, zod ^4.6.6 (memory exhaustion on oversized collections; schemas needed no changes) - @figma/rest-api-spec ^0.47.0 (May-Oct 2026 API additions) - @jimp/* ^1.6.1: moves jimp off file-type 16 (ASF parser loop) on its own - pnpm.overrides for transitives upstream ranges still allow: proxy-addr (critical, IP spoofing), body-parser, qs, path-to-regexp, hono, @hono/node-server, express-rate-limit, ip-address, fast-uri, and zod for @jimp/types (it only validates jimp's own option objects; image tests pass) - CI: pnpm audit --prod --audit-level=high gate; dependabot weekly (npm + actions) Supersedes upstream PR GLips#405 (older versions of the same overrides). 🤖 Generated with BLOCKS!
A Blocks-maintained fork must not phone home: drop src/telemetry (PostHog)
and posthog-node, the --no-telemetry flag, FRAMELINK_TELEMETRY / DO_NOT_TRACK,
and the per-call outcome hooks that only existed to feed it. The
validateToolInput monkey patch stays, reduced to its user-facing half
("Invalid <field>: <message>"), as src/mcp/validation-errors.ts.
A stdio server is spawned with an arbitrary cwd — in a Blocks sandbox the
user's repository — so it no longer auto-loads ./.env (dotenv's override:true
would let a repo file replace the host-injected credentials). An explicit
--env <path> still loads; HTTP mode and the fetch CLI keep the implicit load.
🤖 Generated with BLOCKS!
parseInt("abc", 10) returns NaN which propagated as a valid number
through the config system — setting PORT=abc would try to listen on
port NaN. added isNaN check so non-numeric values are skipped.
(cherry picked from commit 1fe9b8b)
🤖 Generated with BLOCKS!
parsePaint threw on any paint type outside its known set, and the throw
failed the entire get_figma_data request. Paint types absent from the
REST spec reach real files (Figma code-component CUSTOM paints, observed
2026-08-22), so one such paint on one node made a whole file/subtree
uncapturable.
Unknown paint types now return { type, unknownPaint: true, raw } with
the original paint preserved, log an error line, and leave the rest of
the simplification untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 5fdb960)
🤖 Generated with BLOCKS!
(cherry picked from commit ad28cd4) 🤖 Generated with BLOCKS!
… breaks (cherry picked from commit db3081a) 🤖 Generated with BLOCKS!
(cherry picked from commit 11df79a) 🤖 Generated with BLOCKS!
(cherry picked from commit 78e6168) 🤖 Generated with BLOCKS!
Normalize both API response shapes into a common slice list so parseAPIResponse aggregates roots/components/styles declaratively, and make the metrics pass (countNamedStyles, detectVariables) skip null node entries so a partial miss (some ids resolve, some don't) no longer crashes with a TypeError after simplify. Also surface skipped ids via Logger, tighten the nodeId regex grammar, and add cross-node dedup + partial-miss regression tests. (cherry picked from commit d96cfb9) 🤖 Generated with BLOCKS!
A multi-node fetch where some ids resolve and others don't previously only logged the gap server-side, so the LLM could act on an incomplete design as if it were complete. Carry missingNodeIds onto SimplifiedDesign (present only when non-empty, so the common case costs no tokens) and render a MISSING_NODES line in the tree format; YAML/JSON pick it up via metadata. (cherry picked from commit 5637d60) 🤖 Generated with BLOCKS!
The spec now types ComponentProperty.value / ComponentPropertyDefinition .defaultValue as boolean | string | SlotContentId (new SLOT kind). The two casts in built-in.ts had been hiding the union; the simplifiers now take the spec types and narrow on the property kind, so a SLOT guid can never reach the flat name -> scalar output. VariableValue's new VariableComposedColor needs nothing: no code narrows VariableValue. Also reconciles the endpoint assertions from upstream GLips#404 with the geometry=paths query upstream GLips#420 added (the two PRs never met upstream). 🤖 Generated with BLOCKS!
… on 401 Figma keeps one live access token per app per user, so a refresh by the issuer (the Blocks OAuth monitor) kills the token a long-running server read at startup. FigmaService now takes a CredentialSource evaluated per request: token file (--figma-oauth-token-file / FIGMA_OAUTH_TOKEN_FILE, default ~/.config/figma/.oauth_token) -> --figma-oauth-token / FIGMA_OAUTH_TOKEN -> --figma-api-key / FIGMA_API_KEY. On a 401 it re-resolves and retries once only if the token changed; otherwise (or on a second 401) it throws a message that names get_new_figma_token and the one-token rule. HTTP per-request header auth is unchanged (fixed for that request). The static FigmaAuthOptions triple is still accepted everywhere, wrapped as a constant source, so existing callers and tests are untouched. The 403 and 429 messages are as before. 🤖 Generated with BLOCKS!
package name / bin (figma-mcp) / repository / homepage / mcpName and server.json now point at BlocksOrg; the release workflow's owner gate follows, pnpm publish gets --access public (scoped first publish), and the MCP registry steps are non-fatal (the registry listing is optional for the fork). README gains a Blocks fork section (why it exists, how to merge upstream) and the install snippets use the new package; FUNDING.yml (upstream's sponsor button) is removed. 🤖 Generated with BLOCKS!
…gma MCP whoami (GET /v1/me), get_figma_comments, get_figma_file_versions, get_figma_dev_resources and get_figma_components_and_styles, each a lean YAML projection of the Figma response (author handle instead of the user object, pinned node id, reply threading; empty/null fields dropped). They share one SimpleTool contract so registration is a loop, and all carry readOnlyHint. No write tools. 🤖 Generated with BLOCKS!
Author
|
This pull request was created from a Blocks session. View in dashboard | View on desktop
|
| `- FIGMA_OAUTH_TOKEN_FILE: ${figmaOauthTokenFile.value || "(disabled)"} (source: ${configSources.figmaOauthTokenFile})`, | ||
| ); | ||
| if (credential?.kind === "oauth") { | ||
| console.log(`- OAuth token: ${maskApiKey(credential.token)} (source: ${credential.source})`); |
| `- FIGMA_API_KEY: ${maskApiKey(auth.figmaApiKey)} (source: ${configSources.figmaApiKey})`, | ||
| ); | ||
| } else if (credential) { | ||
| console.log(`- API key: ${maskApiKey(credential.token)} (source: ${credential.source})`); |
| function stubFigmaResponse(makeResponse: () => Response) { | ||
| const realFetch = globalThis.fetch; | ||
| fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => { | ||
| if (String(input).startsWith("https://api.figma.com")) { |
Author
|
Test from the |
…se-please) `publish.yml` (workflow_dispatch, bump = patch|minor|major) type-checks, tests, builds, bumps package.json + server.json, commits and tags `vX.Y.Z`, creates the GitHub Release with generated notes and runs `pnpm publish --access public` with the org `NPM_TOKEN` secret — the same one-button flow BlocksOrg/mcp-linear uses. Release-please config, the OIDC trusted-publishing job and the MCP-registry publish step are removed; CLAUDE.md, CONTRIBUTING.md and the /release command describe the new flow. 🤖 Generated with BLOCKS!
Same arguments and behaviour as BlocksOrg/mcp-linear/scripts/publish.sh (`<patch|minor|major> [--rc]`, rc dist-tag, rc-number bump when already an rc), plus `--dry-run` and the server.json version sync. Force-added: the upstream .gitignore ignores scripts/ wholesale while tracking the files in it. 🤖 Generated with BLOCKS!
… on PATH mcp-linear is an npm project, so its publish.sh never needed pnpm; this fork is pnpm-only (lockfile, packageManager pin, overrides, prepack). The script now uses the pinned pnpm through npx when none is installed and runs install when node_modules is missing, so a machine with only Node + npm can publish. 🤖 Generated with BLOCKS!
…er/mcp-linear) Published as @blocksuser/mcp-figma@0.14.0-rc.2; package.json / server.json now carry that name and version, and every reference (bin, README, publish script, issue template, tests) follows. 🤖 Generated with BLOCKS!
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.
Hardens the fork for use as the Figma MCP server inside Blocks sandboxes (plan "Repo 4"). 15 commits, each one logical step; review in order.
What changes
@modelcontextprotocol/sdk ^1.32.2(server API unchanged),undici ^7.30.1,express ^5.3.0,js-yaml ^4.3.2,zod 4,@jimp/* ^1.6.1,@figma/rest-api-spec ^0.47.0, pluspnpm.overridesfor the transitive stragglers (proxy-addr,body-parser,qs,path-to-regexp,hono,@hono/node-server,express-rate-limit,ip-address,fast-uri).pnpm audit --prod --audit-level=highis now a CI gate; dependabot runs weekly. Upstream PR chore(deps): clear pnpm audit advisories in the production tree GLips/Figma-Context-MCP#405 was inspected and superseded.child_process/exec()out ofsrc/(CVE-2025-53967 / CVE-2025-15061 were thatcurlfallback).posthog-node,--no-telemetry, theFRAMELINK_TELEMETRY/DO_NOT_TRACKopt-outs). stdio mode no longer auto-loads./.envfrom its cwd (a user repo's.envmust not override the host-injected token);--env <path>still works.--figma-oauth-token-file/FIGMA_OAUTH_TOKEN_FILE, default~/.config/figma/.oauth_token) >FIGMA_OAUTH_TOKEN>FIGMA_API_KEY. On a 401 the credential is re-resolved; if it changed the request is retried once, otherwise (or on a second 401) the tool returns an actionable error that namesget_new_figma_tokenand the one-live-token-per-app-per-user rule. 403 / 429 handling and HTTP-mode per-request header auth are unchanged.SLOTcomponent properties handled explicitly, no moreascasts hiding the widened union) and upstream PRs feat: fetch multiple Figma nodes in one get_figma_data call GLips/Figma-Context-MCP#404 (multi-nodeget_figma_data), fix: envInt returns NaN for non-numeric env vars GLips/Figma-Context-MCP#410, fix: preserve node rotation, true size, ink bounds, and explicit line breaks GLips/Figma-Context-MCP#420, fix: pass unknown paint types through marked instead of throwing GLips/Figma-Context-MCP#421 (unknown paint types pass through), fix: emit valid CSS for text shadows GLips/Figma-Context-MCP#427 cherry-picked. Reviewer note: fix: preserve node rotation, true size, ink bounds, and explicit line breaks GLips/Figma-Context-MCP#420 addsgeometry=pathsto file/node fetches (needed for ink bounds), which enlarges responses on vector-heavy files.whoami,get_figma_comments,get_figma_file_versions,get_figma_dev_resources,get_figma_components_and_styles. No write tools.@blocksuser/mcp-figma(binmcp-figma), repo links → BlocksOrg. README gets a "Blocks fork" section (why it exists, how to merge upstream) and documents the credential contract.scripts/publish.sh <patch|minor|major> [--rc] [--dry-run]is mcp-linear's local publish script ported to pnpm (bumppackage.json+server.json, build,pnpm publish --access public --tag latest|rc; dry-run verified: 0.13.2 → 0.14.0, 15-file tarball), and.github/workflows/publish.ymlis a manualworkflow_dispatch(bump = patch / minor / major) that type-checks, tests, builds, bumpspackage.json+server.json, tagsvX.Y.Z, creates the GitHub Release and runspnpm publish --access publicwith theNPM_TOKENsecret. Nothing publishes on merge./releasecommand, CLAUDE.md and CONTRIBUTING.md updated.Gates on HEAD
pnpm type-checkclean ·pnpm test304 passed / 1 skipped (live-API suite gated onRUN_FIGMA_INTEGRATION) ·pnpm buildOK ·pnpm audit --prod"No known vulnerabilities found".Before the first release
NPM_TOKENrepository secret (only needed for the GitHub workflow path) (the same@blocksuserorg token mcp-linear publishes with).0.14.0-rc.2is already published under thercdist-tag (locally, viascripts/publish.sh minor --rc). For the stable release, publishv0.14.0either locally (npm loginas an@blocksusermember,./scripts/publish.sh minor, then commit the bump, tagv0.14.0,git push --follow-tags) or by running the Publish to npm workflow withminor.--access publicis set in both."@blocksuser/mcp-figma": "^0.14.0"to everydependencies/*.package.jsonin BlocksOrg/agents and re-point orchestration-svc'ssrc/mcp/directory.jsonentry fromfigma-developer-mcp@0.13.2to@blocksuser/mcp-figma(drop the Dockerfile preinstall and the telemetry env; orchestration-svc #1733 ships with the upstream pin as a stopgap).Companion PRs: orchestration-svc #1733, agents #574, client-monorepo #1258.
🤖 Generated with BLOCKS!