Skip to main content
Glama
main.py46.9 kB
# generated by fastapi-codegen: # filename: openapi.yaml # timestamp: 2025-07-07T17:47:22+00:00 import argparse import json import os from typing import * from typing import Optional, Union from autogen.mcp.mcp_proxy import MCPProxy from autogen.mcp.mcp_proxy.security import ( APIKeyHeader, BaseSecurity, UnsuportedSecurityStub, ) from pydantic import confloat from models import ( Comment, Emoji, Format1, GroupBy, GroupBy2, GroupBy4, GroupBy6, GroupBy8, GroupBy10, Order, V1ActivityLogsGetResponse, V1ActivityLogsGetResponse1, V1ActivityLogsGetResponse2, V1ActivityLogsGetResponse3, V1ActivityLogsGetResponse4, V1ActivityLogsGetResponse5, V1AnalyticsLibrariesFileKeyComponentActionsGetResponse, V1AnalyticsLibrariesFileKeyComponentActionsGetResponse1, V1AnalyticsLibrariesFileKeyComponentActionsGetResponse2, V1AnalyticsLibrariesFileKeyComponentActionsGetResponse3, V1AnalyticsLibrariesFileKeyComponentActionsGetResponse4, V1AnalyticsLibrariesFileKeyComponentActionsGetResponse5, V1AnalyticsLibrariesFileKeyComponentUsagesGetResponse, V1AnalyticsLibrariesFileKeyComponentUsagesGetResponse1, V1AnalyticsLibrariesFileKeyComponentUsagesGetResponse2, V1AnalyticsLibrariesFileKeyComponentUsagesGetResponse3, V1AnalyticsLibrariesFileKeyComponentUsagesGetResponse4, V1AnalyticsLibrariesFileKeyComponentUsagesGetResponse5, V1AnalyticsLibrariesFileKeyStyleActionsGetResponse, V1AnalyticsLibrariesFileKeyStyleActionsGetResponse1, V1AnalyticsLibrariesFileKeyStyleActionsGetResponse2, V1AnalyticsLibrariesFileKeyStyleActionsGetResponse3, V1AnalyticsLibrariesFileKeyStyleActionsGetResponse4, V1AnalyticsLibrariesFileKeyStyleActionsGetResponse5, V1AnalyticsLibrariesFileKeyStyleUsagesGetResponse, V1AnalyticsLibrariesFileKeyStyleUsagesGetResponse1, V1AnalyticsLibrariesFileKeyStyleUsagesGetResponse2, V1AnalyticsLibrariesFileKeyStyleUsagesGetResponse3, V1AnalyticsLibrariesFileKeyStyleUsagesGetResponse4, V1AnalyticsLibrariesFileKeyStyleUsagesGetResponse5, V1AnalyticsLibrariesFileKeyVariableActionsGetResponse, V1AnalyticsLibrariesFileKeyVariableActionsGetResponse1, V1AnalyticsLibrariesFileKeyVariableActionsGetResponse2, V1AnalyticsLibrariesFileKeyVariableActionsGetResponse3, V1AnalyticsLibrariesFileKeyVariableActionsGetResponse4, V1AnalyticsLibrariesFileKeyVariableActionsGetResponse5, V1AnalyticsLibrariesFileKeyVariableUsagesGetResponse, V1AnalyticsLibrariesFileKeyVariableUsagesGetResponse1, V1AnalyticsLibrariesFileKeyVariableUsagesGetResponse2, V1AnalyticsLibrariesFileKeyVariableUsagesGetResponse3, V1AnalyticsLibrariesFileKeyVariableUsagesGetResponse4, V1AnalyticsLibrariesFileKeyVariableUsagesGetResponse5, V1ComponentSetsKeyGetResponse, V1ComponentSetsKeyGetResponse1, V1ComponentSetsKeyGetResponse2, V1ComponentSetsKeyGetResponse3, V1ComponentSetsKeyGetResponse4, V1ComponentSetsKeyGetResponse5, V1ComponentsKeyGetResponse, V1ComponentsKeyGetResponse1, V1ComponentsKeyGetResponse2, V1ComponentsKeyGetResponse3, V1ComponentsKeyGetResponse4, V1ComponentsKeyGetResponse5, V1DevResourcesPostRequest, V1DevResourcesPostResponse, V1DevResourcesPostResponse1, V1DevResourcesPostResponse2, V1DevResourcesPostResponse3, V1DevResourcesPostResponse4, V1DevResourcesPostResponse5, V1DevResourcesPutRequest, V1DevResourcesPutResponse, V1DevResourcesPutResponse1, V1DevResourcesPutResponse2, V1DevResourcesPutResponse3, V1DevResourcesPutResponse4, V1DevResourcesPutResponse5, V1FilesFileKeyCommentsCommentIdDeleteResponse, V1FilesFileKeyCommentsCommentIdDeleteResponse1, V1FilesFileKeyCommentsCommentIdDeleteResponse2, V1FilesFileKeyCommentsCommentIdDeleteResponse3, V1FilesFileKeyCommentsCommentIdDeleteResponse4, V1FilesFileKeyCommentsCommentIdReactionsDeleteResponse, V1FilesFileKeyCommentsCommentIdReactionsDeleteResponse1, V1FilesFileKeyCommentsCommentIdReactionsDeleteResponse2, V1FilesFileKeyCommentsCommentIdReactionsDeleteResponse3, V1FilesFileKeyCommentsCommentIdReactionsDeleteResponse4, V1FilesFileKeyCommentsCommentIdReactionsGetResponse, V1FilesFileKeyCommentsCommentIdReactionsGetResponse1, V1FilesFileKeyCommentsCommentIdReactionsGetResponse2, V1FilesFileKeyCommentsCommentIdReactionsGetResponse3, V1FilesFileKeyCommentsCommentIdReactionsGetResponse4, V1FilesFileKeyCommentsCommentIdReactionsPostRequest, V1FilesFileKeyCommentsCommentIdReactionsPostResponse, V1FilesFileKeyCommentsCommentIdReactionsPostResponse1, V1FilesFileKeyCommentsCommentIdReactionsPostResponse2, V1FilesFileKeyCommentsCommentIdReactionsPostResponse3, V1FilesFileKeyCommentsCommentIdReactionsPostResponse4, V1FilesFileKeyCommentsCommentIdReactionsPostResponse5, V1FilesFileKeyCommentsGetResponse, V1FilesFileKeyCommentsGetResponse1, V1FilesFileKeyCommentsGetResponse2, V1FilesFileKeyCommentsGetResponse3, V1FilesFileKeyCommentsGetResponse4, V1FilesFileKeyCommentsPostRequest, V1FilesFileKeyCommentsPostResponse, V1FilesFileKeyCommentsPostResponse1, V1FilesFileKeyCommentsPostResponse2, V1FilesFileKeyCommentsPostResponse3, V1FilesFileKeyCommentsPostResponse4, V1FilesFileKeyComponentSetsGetResponse, V1FilesFileKeyComponentSetsGetResponse1, V1FilesFileKeyComponentSetsGetResponse2, V1FilesFileKeyComponentSetsGetResponse3, V1FilesFileKeyComponentSetsGetResponse4, V1FilesFileKeyComponentSetsGetResponse5, V1FilesFileKeyComponentsGetResponse, V1FilesFileKeyComponentsGetResponse1, V1FilesFileKeyComponentsGetResponse2, V1FilesFileKeyComponentsGetResponse3, V1FilesFileKeyComponentsGetResponse4, V1FilesFileKeyComponentsGetResponse5, V1FilesFileKeyDevResourcesDevResourceIdDeleteResponse, V1FilesFileKeyDevResourcesDevResourceIdDeleteResponse1, V1FilesFileKeyDevResourcesDevResourceIdDeleteResponse2, V1FilesFileKeyDevResourcesDevResourceIdDeleteResponse3, V1FilesFileKeyDevResourcesDevResourceIdDeleteResponse4, V1FilesFileKeyDevResourcesGetResponse, V1FilesFileKeyDevResourcesGetResponse1, V1FilesFileKeyDevResourcesGetResponse2, V1FilesFileKeyDevResourcesGetResponse3, V1FilesFileKeyDevResourcesGetResponse4, V1FilesFileKeyDevResourcesGetResponse5, V1FilesFileKeyDevResourcesGetResponse6, V1FilesFileKeyGetResponse, V1FilesFileKeyGetResponse1, V1FilesFileKeyGetResponse2, V1FilesFileKeyGetResponse3, V1FilesFileKeyGetResponse4, V1FilesFileKeyGetResponse5, V1FilesFileKeyImagesGetResponse, V1FilesFileKeyImagesGetResponse1, V1FilesFileKeyImagesGetResponse2, V1FilesFileKeyImagesGetResponse3, V1FilesFileKeyImagesGetResponse4, V1FilesFileKeyImagesGetResponse5, V1FilesFileKeyMetaGetResponse, V1FilesFileKeyMetaGetResponse1, V1FilesFileKeyMetaGetResponse2, V1FilesFileKeyMetaGetResponse3, V1FilesFileKeyMetaGetResponse4, V1FilesFileKeyMetaGetResponse5, V1FilesFileKeyNodesGetResponse, V1FilesFileKeyNodesGetResponse1, V1FilesFileKeyNodesGetResponse2, V1FilesFileKeyNodesGetResponse3, V1FilesFileKeyNodesGetResponse4, V1FilesFileKeyNodesGetResponse5, V1FilesFileKeyStylesGetResponse, V1FilesFileKeyStylesGetResponse1, V1FilesFileKeyStylesGetResponse2, V1FilesFileKeyStylesGetResponse3, V1FilesFileKeyStylesGetResponse4, V1FilesFileKeyStylesGetResponse5, V1FilesFileKeyVariablesLocalGetResponse, V1FilesFileKeyVariablesLocalGetResponse1, V1FilesFileKeyVariablesLocalGetResponse2, V1FilesFileKeyVariablesLocalGetResponse3, V1FilesFileKeyVariablesLocalGetResponse4, V1FilesFileKeyVariablesLocalGetResponse5, V1FilesFileKeyVariablesPostRequest, V1FilesFileKeyVariablesPostResponse, V1FilesFileKeyVariablesPostResponse1, V1FilesFileKeyVariablesPostResponse2, V1FilesFileKeyVariablesPostResponse3, V1FilesFileKeyVariablesPostResponse4, V1FilesFileKeyVariablesPostResponse5, V1FilesFileKeyVariablesPostResponse6, V1FilesFileKeyVariablesPublishedGetResponse, V1FilesFileKeyVariablesPublishedGetResponse1, V1FilesFileKeyVariablesPublishedGetResponse2, V1FilesFileKeyVariablesPublishedGetResponse3, V1FilesFileKeyVariablesPublishedGetResponse4, V1FilesFileKeyVariablesPublishedGetResponse5, V1FilesFileKeyVersionsGetResponse, V1FilesFileKeyVersionsGetResponse1, V1FilesFileKeyVersionsGetResponse2, V1FilesFileKeyVersionsGetResponse3, V1FilesFileKeyVersionsGetResponse4, V1ImagesFileKeyGetResponse, V1ImagesFileKeyGetResponse1, V1ImagesFileKeyGetResponse2, V1ImagesFileKeyGetResponse3, V1ImagesFileKeyGetResponse4, V1ImagesFileKeyGetResponse5, V1MeGetResponse, V1MeGetResponse1, V1MeGetResponse2, V1MeGetResponse3, V1PaymentsGetResponse, V1PaymentsGetResponse1, V1PaymentsGetResponse2, V1PaymentsGetResponse3, V1ProjectsProjectIdFilesGetResponse, V1ProjectsProjectIdFilesGetResponse1, V1ProjectsProjectIdFilesGetResponse2, V1ProjectsProjectIdFilesGetResponse3, V1ProjectsProjectIdFilesGetResponse4, V1StylesKeyGetResponse, V1StylesKeyGetResponse1, V1StylesKeyGetResponse2, V1StylesKeyGetResponse3, V1StylesKeyGetResponse4, V1StylesKeyGetResponse5, V1TeamsTeamIdComponentSetsGetResponse, V1TeamsTeamIdComponentSetsGetResponse1, V1TeamsTeamIdComponentSetsGetResponse2, V1TeamsTeamIdComponentSetsGetResponse3, V1TeamsTeamIdComponentSetsGetResponse4, V1TeamsTeamIdComponentSetsGetResponse5, V1TeamsTeamIdComponentsGetResponse, V1TeamsTeamIdComponentsGetResponse1, V1TeamsTeamIdComponentsGetResponse2, V1TeamsTeamIdComponentsGetResponse3, V1TeamsTeamIdComponentsGetResponse4, V1TeamsTeamIdComponentsGetResponse5, V1TeamsTeamIdProjectsGetResponse, V1TeamsTeamIdProjectsGetResponse1, V1TeamsTeamIdProjectsGetResponse2, V1TeamsTeamIdProjectsGetResponse3, V1TeamsTeamIdProjectsGetResponse4, V1TeamsTeamIdStylesGetResponse, V1TeamsTeamIdStylesGetResponse1, V1TeamsTeamIdStylesGetResponse2, V1TeamsTeamIdStylesGetResponse3, V1TeamsTeamIdStylesGetResponse4, V1TeamsTeamIdStylesGetResponse5, V2TeamsTeamIdWebhooksGetResponse, V2TeamsTeamIdWebhooksGetResponse1, V2TeamsTeamIdWebhooksGetResponse2, V2TeamsTeamIdWebhooksGetResponse3, V2TeamsTeamIdWebhooksGetResponse4, V2WebhooksGetResponse, V2WebhooksGetResponse1, V2WebhooksGetResponse2, V2WebhooksPostRequest, V2WebhooksPostResponse, V2WebhooksPostResponse1, V2WebhooksPostResponse2, V2WebhooksPostResponse3, V2WebhooksWebhookIdDeleteResponse, V2WebhooksWebhookIdDeleteResponse1, V2WebhooksWebhookIdDeleteResponse2, V2WebhooksWebhookIdDeleteResponse3, V2WebhooksWebhookIdDeleteResponse4, V2WebhooksWebhookIdGetResponse, V2WebhooksWebhookIdGetResponse1, V2WebhooksWebhookIdGetResponse2, V2WebhooksWebhookIdGetResponse3, V2WebhooksWebhookIdGetResponse4, V2WebhooksWebhookIdPutRequest, V2WebhooksWebhookIdPutResponse, V2WebhooksWebhookIdPutResponse1, V2WebhooksWebhookIdPutResponse2, V2WebhooksWebhookIdPutResponse3, V2WebhooksWebhookIdPutResponse4, V2WebhooksWebhookIdRequestsGetResponse, V2WebhooksWebhookIdRequestsGetResponse1, V2WebhooksWebhookIdRequestsGetResponse2, V2WebhooksWebhookIdRequestsGetResponse3, V2WebhooksWebhookIdRequestsGetResponse4, V2WebhooksWebhookIdRequestsGetResponse5, WebhookDevModeStatusUpdatePayload, WebhookFileCommentPayload, WebhookFileDeletePayload, WebhookFileUpdatePayload, WebhookFileVersionUpdatePayload, WebhookLibraryPublishPayload, WebhookPingPayload, WebhookV2, ) app = MCPProxy( contact={'email': 'support@figma.com'}, description='This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api).\n\nNote: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).', termsOfService='https://www.figma.com/developer-terms/', title='Figma API', version='0.33.0', servers=[{'url': 'https://api.figma.com'}], ) @app.get( '/v1/activity_logs', description=""" Returns a list of activity log events """, tags=['activity_logs', 'library_analytics'], security=[ UnsuportedSecurityStub(name="None"), ], ) def get_activity_logs( events: Optional[str] = None, start_time: Optional[float] = None, end_time: Optional[float] = None, limit: Optional[float] = None, order: Optional[Order] = 'asc', ): """ Get activity logs """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/analytics/libraries/{file_key}/component/actions', description=""" Returns a list of library analytics component actions data broken down by the requested dimension. """, tags=['activity_logs', 'library_analytics'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_library_analytics_component_actions( file_key: str, cursor: Optional[str] = None, group_by: GroupBy = ..., start_date: Optional[str] = None, end_date: Optional[str] = None, ): """ Get library analytics component action data. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/analytics/libraries/{file_key}/component/usages', description=""" Returns a list of library analytics component usage data broken down by the requested dimension. """, tags=['library_analytics', 'activity_logs'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_library_analytics_component_usages( file_key: str, cursor: Optional[str] = None, group_by: GroupBy2 = ... ): """ Get library analytics component usage data. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/analytics/libraries/{file_key}/style/actions', description=""" Returns a list of library analytics style actions data broken down by the requested dimension. """, tags=['library_analytics', 'activity_logs'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_library_analytics_style_actions( file_key: str, cursor: Optional[str] = None, group_by: GroupBy4 = ..., start_date: Optional[str] = None, end_date: Optional[str] = None, ): """ Get library analytics style action data. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/analytics/libraries/{file_key}/style/usages', description=""" Returns a list of library analytics style usage data broken down by the requested dimension. """, tags=['activity_logs', 'library_analytics'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_library_analytics_style_usages( file_key: str, cursor: Optional[str] = None, group_by: GroupBy6 = ... ): """ Get library analytics style usage data. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/analytics/libraries/{file_key}/variable/actions', description=""" Returns a list of library analytics variable actions data broken down by the requested dimension. """, tags=['activity_logs', 'library_analytics', 'variable_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_library_analytics_variable_actions( file_key: str, cursor: Optional[str] = None, group_by: GroupBy8 = ..., start_date: Optional[str] = None, end_date: Optional[str] = None, ): """ Get library analytics variable action data. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/analytics/libraries/{file_key}/variable/usages', description=""" Returns a list of library analytics variable usage data broken down by the requested dimension. """, tags=['library_analytics', 'activity_logs', 'variable_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_library_analytics_variable_usages( file_key: str, cursor: Optional[str] = None, group_by: GroupBy10 = ... ): """ Get library analytics variable usage data. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/component_sets/{key}', description=""" Get metadata on a published component set by key. """, tags=['component_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_component_set(key: str): """ Get component set """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/components/{key}', description=""" Get metadata on a component by key. """, tags=['component_management', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_component(key: str): """ Get component """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/dev_resources', description=""" Bulk create dev resources across multiple files. Dev resources that are successfully created will show up in the links_created array in the response. If there are any dev resources that cannot be created, you may still get a 200 response. These resources will show up in the errors array. Some reasons a dev resource cannot be created include: - Resource points to a `file_key` that cannot be found. - The node already has the maximum of 10 dev resources. - Another dev resource for the node has the same url. """, tags=['dev_resources_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def post_dev_resources(body: V1DevResourcesPostRequest): """ Create dev resources """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/v1/dev_resources', description=""" Bulk update dev resources across multiple files. Ids for dev resources that are successfully updated will show up in the `links_updated` array in the response. If there are any dev resources that cannot be updated, you may still get a 200 response. These resources will show up in the `errors` array. """, tags=['dev_resources_management', 'component_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def put_dev_resources(body: V1DevResourcesPutRequest): """ Update dev resources """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}', description=""" Returns the document identified by `file_key` as a JSON object. The file key can be parsed from any Figma file url: `https://www.figma.com/file/{file_key}/{title}`. The `document` property contains a node of type `DOCUMENT`. The `components` property contains a mapping from node IDs to component metadata. This is to help you determine which components each instance comes from. """, tags=['file_operations', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file( file_key: str, version: Optional[str] = None, ids: Optional[str] = None, depth: Optional[float] = None, geometry: Optional[str] = None, plugin_data: Optional[str] = None, branch_data: Optional[bool] = False, ): """ Get file JSON """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/comments', description=""" Gets a list of comments left on the file. """, tags=['file_operations', 'comment_handling'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_comments(file_key: str, as_md: Optional[bool] = None): """ Get comments in a file """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/files/{file_key}/comments', description=""" Posts a new comment on the file. """, tags=['file_operations', 'comment_handling'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def post_comment(file_key: str, body: V1FilesFileKeyCommentsPostRequest = ...): """ Add a comment to a file """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/v1/files/{file_key}/comments/{comment_id}', description=""" Deletes a specific comment. Only the person who made the comment is allowed to delete it. """, tags=['comment_handling', 'dev_resources_management', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def delete_comment(file_key: str, comment_id: str = ...): """ Delete a comment """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/v1/files/{file_key}/comments/{comment_id}/reactions', description=""" Deletes a specific comment reaction. Only the person who made the reaction is allowed to delete it. """, tags=['comment_handling', 'dev_resources_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def delete_comment_reaction(file_key: str, comment_id: str = ..., emoji: Emoji = ...): """ Delete a reaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/comments/{comment_id}/reactions', description=""" Gets a paginated list of reactions left on the comment. """, tags=['comment_handling', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_comment_reactions( file_key: str, comment_id: str = ..., cursor: Optional[str] = None ): """ Get reactions for a comment """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/files/{file_key}/comments/{comment_id}/reactions', description=""" Posts a new comment reaction on a file comment. """, tags=['comment_handling', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def post_comment_reaction( file_key: str, comment_id: str = ..., body: V1FilesFileKeyCommentsCommentIdReactionsPostRequest = ..., ): """ Add a reaction to a comment """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/component_sets', description=""" Get a list of published component sets within a file library. """, tags=['component_management', 'file_operations', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file_component_sets(file_key: str): """ Get file component sets """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/components', description=""" Get a list of published components within a file library. """, tags=['file_operations', 'project_file_management', 'component_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file_components(file_key: str): """ Get file components """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/dev_resources', description=""" Get dev resources in a file """, tags=['dev_resources_management', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_dev_resources(file_key: str, node_ids: Optional[str] = None): """ Get dev resources """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/v1/files/{file_key}/dev_resources/{dev_resource_id}', description=""" Delete a dev resource from a file """, tags=['dev_resources_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def delete_dev_resource(file_key: str, dev_resource_id: str = ...): """ Delete dev resource """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/images', description=""" Returns download links for all images present in image fills in a document. Image fills are how Figma represents any user supplied images. When you drag an image into Figma, we create a rectangle with a single fill that represents the image, and the user is able to transform the rectangle (and properties on the fill) as they wish. This endpoint returns a mapping from image references to the URLs at which the images may be download. Image URLs will expire after no more than 14 days. Image references are located in the output of the GET files endpoint under the `imageRef` attribute in a `Paint`. """, tags=['file_operations', 'image_rendering'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_image_fills(file_key: str): """ Get image fills """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/meta', description=""" Get file metadata """, tags=['file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file_meta(file_key: str): """ Get file metadata """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/nodes', description=""" Returns the nodes referenced to by `ids` as a JSON object. The nodes are retrieved from the Figma file referenced to by `file_key`. The node ID and file key can be parsed from any Figma node url: `https://www.figma.com/file/{file_key}/{title}?node-id={id}` The `name`, `lastModified`, `thumbnailUrl`, `editorType`, and `version` attributes are all metadata of the specified file. The `linkAccess` field describes the file link share permission level. There are 5 types of permissions a shared link can have: `"inherit"`, `"view"`, `"edit"`, `"org_view"`, and `"org_edit"`. `"inherit"` is the default permission applied to files created in a team project, and will inherit the project's permissions. `"org_view"` and `"org_edit"` restrict the link to org users. The `document` attribute contains a Node of type `DOCUMENT`. The `components` key contains a mapping from node IDs to component metadata. This is to help you determine which components each instance comes from. By default, no vector data is returned. To return vector data, pass the geometry=paths parameter to the endpoint. Each node can also inherit properties from applicable styles. The styles key contains a mapping from style IDs to style metadata. Important: the nodes map may contain values that are `null`. This may be due to the node id not existing within the specified file. """, tags=['file_operations', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file_nodes( file_key: str, ids: str = ..., version: Optional[str] = None, depth: Optional[float] = None, geometry: Optional[str] = None, plugin_data: Optional[str] = None, ): """ Get file JSON for specific nodes """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/styles', description=""" Get a list of published styles within a file library. """, tags=['library_analytics', 'file_operations', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file_styles(file_key: str): """ Get file styles """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/files/{file_key}/variables', description=""" **This API is available to full members of Enterprise orgs with Editor seats.** The `POST /v1/files/:file_key/variables` endpoint lets you bulk create, update, and delete variables and variable collections. The request body supports the following 4 top-level arrays. Changes from these arrays will be applied in the below order, and within each array, by array order. - **variableCollections**: For creating, updating, and deleting variable collections - **variableModes**: For creating, updating, and deleting modes within variable collections - Each collection can have a maximum of 40 modes - Mode names cannot be longer than 40 characters - **variables**: For creating, updating, and deleting variables - Each collection can have a maximum of 5000 variables - Variable names must be unique within a collection and cannot contain certain special characters such as `.{}` - **variableModeValues**: For setting a variable value under a specific mode. - When setting aliases, a variable cannot be aliased to itself or form an alias cycle Temporary ids can be used to reference an object later in the same POST request body. They can be used at create time in the `id` property of variable collections, modes, variables, and in the `initialModeId` property of variable collections. They are scoped to a single request body, and must be unique within the body. The mapping of temporary ids to real ids is returned in the response. This endpoint has the following key behaviors: - The request body must be 4MB or less. - Must include an `action` property for collections, modes, and variables to tell the API whether to create, update, or delete the object. - When creating a collection, mode, or variable, you can include a temporary `id` that can be referenced in dependent objects in the same request. For example, you can create a new collection with the id `"my_new_collection"`. You can then set `variableCollectionId` to `"my_new_collection"` in new modes or variables. Temporary ids must be unique in the request body. - New collections always come with one mode. You can reference this mode by setting `initialModeId` to a temporary id in the request body. This is useful if you want to set values for variables in the mode in the `variableModeValues` array. - The `tempIdToRealId` array returns a mapping of the temporary ids in the request, to the real ids of the newly created objects. - When adding new modes or variables, default variable values will be applied, consistent with what happens in the UI. - Everything to be created, updated, and deleted in the request body is treated as one atomic operation. If there is any validation failure, you will get a 400 status code response, and no changes will be persisted. - You will not be able to update remote variables or variable collections. You can only update variables in the file where they were originally created. """, tags=['variable_management', 'dev_resources_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def post_variables(file_key: str, body: V1FilesFileKeyVariablesPostRequest = ...): """ Create/modify/delete variables """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/variables/local', description=""" **This API is available to full members of Enterprise orgs.** The `GET /v1/files/:file_key/variables/local` endpoint lets you enumerate local variables created in the file and remote variables used in the file. Remote variables are referenced by their `subscribed_id`. As a part of the Variables related API additions, the `GET /v1/files/:file_key` endpoint now returns a `boundVariables` property, containing the `variableId` of the bound variable. The `GET /v1/files/:file_key/variables/local` endpoint can be used to get the full variable or variable collection object. Note that `GET /v1/files/:file_key/variables/published` does not return modes. Instead, you will need to use the `GET /v1/files/:file_key/variables/local` endpoint, in the same file, to examine the mode values. """, tags=['variable_management', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_local_variables(file_key: str): """ Get local variables """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/variables/published', description=""" **This API is available to full members of Enterprise orgs.** The `GET /v1/files/:file_key/variables/published` endpoint returns the variables that are published from the given file. The response for this endpoint contains some key differences compared to the `GET /v1/files/:file_key/variables/local` endpoint: - Each variable and variable collection contains a `subscribed_id`. - Modes are omitted for published variable collections Published variables have two ids: an id that is assigned in the file where it is created (`id`), and an id that is used by subscribing files (`subscribed_id`). The `id` and `key` are stable over the lifetime of the variable. The `subscribed_id` changes every time the variable is modified and published. The same is true for variable collections. The `updatedAt` fields are ISO 8601 timestamps that indicate the last time that a change to a variable was published. For variable collections, this timestamp will change any time a variable in the collection is changed. """, tags=['library_analytics', 'variable_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_published_variables(file_key: str): """ Get published variables """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/files/{file_key}/versions', description=""" This endpoint fetches the version history of a file, allowing you to see the progression of a file over time. You can then use this information to render a specific version of the file, via another endpoint. """, tags=['file_operations', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_file_versions( file_key: str, page_size: Optional[confloat(le=50.0)] = None, before: Optional[float] = None, after: Optional[float] = None, ): """ Get versions of a file """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/images/{file_key}', description=""" Renders images from a file. If no error occurs, `"images"` will be populated with a map from node IDs to URLs of the rendered images, and `"status"` will be omitted. The image assets will expire after 30 days. Images up to 32 megapixels can be exported. Any images that are larger will be scaled down. Important: the image map may contain values that are `null`. This indicates that rendering of that specific node has failed. This may be due to the node id not existing, or other reasons such has the node having no renderable components. It is guaranteed that any node that was requested for rendering will be represented in this map whether or not the render succeeded. To render multiple images from the same file, use the `ids` query parameter to specify multiple node ids. ``` GET /v1/images/:key?ids=1:2,1:3,1:4 ``` """, tags=['image_rendering', 'file_operations'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_images( file_key: str, ids: str = ..., version: Optional[str] = None, scale: Optional[confloat(ge=0.01, le=4.0)] = None, format: Optional[Format1] = 'png', svg_outline_text: Optional[bool] = True, svg_include_id: Optional[bool] = False, svg_include_node_id: Optional[bool] = False, svg_simplify_stroke: Optional[bool] = True, contents_only: Optional[bool] = True, use_absolute_bounds: Optional[bool] = False, ): """ Render images of file nodes """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/me', description=""" Returns the user information for the currently authenticated user. """, tags=['user_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_me(): """ Get current user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/payments', description=""" There are two methods to query for a user's payment information on a plugin, widget, or Community file. The first method, using plugin payment tokens, is typically used when making queries from a plugin's or widget's code. The second method, providing a user ID and resource ID, is typically used when making queries from anywhere else. Note that you can only query for resources that you own. In most cases, this means that you can only query resources that you originally created. """, tags=['payment_management'], security=[ APIKeyHeader(name="X-Figma-Token"), ], ) def get_payments( plugin_payment_token: Optional[str] = None, user_id: Optional[str] = None, community_file_id: Optional[str] = None, plugin_id: Optional[str] = None, widget_id: Optional[str] = None, ): """ Get payments """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/projects/{project_id}/files', description=""" Get a list of all the Files within the specified project. """, tags=['file_operations', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_project_files(project_id: str, branch_data: Optional[bool] = False): """ Get files in a project """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/styles/{key}', description=""" Get metadata on a style by key. """, tags=['library_analytics', 'component_management', 'team_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_style(key: str): """ Get style """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/teams/{team_id}/component_sets', description=""" Get a paginated list of published component sets within a team library. """, tags=['team_management', 'component_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_team_component_sets( team_id: str, page_size: Optional[float] = 30, after: Optional[float] = None, before: Optional[float] = None, ): """ Get team component sets """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/teams/{team_id}/components', description=""" Get a paginated list of published components within a team library. """, tags=['team_management', 'component_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_team_components( team_id: str, page_size: Optional[float] = 30, after: Optional[float] = None, before: Optional[float] = None, ): """ Get team components """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/teams/{team_id}/projects', description=""" You can use this endpoint to get a list of all the Projects within the specified team. This will only return projects visible to the authenticated user or owner of the developer token. Note: it is not currently possible to programmatically obtain the team id of a user just from a token. To obtain a team id, navigate to a team page of a team you are a part of. The team id will be present in the URL after the word team and before your team name. """, tags=['team_management', 'project_file_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_team_projects(team_id: str): """ Get projects in a team """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/teams/{team_id}/styles', description=""" Get a paginated list of published styles within a team library. """, tags=['library_analytics', 'team_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_team_styles( team_id: str, page_size: Optional[float] = 30, after: Optional[float] = None, before: Optional[float] = None, ): """ Get team styles """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v2/teams/{team_id}/webhooks', description=""" Returns all webhooks registered under the specified team. """, tags=['webhook_management', 'team_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_team_webhooks(team_id: str): """ [Deprecated] Get team webhooks """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v2/webhooks', description=""" Returns a list of webhooks corresponding to the context or plan provided, if they exist. For plan, the webhooks for all contexts that you have access to will be returned, and theresponse is paginated """, tags=['webhook_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_webhooks( context: Optional[str] = None, context_id: Optional[str] = None, plan_api_id: Optional[str] = None, cursor: Optional[str] = None, ): """ Get webhooks by context or plan """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v2/webhooks', description=""" Create a new webhook which will call the specified endpoint when the event triggers. By default, this webhook will automatically send a PING event to the endpoint when it is created. If this behavior is not desired, you can create the webhook and set the status to PAUSED and reactivate it later. """, tags=['webhook_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def post_webhook(body: V2WebhooksPostRequest): """ Create a webhook """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/v2/webhooks/{webhook_id}', description=""" Deletes the specified webhook. This operation cannot be reversed. """, tags=['webhook_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def delete_webhook(webhook_id: str): """ Delete a webhook """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v2/webhooks/{webhook_id}', description=""" Get a webhook by ID. """, tags=['webhook_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_webhook(webhook_id: str): """ Get a webhook """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/v2/webhooks/{webhook_id}', description=""" Update a webhook by ID. """, tags=['webhook_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def put_webhook(webhook_id: str, body: V2WebhooksWebhookIdPutRequest = ...): """ Update a webhook """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v2/webhooks/{webhook_id}/requests', description=""" Returns all webhook requests sent within the last week. Useful for debugging. """, tags=['webhook_management'], security=[ APIKeyHeader(name="X-Figma-Token"), UnsuportedSecurityStub(name="None"), ], ) def get_webhook_requests(webhook_id: str): """ Get webhook requests """ raise RuntimeError("Should be patched by MCPProxy and never executed") if __name__ == "__main__": parser = argparse.ArgumentParser(description="MCP Server") parser.add_argument( "transport", choices=["stdio", "sse", "streamable-http"], help="Transport mode (stdio, sse or streamable-http)", ) args = parser.parse_args() if "CONFIG_PATH" in os.environ: config_path = os.environ["CONFIG_PATH"] app.load_configuration(config_path) if "CONFIG" in os.environ: config = os.environ["CONFIG"] app.load_configuration_from_string(config) if "SECURITY" in os.environ: security_params = BaseSecurity.parse_security_parameters_from_env( os.environ, ) app.set_security_params(security_params) mcp_settings = json.loads(os.environ.get("MCP_SETTINGS", "{}")) app.get_mcp(**mcp_settings).run(transport=args.transport)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/huazhengwang/figma-api'

If you have feedback or need assistance with the MCP directory API, please join our Discord server