Skip to main content

I’m sending a get_code request to the Figma MCP server via Cursor AI.
Here is the request body I’m using:

{ "nodeId": "XXXX:XXXX", "clientLanguages": "kotlin", "clientFrameworks": "android,compose", "clientName": "cursor" }

However, the response I receive is in JSX (JavaScript XML) format with Tailwind CSS classes, not Kotlin.
I would expect either Kotlin code (Jetpack Compose) or at least a clean JSON representation of the selected frame.

Question:
How can I retrieve Kotlin code or a raw JSON object for the selected frame?

same issue for swiftui


the same issue


the same issue


Hi All, thanks for reaching out!

I passed this onto our MCP team, and they confirmed that if the component is code connected, it should return a snippet of the given language. 


My team also hit this same issue. We have it with common components that are used in both web and app designs. Sending requests to `get_design_context` (formerly called `get_code`) always returns the last published code, even when using `clientLanguages` and `clientFrameworks` to specify what we want returned.


Hi ​@Adam_Butterfield, thanks for chiming in here! 

Can you please confirm that you’ve applied Code Connect to your components to link your Figma libraries to the corresponding code components in your codebase?

If your components are code connected, we can send this over to our MCP team to investigate further. 


Hi ​@djv !
Yes I can confirm the connection is set up correctly. In the Figma UI we can see the code examples for web and apps. 

After experimenting a bit more, it appears that the MCP always returns the last published code snippet.

How I tested:

  • Called get_design_context, got React code returned no matter what we specify for `clientLanguages` and `clientFrameworks` (React was the last one published)
  • Unpublished React connection
  • Called get_design_context, got Compose code returned no matter what we specify for `clientLanguages` and `clientFrameworks` (it was the one published before React, and we also have iOS connected)
  • Published React connection
  • Called get_design_context, got React code returned again no matter what we specify for `clientLanguages` and `clientFrameworks