UNPKG

figma-restoration-mcp-vue-tools

Version:

Professional Figma Component Restoration Kit - MCP tools with snapDOM-powered high-quality screenshots, intelligent shadow detection, and advanced diff analysis for Vue component restoration. Features enhanced figma_compare with color-coded region analysi

109 lines (96 loc) 3.44 kB
#!/usr/bin/env node /** * MCP 配置测试脚本 * 验证 MCP 服务器是否正确配置并可用 */ import fs from 'fs'; import path from 'path'; import { execSync } from 'child_process'; console.log('🔧 MCP 配置测试\n'); // 检查项目级配置 const projectConfigs = [ '.cursor/mcp.json', '.kiro/settings/mcp.json' ]; let mcpServersCount = 0; const expectedServers = ['figma-context', 'figma-restoration-mcp-vue-tools', 'memory']; projectConfigs.forEach(configPath => { if (fs.existsSync(configPath)) { try { const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); if (config.mcpServers) { const servers = Object.keys(config.mcpServers); console.log(`✅ MCP 配置文件: ${configPath}`); console.log(` 服务器数量: ${servers.length}`); console.log(` 服务器列表: ${servers.join(', ')}\n`); mcpServersCount += servers.length; // 检查预期的服务器 expectedServers.forEach(serverName => { if (config.mcpServers[serverName]) { console.log(` ✅ ${serverName}: 已配置`); } else { console.log(` ❌ ${serverName}: 未配置`); } }); console.log(''); } else { console.log(`❌ ${configPath} 中没有 mcpServers 配置\n`); } } catch (error) { console.log(`❌ 无法解析 ${configPath}: ${error.message}\n`); } } else { console.log(`⚠️ 配置文件不存在: ${configPath}\n`); } }); // 检查用户级配置 const userConfigs = [ path.join(process.env.HOME, '.cursor/mcp.json'), path.join(process.env.HOME, '.kiro/settings/mcp.json') ]; userConfigs.forEach(configPath => { if (fs.existsSync(configPath)) { try { const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); if (config.mcpServers) { const servers = Object.keys(config.mcpServers); console.log(`✅ 用户级 MCP 配置: ${configPath}`); console.log(` 服务器数量: ${servers.length}`); console.log(` 服务器列表: ${servers.join(', ')}\n`); } } catch (error) { console.log(`❌ 无法解析用户配置 ${configPath}: ${error.message}`); } } }); // 检查 Node.js 和 npm console.log('🔧 检查依赖:'); try { const nodeVersion = execSync('node --version', { stdio: 'pipe' }).toString().trim(); console.log(`✅ Node.js: ${nodeVersion}`); } catch (error) { console.log('❌ Node.js 未安装'); } try { const npmVersion = execSync('npm --version', { stdio: 'pipe' }).toString().trim(); console.log(`✅ npm: ${npmVersion}`); } catch (error) { console.log('❌ npm 未安装'); } // 总结 console.log('\n📋 配置总结:'); if (mcpServersCount > 0) { console.log('✅ MCP 配置完成!'); console.log('\n🚀 可用的 MCP 工具:'); console.log(' • figma-context: Figma 数据提取和图像下载'); console.log(' • figma-restoration-mcp-vue-tools: 组件截图、对比和SVG优化'); console.log(' • memory: 知识库管理和存储'); console.log('\n💡 使用方法:'); console.log(' 在 Cursor 或 Kiro 中重启 IDE'); console.log(' 使用相应的 MCP 工具进行 Figma 组件还原'); } else { console.log('❌ MCP 未正确配置'); console.log('\n🔧 修复方法:'); console.log(' 1. 运行: npm run mcp:configure'); console.log(' 2. 重启 IDE'); }