#!/usr/bin/env node
/**
* Uninstallation script for Perplexity Search MCP Skill
* Removes the MCP server configuration and skill definition
*/
import fs from "fs";
import path from "path";
const CLAUDE_DIR = path.join(process.env.HOME || "~", ".claude");
const MCP_CONFIG_PATH = path.join(CLAUDE_DIR, "mcp.json");
const SKILLS_DIR = path.join(CLAUDE_DIR, "skills", "perplexity");
function removeMcpConfig() {
if (!fs.existsSync(MCP_CONFIG_PATH)) {
console.log("No mcp.json found, skipping...");
return;
}
try {
const content = fs.readFileSync(MCP_CONFIG_PATH, "utf-8");
const config = JSON.parse(content);
if (config.mcpServers && config.mcpServers["perplexity-search"]) {
delete config.mcpServers["perplexity-search"];
fs.writeFileSync(MCP_CONFIG_PATH, JSON.stringify(config, null, 2));
console.log(`Removed perplexity-search from: ${MCP_CONFIG_PATH}`);
} else {
console.log("perplexity-search not found in mcp.json");
}
} catch (e) {
console.error("Error updating mcp.json:", e.message);
}
}
function removeSkill() {
if (fs.existsSync(SKILLS_DIR)) {
fs.rmSync(SKILLS_DIR, { recursive: true });
console.log(`Removed skill directory: ${SKILLS_DIR}`);
} else {
console.log("Skill directory not found, skipping...");
}
}
function main() {
console.log("Uninstalling Perplexity Search MCP Skill...\n");
removeMcpConfig();
removeSkill();
console.log("\n✅ Uninstallation complete!");
console.log("\nRestart Claude Code to apply changes.");
}
main();