cotiv2-mcp
Version:
> A plug-and-play MCP tool server to **send COTI**, **transfer BEP-20 tokens**, **deploy tokens**, and **interact with smart contracts** on the **COTI v2 Network (COTI)** — built for **Claude Desktop**, **AI agents**, and **developers.**
40 lines (39 loc) • 1.49 kB
JavaScript
import chalk from "chalk";
import path from "path";
import fs from "fs-extra";
import os from "os";
import { blue } from "../config.js";
// Configure Claude Desktop
export const configureClaude = async (config) => {
const userHome = os.homedir();
let claudePath;
const platform = os.platform();
if (platform == "darwin") {
claudePath = path.join(userHome, "Library/Application Support/Claude/claude_desktop_config.json");
}
else if (platform == "win32") {
claudePath = path.join(userHome, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
}
else {
console.log(chalk.red("❌ Unsupported platform."));
return false;
}
if (!fs.existsSync(claudePath)) {
console.log(chalk.yellow("⚠️ Claude config file not found. Creating a new one with default configuration."));
// Create a default configuration object
const defaultConfig = {
mcpServers: {},
};
// Write the default configuration to the file
await fs.writeJSON(claudePath, defaultConfig, { spaces: 2 });
}
const jsonData = fs.readFileSync(claudePath, "utf8");
const data = JSON.parse(jsonData);
data.mcpServers = {
...data.mcpServers,
...config,
};
await fs.writeJSON(claudePath, data, { spaces: 2 });
console.log(blue("✅ COTI v2 Network MCP configured for Claude Desktop. Please RESTART your Claude to enjoy it 🎉"));
return true;
};