fleek-mcp-installer
Version:
One-click installer for Fleek MCP in Claude Desktop
110 lines (96 loc) ⢠3.32 kB
JavaScript
const fs = require('fs');
const path = require('path');
const os = require('os');
const { execSync } = require('child_process');
// Check if npx is available
function checkNpx() {
try {
execSync('npx --version', { stdio: 'ignore' });
return true;
} catch (e) {
return false;
}
}
// Check if npm is available
function checkNpm() {
try {
execSync('npm --version', { stdio: 'ignore' });
return true;
} catch (e) {
return false;
}
}
console.log('\nš Fleek MCP Installer\n');
// Check Node.js tools availability
if (!checkNpm()) {
console.log('ā Node.js/npm not found!');
console.log('\nTo use Fleek MCP, you need Node.js installed.');
console.log('Please download it from: https://nodejs.org\n');
console.log('Or use our web setup instead:');
console.log('š https://fleek-api-explorer.vercel.app/setup\n');
process.exit(1);
}
if (!checkNpx()) {
console.log('ā ļø npx not found, but npm is available.');
console.log('Installing npx globally...');
try {
execSync('npm install -g npx', { stdio: 'inherit' });
console.log('ā
npx installed successfully!\n');
} catch (e) {
console.log('ā Failed to install npx');
console.log('Please run: npm install -g npx');
process.exit(1);
}
}
// Determine config path based on OS
let configDir;
if (process.platform === 'darwin') {
configDir = path.join(os.homedir(), 'Library', 'Application Support', 'Claude');
} else if (process.platform === 'win32') {
configDir = path.join(process.env.APPDATA || '', 'Claude');
} else {
configDir = path.join(os.homedir(), '.config', 'Claude');
}
const configPath = path.join(configDir, 'claude_desktop_config.json');
// Ensure directory exists
if (!fs.existsSync(configDir)) {
console.log('š Creating Claude config directory...');
fs.mkdirSync(configDir, { recursive: true });
}
// Configuration to add
const fleekConfig = {
"fleek-api-explorer": {
"command": "npx",
"args": ["-y", "fleek-mcp-remote", "--url", "https://fleek-api-explorer.vercel.app/api/mcp"]
}
};
// Read existing config or create new
let config = { mcpServers: {} };
if (fs.existsSync(configPath)) {
console.log('š Found existing config, updating...');
try {
const existingConfig = fs.readFileSync(configPath, 'utf8');
config = JSON.parse(existingConfig);
if (!config.mcpServers) {
config.mcpServers = {};
}
} catch (e) {
console.log('ā ļø Could not parse existing config, creating new one...');
}
} else {
console.log('š Creating new config file...');
}
// Add Fleek MCP
config.mcpServers['fleek-api-explorer'] = fleekConfig['fleek-api-explorer'];
// Write config
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
console.log('\nā
Installation complete!\n');
console.log('Next steps:');
console.log('1. Restart Claude Desktop');
console.log('2. Look for the MCP icon in Claude');
console.log('3. Try: "Show me all vendors"\n');
console.log('š Example prompts:');
console.log(' ⢠"List all vendors"');
console.log(' ⢠"Export vendors to Google Sheets"');
console.log(' ⢠"Search orders for customer@example.com"\n');