Bridge
SXL Studio Bridge: how to install and run the local program that links the plugin in Figma with AI tools and scripts, connect the plugin through Remote Connect, configure an MCP client, what an agent can do and how to fix typical problems.
SXL Studio Bridge is a small program that runs on your computer and links the running SXL Studio plugin with external tools: Cursor, Claude Desktop and other MCP clients, as well as scripts. Through it an AI agent can read and change tokens, variables, styles, compositions and data in the open Figma file. The same program serves Local Workspace and Local Storage.
| What Bridge gives you | Example |
|---|---|
| Working with tokens from an AI tool | "Add the token color/brand/600 and export the Core collection to Figma" |
| Building and checking designs | "Generate the Card composition and check for drift against the JSON" |
| Documentation in Figma | "Build a page with the palette of the Projects collection" |
| Audits | "Find layers with raw colours instead of variables on this page" |
| Data and Git | "Update the data set and push the changes to the branch" |
Requirements
| Component | Version |
|---|---|
| SXL Studio plugin | 2.9.2 |
Bridge (@sxl-studio/bridge) | 1.10.0 |
| Node.js | 20 or newer |
Several tabs, Figma Desktop control and destructive commands that turn on by themselves need Bridge 1.11 and plugin 2.9.6.
Bridge listens only on the local address 127.0.0.1: it cannot be reached from another computer.
Install and run
npm install -g @sxl-studio/bridge
sxl-bridge
Bridge takes one port, 37830 by default. The plugin connection, the MCP address http://127.0.0.1:37830/mcp and HTTP requests to http://127.0.0.1:37830/api/... all use it. If the port is busy, set another one with an environment variable:
BRIDGE_PORT=39999 sxl-bridge
The same port then has to be set in the plugin and in the MCP client settings.
To check that the program is running:
sxl-bridge health
Connecting the plugin: Remote Connect
Remote Connect turns on by itself. Each time the plugin starts in Design mode, it connects to Bridge on the saved port and waits for commands in the background. The plugin interface stays usable and nothing needs to be pressed. If Bridge is not running, the plugin keeps trying: the first retry comes after a second, later ones less often but at least once every 30 seconds. It connects as soon as Bridge appears. The link comes back by itself after a Bridge restart and after a hot reload of a development build. A Pro Plus licence is required.
To see the connection:
- In the plugin footer press the Remote Connect button. The plugin collapses into a compact bar with the connection state.
- Expand the bar with the arrows button to open the connection window. It has the Port field, the Token field for the protected mode and the Allow destructive commands toggle.
- The state Connected — Waiting for commands means the agent can send commands.

The compact Remote Connect bar in the plugin footer: the connection state, Disconnect and the expand button.

