Skip to content

Commit 1cbba1f

Browse files
authored
[TOO-193] Adding Figma Optimized Toolkit Docs (#587)
1 parent 851ce4c commit 1cbba1f

33 files changed

+1763
-41
lines changed

app/en/home/auth-providers/figma/page.mdx

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { Tabs, Callout, Steps } from "nextra/components";
22

33
# Figma
44

5-
The Figma auth provider enables tools and agents to call [Figma APIs](https://www.figma.com/developers/api) on behalf of a user using OAuth 2.0 authentication.
5+
The Figma auth provider enables tools and agents to call [Figma APIs](https://developers.figma.com/docs/rest-api/) on behalf of a user using OAuth 2.0 authentication.
66

77
<Callout>
88
Want to quickly get started with Figma in your agent or AI app? The pre-built
9-
[Arcade Figma MCP Server](/mcp-servers/productivity/figma-api) is what you
9+
[Arcade Figma MCP Server](/mcp-servers/development/figma) is what you
1010
want!
1111
</Callout>
1212

@@ -16,10 +16,28 @@ This page describes how to use and configure Figma auth with Arcade.
1616

1717
This auth provider is used by:
1818

19-
- The [Arcade Figma MCP Server](/mcp-servers/productivity/figma-api), which provides pre-built tools for interacting with Figma
19+
- The [Arcade Figma MCP Server](/mcp-servers/development/figma), which provides pre-built tools for interacting with Figma
2020
- Your [app code](#using-figma-auth-in-app-code) that needs to call the Figma API
2121
- Or, your [custom tools](#using-figma-auth-in-custom-tools) that need to call the Figma API
2222

23+
### Required scopes for the Figma MCP Server
24+
25+
If you're using the [Arcade Figma MCP Server](/mcp-servers/development/figma), you'll need to configure these scopes based on which tools you plan to use:
26+
27+
- `file_content:read` - File structure, pages, nodes, and image exports
28+
- `library_content:read` - Published components, styles, and component sets from files
29+
- `team_library_content:read` - Team library content
30+
- `library_assets:read` - Individual component, style, and component set metadata
31+
- `file_comments:read` / `file_comments:write` - Reading and creating comments
32+
- `current_user:read` - User profile information
33+
- `projects:read` - Team projects and files (**requires private OAuth app**)
34+
35+
<Callout type="warning">
36+
The `projects:read` scope is **only available in private Figma OAuth apps**. If you need to access team projects and files, you must create a private OAuth app through your Figma organization.
37+
</Callout>
38+
39+
For detailed descriptions of all available Figma OAuth scopes, refer to the [Figma OAuth Scopes documentation](https://developers.figma.com/docs/rest-api/scopes/).
40+
2341
## Configuring Figma auth
2442

2543
<Callout type="info">
@@ -57,10 +75,17 @@ Navigate to the [Figma Developer Portal](https://www.figma.com/developers/) and
5775

5876
1. After creating your app, you'll receive a `client_id` and `client_secret`
5977
2. Set the redirect URI to the redirect URL generated by Arcade (see configuration section below)
60-
3. Configure the required scopes for your application:
61-
- `files:read` - Read access to files
78+
3. Configure the required scopes for your application based on the tools you need:
79+
- `file_content:read` - Read access to file content and structure
80+
- `library_content:read` - Read access to published library content
81+
- `team_library_content:read` - Read access to team library content
82+
- `library_assets:read` - Read access to individual library assets
83+
- `file_comments:read` - Read access to file comments
6284
- `file_comments:write` - Write access to file comments
63-
- Add other scopes as needed for your use case
85+
- `current_user:read` - Read access to user profile
86+
- `projects:read` - Read access to team projects (private apps only)
87+
88+
For a complete list of available scopes, refer to the [Figma OAuth Scopes documentation](https://developers.figma.com/docs/rest-api/scopes/)
6489

6590
</Steps>
6691

@@ -89,12 +114,14 @@ To access the Arcade Cloud dashboard, go to [api.arcade.dev/dashboard](https://a
89114

90115
#### Enter the provider details
91116

92-
- Choose a unique **ID** for your provider (e.g. "arcade-figma").
117+
- Choose a unique **ID** for your provider (e.g. "figma").
93118
- Optionally enter a **Description**.
94119
- Enter the **Client ID** and **Client Secret** from your Figma app.
95120
- Configure the OAuth 2.0 endpoints:
96121
- **Authorization URL**: `https://www.figma.com/oauth`
97-
- **Token URL**: `https://www.figma.com/api/oauth/token`
122+
- **Token URL**: `https://api.figma.com/v1/oauth/token`
123+
- **Scope Delimiter**: ` ` (space)
124+
- **Use PKCE**: Enabled (S256)
98125
- Note the **Redirect URL** generated by Arcade. This must be set as your Figma app's redirect URI.
99126

100127
#### Create the provider
@@ -139,33 +166,46 @@ Edit the `engine.yaml` file and add a new item to the `auth.providers` section:
139166
```yaml
140167
auth:
141168
providers:
142-
- id: arcade-figma
169+
- id: figma
143170
description: Figma OAuth 2.0 provider
144171
enabled: true
145172
type: oauth2
146173
client_id: ${env:FIGMA_CLIENT_ID}
147174
client_secret: ${env:FIGMA_CLIENT_SECRET}
148175
oauth2:
149-
scope_delimiter: ","
176+
scope_delimiter: " "
177+
use_pkce: true
178+
pkce_code_challenge_method: S256
150179
authorize_request:
151180
endpoint: "https://www.figma.com/oauth"
152181
params:
153182
response_type: code
154183
client_id: "{{client_id}}"
155184
redirect_uri: "{{redirect_uri}}"
156-
scope: "{{scopes}}"
185+
scope: "{{scopes}} {{existing_scopes}}"
157186
state: "{{state}}"
158187
token_request:
159-
endpoint: "https://www.figma.com/api/oauth/token"
188+
endpoint: "https://api.figma.com/v1/oauth/token"
160189
auth_method: client_secret_basic
161190
params:
162191
grant_type: authorization_code
163-
client_id: "{{client_id}}"
164-
client_secret: "{{client_secret}}"
165192
redirect_uri: "{{redirect_uri}}"
193+
request_content_type: application/x-www-form-urlencoded
194+
response_content_type: application/json
195+
refresh_request:
196+
endpoint: "https://api.figma.com/v1/oauth/token"
197+
auth_method: client_secret_basic
198+
params:
199+
grant_type: refresh_token
200+
refresh_token: "{{refresh_token}}"
201+
request_content_type: application/x-www-form-urlencoded
166202
response_content_type: application/json
167203
```
168204
205+
<Callout type="warning">
206+
**Note on `projects:read` scope:** If you need access to the `projects:read` scope for team projects and files navigation, you must create a **private Figma OAuth app**. This scope is not available in public OAuth apps. Learn more in the [Figma OAuth Scopes documentation](https://developers.figma.com/docs/rest-api/scopes/).
207+
</Callout>
208+
169209
</Steps>
170210

171211
</Tabs.Tab>
@@ -192,8 +232,8 @@ user_id = "{arcade_user_id}"
192232
# Start the authorization process
193233
auth_response = client.auth.start(
194234
user_id=user_id,
195-
provider="arcade-figma",
196-
scopes=["files:read", "file_comments:write"]
235+
provider="figma",
236+
scopes=["file_content:read", "file_comments:write"]
197237
)
198238

199239
if auth_response.status != "completed":
@@ -219,8 +259,8 @@ const client = new Arcade();
219259
const userId = "{arcade_user_id}";
220260

221261
// Start the authorization process
222-
const authResponse = await client.auth.start(userId, "arcade-figma", [
223-
"files:read",
262+
const authResponse = await client.auth.start(userId, "figma", [
263+
"file_content:read",
224264
"file_comments:write",
225265
]);
226266

@@ -242,26 +282,21 @@ const token = authResponse.context.token;
242282

243283
## Using Figma auth in custom tools
244284

245-
You can use the pre-built [Arcade Figma MCP Server](/mcp-servers/productivity/figma-api) to quickly build agents and AI apps that interact with Figma.
285+
You can use the pre-built [Arcade Figma MCP Server](/mcp-servers/development/figma) to quickly build agents and AI apps that interact with Figma.
246286

247287
If the pre-built tools in the Figma MCP Server don't meet your needs, you can author your own [custom tools](/home/build-tools/create-a-mcp-server) that interact with the Figma API.
248288

249-
Use the `OAuth2()` auth class to specify that a tool requires authorization with Figma. The `context.authorization.token` field will be automatically populated with the user's Figma token:
289+
Use the `Figma()` auth class to specify that a tool requires authorization with Figma. The `context.authorization.token` field will be automatically populated with the user's Figma token:
250290

251-
```python {8-12,22}
291+
```python {5,8}
252292
from typing import Annotated
253293

254294
import httpx
255295
from arcade_tdk import ToolContext, tool
256-
from arcade_tdk.auth import OAuth2
296+
from arcade_tdk.auth import Figma
257297

258298

259-
@tool(
260-
requires_auth=OAuth2(
261-
provider_id="arcade-figma",
262-
scopes=["files:read"]
263-
)
264-
)
299+
@tool(requires_auth=Figma(scopes=["file_content:read"]))
265300
async def get_figma_file(
266301
context: ToolContext,
267302
file_key: Annotated[str, "The Figma file key to retrieve."],
@@ -271,7 +306,7 @@ async def get_figma_file(
271306
"""
272307
url = f"https://api.figma.com/v1/files/{file_key}"
273308
headers = {
274-
"Authorization": context.authorization.token,
309+
"Authorization": f"Bearer {context.authorization.token}",
275310
}
276311

277312
async with httpx.AsyncClient() as client:
@@ -280,15 +315,4 @@ async def get_figma_file(
280315
return dict(response.json())
281316
```
282317

283-
## Available Scopes
284-
285-
Figma supports various OAuth scopes that determine the level of access your application has:
286-
287-
- `files:read` - Read access to files
288-
- `file_comments:write` - Write access to file comments
289-
- `file_dev_resources:write` - Write access to dev resources
290-
- `file_variables:read` - Read access to variables
291-
- `file_variables:write` - Write access to variables
292-
- `webhooks:write` - Write access to webhooks
293-
294-
For a complete list of available scopes and their descriptions, refer to the [Figma API documentation](https://www.figma.com/developers/api#authentication).
318+
For a complete list of available Figma OAuth scopes and their descriptions, refer to the [Figma OAuth Scopes documentation](https://developers.figma.com/docs/rest-api/scopes/).

app/en/mcp-servers/development/_meta.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export default {
22
e2b: "E2B",
3+
figma: "Figma",
34
github: "GitHub",
45
firecrawl: "Firecrawl",
56
"vercel-api": "Vercel API",

0 commit comments

Comments
 (0)