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
JavaScript
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 };