Skip to content

Figma signs in with the team's own Figma app - #518

Merged
nambok merged 1 commit into
mainfrom
figma-own-app
Nov 8, 2026
Merged

nambok merged 1 commit into
mainfrom
figma-own-app

Conversation

@nambok

@nambok nambok commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

A team can now use its own Figma OAuth app. Figma's MCP server only takes OAuth clients Figma approved: dynamic registration returns 403, and the mcp:connect scope is refused to every other app. Figma's REST API takes tokens from any OAuth app, though, and a private Figma app needs no review for people in the team or organization that owns it. The catalog package (figma-developer-mcp) reads FIGMA_OAUTH_TOKEN and sends it as a bearer token. So the team pastes its app's client id and secret, an admin signs in once, and the package gets that token in place of a personal access token. The token is renewed before it expires. The key path stays as a fallback.

Changes

  • mcp_catalog::own_app describes the own-app sign-in for a catalog server. Figma's entry has authorize https://www.figma.com/oauth, token https://api.figma.com/v1/oauth/token, refresh https://api.figma.com/v1/oauth/refresh, scopes current_user:read and file_content:read, and env var FIGMA_OAUTH_TOKEN. The scopes are exactly what the package and the connection check call, and a test pins them.
  • New mcp_remote::own_app module. The sign-in is a normal ServerRecord (app-figma, catalog_id app:figma) with a manual client and the secret sealed with KMS, plus PKCE, a one-time state and sealed tokens. The record has no tools and is never listed or used as an MCP server (store::is_token_only). Saving a different client id ends the old sign-in. Saving the same client id with a blank secret keeps the saved secret. token_env returns a fresh token for the package, and check calls GET /v1/me after sign-in so the card shows a token Figma refuses.
  • OAuthSettings.refresh_endpoint covers providers that refresh at a separate address. Figma sends the client in a Basic header and doesn't rotate the refresh token, so the old refresh token is kept.
  • Gateway changes:
    • New route PUT /api/mcp-servers/apps/:catalog_id (admin, in the permissions table). Connect, disconnect and remove reuse /api/mcp-servers/app-figma/....
    • The OAuth callback checks an own-app sign-in instead of listing tools.
    • The Integrations card shows the own-app state and the redirect URI.
    • The catalog JSON carries own_app.
    • Plan chat runs the package with the token (plugins::package_env).
  • Worker: load_team_plugins adds the catalog servers signed in with an own app, or marks the existing key plugin, and build_env_vars passes the token instead of the key.
  • Docs: the self-host integrations and hybrid pages explain why Figma needs your own app or a key, and how to set the app up.

Verification

  • cargo fmt --all --check: clean.
  • cargo clippy -p common -p gateway -p worker --all-targets -- -D warnings: clean.
  • cargo test -p common: 1563 passed, plus no_hosted_urls 2 passed.
  • cargo test -p gateway: 758 passed.
  • cargo test -p worker: 1408 passed.
  • New tests cover:
    • The authorize URL (client id, redirect, scopes, S256, no resource).
    • The code exchange with a Basic header and no secret in the body.
    • Renewal at /v1/oauth/refresh that keeps the old refresh token.
    • Fallback to the key when there is no sign-in.
    • Changing to another app, and keeping the secret for the same app.
    • The /v1/me check marking a refused token.
    • The card states.
    • Worker plugin assembly.
  • I checked figma-developer-mcp 0.13.2 directly: with FIGMA_OAUTH_TOKEN set it sends Authorization: Bearer, and it calls /v1/files, /v1/files/:key/nodes, /v1/images and /v1/files/:key/images, all of which need file_content:read.
  • Not checked against live Figma: a real sign-in, token exchange and refresh with a live Figma app.

@nambok
nambok merged commit 5f361c3 into main Nov 8, 2026
10 checks passed
@nambok
nambok deleted the figma-own-app branch November 8, 2026 14:44
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