UNPKG

miridev-mcp

Version:

Model Context Protocol server and CLI for deploying websites to miri.dev using natural language

71 lines (58 loc) β€’ 2.25 kB
#!/usr/bin/env node const fs = require('fs-extra'); const path = require('path'); const chalk = require('chalk'); const os = require('os'); async function installClaudeConfig() { console.log(chalk.blue('πŸ”§ Installing Claude Desktop MCP configuration...\n')); // ν”Œλž«νΌλ³„ μ„€μ • 파일 경둜 const configPath = process.platform === 'darwin' ? path.join(os.homedir(), 'Library/Application Support/Claude/claude_desktop_config.json') : path.join(os.homedir(), 'AppData/Roaming/Claude/claude_desktop_config.json'); const mcpServerPath = path.resolve(__dirname, '../src/index.js'); const mcpConfig = { mcpServers: { miridev: { command: 'node', args: [mcpServerPath], env: { MIRI_API_URL: 'https://www.miri.dev/api' } } } }; try { // μ„€μ • 디렉토리 생성 await fs.ensureDir(path.dirname(configPath)); let existingConfig = {}; if (await fs.pathExists(configPath)) { console.log(chalk.yellow('πŸ“ Existing Claude config found, merging...')); existingConfig = await fs.readJson(configPath); } // κΈ°μ‘΄ μ„€μ •κ³Ό 병합 const updatedConfig = { ...existingConfig, mcpServers: { ...existingConfig.mcpServers, ...mcpConfig.mcpServers } }; // μ„€μ • 파일 μ €μž₯ await fs.writeJson(configPath, updatedConfig, { spaces: 2 }); console.log(chalk.green('βœ… Claude Desktop configuration installed successfully!')); console.log(chalk.blue(`πŸ“ Config file: ${configPath}`)); console.log(chalk.blue(`πŸ”§ MCP server: ${mcpServerPath}`)); console.log(chalk.yellow('\nπŸ”„ Please restart Claude Desktop to apply changes')); console.log(chalk.gray('\nπŸ’‘ You can now use natural language commands like:')); console.log(chalk.gray(' "ν™ˆνŽ˜μ΄μ§€λ₯Ό miri.dev에 λ°°ν¬ν•˜λΌ"')); console.log(chalk.gray(' "Deploy my website to miri.dev"')); } catch (error) { console.error(chalk.red('❌ Installation failed:'), error.message); process.exit(1); } } // 직접 μ‹€ν–‰λœ 경우 if (require.main === module) { installClaudeConfig().catch(console.error); } module.exports = { installClaudeConfig };