The Remote Connect window: port, token, session and client identifiers, the Allow destructive commands toggle.
While the connection window is open the plugin tabs are hidden. Disconnect turns Remote Connect off until the next plugin start and brings the usual interface back. The plugin remembers the port between sessions.
Destructive commands
Destructive commands: deleting layers, variables and collections, resetting synchronization identifiers and hard pull. They turn on by themselves as soon as Bridge 1.11 or newer answers the connection, except in protected files. An older Bridge cannot tell files apart, so with it destructive commands stay off until someone turns them on explicitly. Even when they are allowed, the agent has to confirm every destructive command explicitly.
In a protected file a session starts with destructive commands off. You can turn them on in two ways:
- with the Allow destructive commands toggle;
- with the agent command
set_session_policyand a file confirmation:confirmFilecarries this file's key or name.
A file counts as protected when any of its keys is on the list. It also counts as protected when the plugin cannot read its key or the list itself. The protect_file command protects a file: the current file, a file key or a file link. The same command with protect: false and confirmFile (the file's key or name) removes the protection. Protection added from another tab turns destructive commands off in this file before its next destructive command. The list is kept on this computer and applies in every file. Protect files that hold a published library. A choice made with the command or the toggle lasts until the session ends.
Token export can be previewed with preview_export_variables before export_variables. Sort arranges styles and style folders without changing their IDs; existing collections, modes and variables cannot be reordered through Figma’s public API. The old allowDestructiveReorder option is ignored by these MCP tools. Deleting orphaned objects remains a separate destructive action. See Export variables and styles.
Protected mode
If Bridge is started with the BRIDGE_AUTH_TOKEN variable, every connection must present the same token: enter it in the Token field of the Remote Connect window, in the Local Storage connection form and in the MCP client settings.
BRIDGE_AUTH_TOKEN=my-secret sxl-bridge
Several files and Figma control
Bridge 1.11 keeps the plugin connected in several Figma tabs at once. A command goes to one file, chosen in this order:
- An explicit target:
targetFileKeyon any MCP tool that works with the plugin, orfileKeyin thePOST /api/commandbody. The answer shows where the command went:bridgeTargetin MCP,targetin HTTP. - The current selection: the later of two actions, choosing a file with
select_plugin_session(by key, name or link) and the agent opening a file withfigma_open_file,figma_run_pluginorrestart_plugin. An explicit selection cancels files opened earlier that have not connected yet. - The first unprotected file that connected.
- The only connected unprotected file.
If no file can be chosen, the command is rejected with ambiguous-target. A protected file is never chosen by itself: opening it or running the plugin in it does not choose it either. Commands reach it only through an explicit target or after select_plugin_session. When several files are connected, pass targetFileKey on every write. list_plugin_sessions shows the connected files and the current target. While the selected file reconnects, for example when the plugin restarts, a command waits for it up to 20 seconds.
The agent drives Figma Desktop on macOS by itself:
| Tool | What it does |
|---|---|
figma_desktop_status | The app, open and active tabs, development builds of the plugin, connected files, macOS permissions |
figma_launch | Starts Figma Desktop |
figma_open_file | Opens a file by link or key and brings Figma to the front. If the file is already open, switches to its tab |
figma_run_plugin | Opens a file and runs SXL Studio in it through the Plugins → Development menu. Does nothing if the plugin is already connected there. Uses Run last plugin (⌘⌥P) only when asked: allowRunLast: true |
restart_plugin | Restarts the plugin. By default relaunch: closes it and runs it again through the menu, in this file only. hot-reload is a hot reload of the development build: the plugin restarts in every tab |
get_session_policy, set_session_policy, protect_file | Destructive commands of the session and protected files, see Destructive commands |
disconnect_plugin, close_plugin | Turns Remote Connect off until the next start or closes the plugin. Both wait up to 30 seconds for the current operation to end and answer busy otherwise. force skips the wait but does not cancel work already started |
Running the plugin through the menu needs one macOS permission for the process that runs Bridge: System Settings → Privacy & Security → Accessibility. For Bridge running as a service this is its node program; figma_desktop_status shows the path. Before pressing the menu, Bridge brings Figma to the front: Figma ignores a menu command while it is in the background. Opening files and hot reload work without the permission.
While the Figma window is off screen — in another Space, minimized or hidden — Figma pauses document work. Apply, Generate and export wait, although the plugin still answers other commands. figma_desktop_status shows whether the window is visible. /api/status reports FIGMA_WINDOW_HIDDEN when a plugin command has been running for more than 20 seconds with the window off screen. Before long work, bring the file on screen: figma_open_file does that.
Connecting an AI tool
Bridge speaks the MCP protocol. For Cursor add this to .cursor/mcp.json:
{
"mcpServers": {
"sxl-studio": {
"url": "http://127.0.0.1:37830/mcp"
}
}
}
Other MCP clients connect to the same address. Start Bridge before opening the chat with the agent, otherwise the tools do not appear in the list. The first things worth asking the agent: call get_operator_runbook, which describes where to start, and get_plugin_status, which shows whether Bridge sees the plugin.
What the agent can do
| Area | Example tools |
|---|---|
| Tokens and files | list_token_files, get_token_file_content, save_token_file, export_variables |
| Variables and styles | get_variables, create_variable, bind_variable, import_variable_spec, get_local_styles, import_style_spec |
| Compositions and screens | list_compositions, generate_composition, apply_composition, build_screen, build_mockup |
| Documentation in Figma | build_token_documentation, bind_variable_palette, build_component_doc, build_doc_flow |
| Audits | analyze_variable_usage, audit_variable_coverage, audit_style_coverage, audit_composition_drift |
| Database data | list_datasets, save_dataset, save_mapping, apply_mapping, generate_instances |
| Git | git_pull, git_push, git_hard_pull |
| Code | get_codegen, export_composition_json |
| Figma files and the plugin | list_plugin_sessions, select_plugin_session, get_session_policy, figma_open_file, figma_run_plugin, restart_plugin |
Bridge itself returns the full list: the list_tools tool or the address http://127.0.0.1:37830/api/tools.
Preview and audit tools change nothing. Write tools accept dryRun: true for a check without changes. Bridge shortens large responses to a summary; the full version can be requested separately.
Bridge and Figma modes
| Where the plugin is open | Reading | Canvas changes | Tokens, settings, Git |
|---|---|---|---|
| Design | Yes | Yes | Yes |
| Dev Mode, plugin window | Yes | No, the plugin returns an error | Yes |
| Dev Mode, Code panel | Code generation only | No | No |
Local Workspace
Bridge reads and writes token and data files in a folder on disk for the Local Workspace mode and stores large Local Storage files for Git connections. Remote Connect is not needed for that: a running Bridge and an active profile in the synchronization settings are enough. The port and token are set on the Local Workspace tab of the Synchronization settings window. More: Local Workspace and Local Storage.
If something does not work
| What happened | What to do |
|---|---|
The agent gets "Failed to send to plugin", PLUGIN_NOT_CONNECTED or no-plugin-connected | The plugin is not connected. Open the plugin in Design mode: Remote Connect turns on by itself. If Disconnect was pressed before, restart the plugin. On macOS the agent can run it with figma_run_plugin |
A command is rejected with ambiguous-target | The plugin is connected in several files and no target is chosen. Pass targetFileKey or choose the file with select_plugin_session. A protected file can be chosen only this way |
A command waits and fails with target-not-connected | The plugin did not connect in the chosen file within 20 seconds. Run the plugin in that file or choose another file |
figma_run_plugin answers automation-permission-required | Allow Accessibility for the Bridge process: System Settings → Privacy & Security → Accessibility. The process path is in the answer and in figma_desktop_status |
| The menu was pressed but the plugin did not start | Figma has to come to the front: Bridge waits for that before pressing and answers with an error otherwise. If no session appeared, check that a file is open in the active tab and try again |
Bridge prints EADDRINUSE on start | The port is busy. Start with BRIDGE_PORT=<another port> and set it in the plugin and the MCP client |
| Tools do not appear in the chat | Bridge was started after the chat was opened. Restart the chat or the client |
| Authorization error | The token in the plugin or the client does not match BRIDGE_AUTH_TOKEN |
After a Bridge restart Local Workspace reports reload-required | The restart cut the workspace link to Bridge. Run reload_local_workspace or press Reload in the plugin |
A command takes very long, /api/status reports FIGMA_WINDOW_HIDDEN | The Figma window is off screen and Figma paused document work. Bring Figma on screen or call figma_open_file: the command continues by itself |
| A delete command is rejected | The file is protected or destructive commands are off in this session. Turn them on with set_session_policy (with confirmFile for a protected file) or with the Allow destructive commands toggle, and repeat with confirmation |
| The plugin replies that the editor is read-only | The file is open in Dev Mode. Switch to Design for canvas changes |
| Local Workspace does not see the folder | Check that Bridge runs on the port from the profile settings and press Test on the Local Workspace tab |