用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Aradotso/design-skills --skill opencode-mcp-figma-auth命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | opencode-mcp-figma-auth |
| description | Authenticate OpenCode with Figma MCP server to enable Figma design integration |
| triggers | ["authenticate with figma mcp","log into figma for opencode","connect opencode to figma","set up figma mcp authentication","create figma mcp auth file","enable figma access for mcp","configure figma mcp connection","authenticate figma design server"] |
Skill by ara.so — Design Skills collection.
This skill enables authentication with Figma's MCP (Model Context Protocol) server for OpenCode and other AI agents. Figma MCP rejects non-whitelisted agents by default; this tool generates the required authentication file to bypass that restriction.
OpenCode MCP Figma is a minimal authentication tool that:
https://mcp.figma.com/mcpmcp-auth.json file with valid credentialsThis is specifically needed because Figma's MCP server has agent whitelisting that blocks OpenCode by default.
# Clone or navigate to the project directory
npm install
npm run build
npm start https://mcp.figma.com/mcp
This command:
mcp-auth.json file in the current directoryAfter authentication, move the generated file to OpenCode's MCP auth location:
# Linux/macOS
mv mcp-auth.json ~/.local/share/opencode/mcp-auth.json
# Or merge with existing file if you have other MCP authentications
cat mcp-auth.json >> ~/.local/share/opencode/mcp-auth.json
# Windows
move mcp-auth.json %LOCALAPPDATA%\opencode\mcp-auth.json
opencode-mcp-figma/
├── src/
│ └── index.ts # Main authentication logic
├── package.json
├── tsconfig.json
└── mcp-auth.json # Generated after authentication
The mcp-auth.json file follows this structure:
{
"https://mcp.figma.com/mcp": {
"token": "generated-token-here",
"expires": 1234567890000
}
}
After authentication, configure OpenCode to use Figma MCP by adding to your MCP settings:
{
"mcpServers": {
"figma": {
"url": "https://mcp.figma.com/mcp"
}
}
}
import { authenticate } from './src/index';
// Authenticate with Figma MCP server
const mcpUrl = 'https://mcp.figma.com/mcp';
authenticate(mcpUrl)
.then(() => {
console.log('Authentication successful');
console.log('mcp-auth.json created in current directory');
})
.catch((error) => {
console.error('Authentication failed:', error);
});
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
// Read generated auth file
const authFile = fs.readFileSync('mcp-auth.json', 'utf-8');
const authData = JSON.parse(authFile);
// Get OpenCode's MCP auth path
const openCodeAuthPath = path.join(
os.homedir(),
'.local',
'share',
'opencode',
'mcp-auth.json'
);
// Merge with existing auth if present
let existingAuth = {};
if (fs.existsSync(openCodeAuthPath)) {
existingAuth = JSON.parse(fs.readFileSync(openCodeAuthPath, 'utf-8'));
}
const mergedAuth = { ...existingAuth, ...authData };
// Write merged auth
fs.mkdirSync(path.dirname(openCodeAuthPath), { recursive: true });
fs.writeFileSync(openCodeAuthPath, JSON.stringify(mergedAuth, null, 2));
console.();
import * as fs from 'fs';
function verifyAuth(mcpUrl: string): boolean {
try {
const authFile = fs.readFileSync('mcp-auth.json', 'utf-8');
const authData = JSON.parse(authFile);
if (!authData[mcpUrl]) {
console.error(`No authentication found for ${mcpUrl}`);
return false;
}
const { token, expires } = authData[mcpUrl];
if (!token) {
console.error('Token is missing');
return false;
}
if (expires && Date.now() > expires) {
console.error('Token has expired');
return false;
}
console.log('Authentication is valid');
return true;
} catch (error) {
console.error('Failed to verify authentication:', error);
;
}
}
();
#!/usr/bin/env node
import { authenticate } from './src/index';
import { execSync } from 'child_process';
import * as path from 'path';
import * as os from 'os';
async function setup() {
const mcpUrl = 'https://mcp.figma.com/mcp';
console.log('Authenticating with Figma MCP...');
await authenticate(mcpUrl);
const destPath = path.join(
os.homedir(),
'.local',
'share',
'opencode',
'mcp-auth.json'
);
console.log('Installing auth file...');
execSync(`mkdir -p ${path.dirname(destPath)}`);
execSync(`mv mcp-auth.json ${destPath}`);
console.log('✓ Figma MCP authentication complete');
console.log('You can now use Figma with OpenCode');
}
setup().(.);
// For automated environments where manual auth isn't possible
import * as fs from 'fs';
function setupAuthFromEnv() {
const figmaToken = process.env.FIGMA_MCP_TOKEN;
const figmaExpires = process.env.FIGMA_MCP_EXPIRES;
if (!figmaToken) {
throw new Error('FIGMA_MCP_TOKEN environment variable required');
}
const authData = {
'https://mcp.figma.com/mcp': {
token: figmaToken,
expires: figmaExpires ? parseInt(figmaExpires) : undefined
}
};
fs.writeFileSync('mcp-auth.json', JSON.stringify(authData, null, 2));
console.log('Auth file created from environment variables');
}
Problem: Authentication command returns an error
Solutions:
https://mcp.figma.com/mcpnpm installnpm run buildProblem: OpenCode doesn't recognize the authentication
Solutions:
# Verify file location
ls -la ~/.local/share/opencode/mcp-auth.json
# Check file permissions
chmod 600 ~/.local/share/opencode/mcp-auth.json
# Verify file contents
cat ~/.local/share/opencode/mcp-auth.json
Problem: Authentication worked initially but now fails
Solution: Re-run authentication to generate a new token:
npm start https://mcp.figma.com/mcp
mv mcp-auth.json ~/.local/share/opencode/mcp-auth.json
Problem: Need to authenticate with multiple MCP servers
Solution: Merge auth files instead of overwriting:
import * as fs from 'fs';
const newAuth = JSON.parse(fs.readFileSync('mcp-auth.json', 'utf-8'));
const existingPath = '~/.local/share/opencode/mcp-auth.json';
const existing = JSON.parse(fs.readFileSync(existingPath, 'utf-8'));
const merged = { ...existing, ...newAuth };
fs.writeFileSync(existingPath, JSON.stringify(merged, null, 2));
This tool addresses the issue described in OpenCode Issue #988 where Figma's MCP server whitelisting blocks certain AI agents. While designed for Figma, the authentication approach may work with other MCP servers that implement similar authentication mechanisms.