UNPKG

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

71 lines (70 loc) 2.37 kB
import { getGlobalConfigPath, getLocalConfigPath } from "../utils/paths.js"; import { isAppInstalled } from "../utils/platform.js"; import { addArbitrumToJsonConfig, removeArbitrumFromJsonConfig, isArbitrumInstalledInJsonConfig, } from "./generators/json.js"; import { addArbitrumToTomlConfig, removeArbitrumFromTomlConfig, isArbitrumInstalledInTomlConfig, } from "./generators/toml.js"; export function getConfigPath(platform, scope) { if (scope === "global") { return getGlobalConfigPath(platform.global); } else { return getLocalConfigPath(platform.local); } } export function installToPlatform(platformId, platform, scope) { const configPath = getConfigPath(platform, scope); try { let success; if (platform.format === "json") { success = addArbitrumToJsonConfig(configPath, platform.configKey); } else { success = addArbitrumToTomlConfig(configPath, platform.configKey); } return { success, path: configPath, }; } catch (error) { return { success: false, path: configPath, error: error instanceof Error ? error.message : String(error), }; } } export function uninstallFromPlatform(platformId, platform, scope) { const configPath = getConfigPath(platform, scope); try { let success; if (platform.format === "json") { success = removeArbitrumFromJsonConfig(configPath, platform.configKey); } else { success = removeArbitrumFromTomlConfig(configPath, platform.configKey); } return { success, path: configPath, }; } catch (error) { return { success: false, path: configPath, error: error instanceof Error ? error.message : String(error), }; } } export function isPlatformInstalled(platformId, platform, scope) { const configPath = getConfigPath(platform, scope); if (platform.format === "json") { return isArbitrumInstalledInJsonConfig(configPath, platform.configKey); } else { return isArbitrumInstalledInTomlConfig(configPath, platform.configKey); } } export function isPlatformDetected(platformId) { return isAppInstalled(platformId); }