Skip to main content
Glama

set_api_key

Configure your Figma API personal access token to enable AI assistants to interact with Figma files, comments, components, and team resources through the MCP server.

Instructions

Set your Figma API personal access token (will be saved to ~/.mcp-figma/config.json)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesYour Figma API personal access token

Implementation Reference

  • Main handler for the 'set_api_key' tool. Validates input arguments and delegates to AuthManager.setApiKey to store the API key.
    case 'set_api_key': { const args = this.validateArgs<{ api_key: string }>(request.params.arguments, ['api_key']); this.authManager.setApiKey(args.api_key); return { content: [{ type: 'text', text: 'API key set successfully and saved to config file' }], }; }
  • src/index.ts:91-104 (registration)
    Tool registration including name, description, and input schema for 'set_api_key'.
    { name: 'set_api_key', description: 'Set your Figma API personal access token (will be saved to ~/.mcp-figma/config.json)', inputSchema: { type: 'object', properties: { api_key: { type: 'string', description: 'Your Figma API personal access token' } }, required: ['api_key'] }, },
  • AuthManager.setApiKey method: stores the API key in memory, persists it via ConfigManager, and sets token info.
    setApiKey(apiKey: string): void { this.apiKey = apiKey; // 保存到配置文件 this.configManager.setApiKey(apiKey); // 由于Figma个人访问令牌不会过期,我们设置一个很远的过期日期 this.tokenInfo = { accessToken: apiKey, expiresAt: Date.now() + (365 * 24 * 60 * 60 * 1000) // 1年后 }; }
  • ConfigManager.setApiKey: updates the config object and saves it to ~/.mcp-figma/config.json file.
    public setApiKey(apiKey: string): void { this.config.apiKey = apiKey; this.saveConfig(); }
  • Input schema definition for the 'set_api_key' tool, specifying the required 'api_key' string parameter.
    inputSchema: { type: 'object', properties: { api_key: { type: 'string', description: 'Your Figma API personal access token' } }, required: ['api_key']

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/smithery-ai/mcp-figma'

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