Skip to main content
Glama

Figma MCP Server

by 1yhy
index.ts1.07 kB
#!/usr/bin/env node import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { FigmaMcpServer } from "./server.js"; import { getServerConfig } from "./config.js"; import { resolve } from "path"; import { config } from "dotenv"; import { fileURLToPath } from "url"; // Load .env from the current working directory config({ path: resolve(process.cwd(), ".env") }); export async function startServer(): Promise<void> { // Check if we're running in stdio mode (e.g., via CLI) const isStdioMode = process.env.NODE_ENV === "cli" || process.argv.includes("--stdio"); const config = getServerConfig(isStdioMode); const server = new FigmaMcpServer(config.figmaApiKey); if (isStdioMode) { const transport = new StdioServerTransport(); await server.connect(transport); } else { console.log(`Initializing Figma MCP Server in HTTP mode on port ${config.port}...`); await server.startHttpServer(config.port); } } startServer().catch((error) => { console.error("Failed to start server:", error); process.exit(1); });

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/1yhy/Figma-Context-MCP'

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