code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

MCP server and CodeConnect instance resolving.

Open gmwilliamson opened this issue 7 months ago • 1 comments

MCP Server not reading CodeConnect component code properly

Version: 1.3.4
OS: macOS Sequoia 15.5

Issue Description

I am having issues with my AI agent (Cursor) reading my CodeConnect component code properly using the MCP server.

Figma vs MCP Behavior

Figma: The component code in Figma shows:

import { Button } from "./Button"

<Button
  variant="primary"
  size="medium"
  startIcon="diamond"
/>

Cursor: For the startIcon specifically, the MCP server can only see:

startIcon={
  {
    /* Code Connect Logic Instance */
  }
}

Configuration

My Button.figma.tsx works properly and is configured as follows:

figma.connect(
  Button,
  'https://www.figma.com/design/9thqKAP0Bsw39xaCXJ9HD9/CodeConnect?node-id=63%3A1223',
  {
    props: {
      variant: figma.enum('variant', {
        primary: 'primary',
        secondary: 'secondary',
        tertiary: 'tertiary',
        growth: 'growth',
        'destroy-primary': 'destroy',
        'destroy-tertiary': 'destroy-tertiary',
        reversed: 'reversed',
        'ai-primary': 'ai-primary',
        'ai-secondary': 'ai-secondary',
      }),
      size: figma.enum('size', {
        small: 'small',
        medium: 'medium',
      }),
      disabled: figma.boolean('disabled?'),
      loading: figma.boolean('loading?'),
      startIcon: figma.instance<AllIcons>('startIcon'),
      endIcon: figma.boolean('endIcon?', {
        true: figma.instance<AllIcons>('endIcon'),
        false: undefined,
      }),
    },
    example: (props) => (
      <Button
        variant={props.variant}
        size={props.size}
        disabled={props.disabled}
        loading={props.loading}
        startIcon={props.startIcon}
        endIcon={props.endIcon}
      />
    ),
  },
);

Additional Context

The issue seems to be specifically with figma.instance<AllIcons>('startIcon') properties not being properly interpreted by the MCP server, while other prop types (enum, boolean) work correctly.

gmwilliamson avatar Jul 30 '25 19:07 gmwilliamson

Experiencing the same issue, can't find a way to get any data on the actual icon instance being used on the button

<Button size=\"icon\"> {/* Code Connect Logic Instance */} Button </Button>

upfordev avatar Sep 25 '25 15:09 upfordev