arbitrum-mcp-tools
Version:
A comprehensive collection of Model Context Protocol (MCP) tools for interacting with the Arbitrum blockchain. Enables AI assistants like Claude, Cursor, Windsurf, VS Code, Gemini CLI, and OpenAI Codex to perform blockchain operations including account an
108 lines (107 loc) • 4.55 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { checkbox, confirm } from "@inquirer/prompts";
import chalk from "chalk";
import { platforms, getPlatformIds } from "../clients/registry.js";
import { isPlatformInstalled, uninstallFromPlatform, } from "../clients/base.js";
import { printHeader, printSuccess, printError, printUninstallComplete, } from "../utils/ui.js";
export function uninstallCommand() {
return __awaiter(this, void 0, void 0, function* () {
printHeader("Arbitrum MCP Tools - Uninstall Wizard");
const platformIds = getPlatformIds();
// Find platforms that have arbitrum installed
const installedPlatforms = [];
for (const id of platformIds) {
const platform = platforms[id];
if (isPlatformInstalled(id, platform, "global")) {
installedPlatforms.push({ id, scope: "global" });
}
if (isPlatformInstalled(id, platform, "local")) {
installedPlatforms.push({ id, scope: "local" });
}
}
if (installedPlatforms.length === 0) {
console.log(chalk.yellow("\nNo installations found. Nothing to uninstall."));
return;
}
// Build choices
const choices = installedPlatforms.map(({ id, scope }) => {
const platform = platforms[id];
const scopeLabel = scope === "global" ? "global" : "local";
return {
name: `${platform.name} (${scopeLabel})`,
value: `${id}:${scope}`,
disabled: false,
checked: true,
};
});
console.log("");
// Platform selection
const selectedItems = yield checkbox({
message: "Which installations do you want to remove? (Space to select, Enter to confirm)",
choices: [
{
name: chalk.bold("Select All"),
value: "__all__",
checked: false,
disabled: false,
},
...choices,
],
pageSize: 10,
});
// Handle "All" selection
let finalSelection;
if (selectedItems.includes("__all__")) {
finalSelection = installedPlatforms.map(({ id, scope }) => `${id}:${scope}`);
}
else {
finalSelection = selectedItems.filter((p) => p !== "__all__");
}
if (finalSelection.length === 0) {
console.log(chalk.yellow("\nNo platforms selected. Uninstall cancelled."));
return;
}
// Confirm uninstall
const proceed = yield confirm({
message: `Remove from ${finalSelection.length} installation(s)?`,
default: false,
});
if (!proceed) {
console.log(chalk.yellow("\nUninstall cancelled."));
return;
}
console.log("");
// Perform uninstalls
let successCount = 0;
let failCount = 0;
for (const item of finalSelection) {
const [platformId, scope] = item.split(":");
const platform = platforms[platformId];
const result = uninstallFromPlatform(platformId, platform, scope);
const scopeLabel = scope === "global" ? "global" : "local";
if (result.success) {
printSuccess(`${platform.name} (${scopeLabel}) config updated`);
successCount++;
}
else {
printError(`${platform.name} (${scopeLabel}): ${result.error || "Failed to update config"}`);
failCount++;
}
}
console.log("");
if (successCount > 0) {
printUninstallComplete();
}
else {
console.log(chalk.red("Uninstall failed. No configurations were modified."));
}
});
}