UNPKG

appmake-mcp-client

Version:

AppMake MCP Server Client for Claude Desktop - Mobile app development tools integration

89 lines (78 loc) 2.85 kB
#!/usr/bin/env node const fs = require('fs'); const path = require('path'); const os = require('os'); // Claude Desktop 설정 파일 경로 function getConfigPath() { const platform = os.platform(); if (platform === 'win32') { return path.join(process.env.APPDATA || process.env.HOME, 'Claude', 'claude_desktop_config.json'); } else if (platform === 'darwin') { return path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'); } else { return path.join(os.homedir(), '.config', 'Claude', 'claude_desktop_config.json'); } } function setupConfig() { const configPath = getConfigPath(); const configDir = path.dirname(configPath); // API 키 확인 const apiKey = process.argv[2] || process.env.APPMAKE_API_KEY || ''; if (!apiKey) { console.log('\n⚠️ API 키가 필요합니다!\n'); console.log('사용법:'); console.log(' npx appmake-mcp-client setup YOUR_API_KEY'); console.log('\n또는 환경변수 설정:'); console.log(' export APPMAKE_API_KEY=YOUR_API_KEY'); console.log(' npx appmake-mcp-client setup\n'); console.log('API 키 발급: https://www.appmake.co.kr\n'); process.exit(1); } // 디렉토리 생성 if (!fs.existsSync(configDir)) { fs.mkdirSync(configDir, { recursive: true }); } // 기존 설정 파일 읽기 let config = {}; if (fs.existsSync(configPath)) { try { const content = fs.readFileSync(configPath, 'utf8'); config = JSON.parse(content); } catch (error) { console.log('⚠️ 기존 설정 파일 읽기 실패, 새로 생성합니다.'); config = {}; } } // mcpServers 섹션 확인 if (!config.mcpServers) { config.mcpServers = {}; } // AppMake MCP 서버 설정 추가 config.mcpServers['appmake-mcp'] = { command: 'npx', args: ['appmake-mcp-client'], env: { MCP_SERVER_URL: 'https://mcp.appmake.co.kr', MCP_API_KEY: apiKey } }; // 설정 파일 저장 try { fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); console.log('\n✅ AppMake MCP Client 설정 완료!\n'); console.log('설정 파일 위치:', configPath); console.log('\n다음 단계:'); console.log('1. Claude Desktop을 재시작하세요'); console.log('2. Claude에서 "AppMake로 앱을 만들어줘"라고 말해보세요\n'); console.log('자세한 문서: https://github.com/appmake/mcp-client\n'); } catch (error) { console.error('❌ 설정 파일 저장 실패:', error.message); console.log('\n수동 설정 방법:'); console.log('1. 다음 경로에 파일을 생성하세요:', configPath); console.log('2. 아래 내용을 추가하세요:\n'); console.log(JSON.stringify(config, null, 2)); process.exit(1); } } // 실행 setupConfig();