#!/usr/bin/env npx tsx import fs from 'fs'; import path from 'path'; /** * Fix the Reddit MCP server configuration to use the correct package name */ async function fixRedditMCPConfig() { console.log('🔧 Fixing Reddit MCP Server Configuration\n'); const configPath = path.join(process.env.HOME!, '.config/hashgraph-online/mcp-servers.json'); const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); const redditServer = config.find((s: any) => s.name === 'Reddit'); if (!redditServer) { console.log('❌ No Reddit server found in configuration'); return; } console.log('📌 Current Reddit server configuration:'); console.log(` Command: ${redditServer.config.command}`); console.log(` Args: ${JSON.stringify(redditServer.config.args)}`); console.log(` Status: ${redditServer.status}`); console.log(''); if (redditServer.config.args?.includes('Reddit')) { console.log('❌ Found incorrect package name "Reddit"'); console.log('✅ Fixing to use "reddit-mcp" instead...\n'); const argIndex = redditServer.config.args.indexOf('Reddit'); redditServer.config.args[argIndex] = 'reddit-mcp'; redditServer.status = 'disconnected'; redditServer.tools = []; delete redditServer.lastConnected; delete redditServer.connectionHealth; fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); console.log('✅ Configuration updated successfully!'); console.log('📌 New Reddit server configuration:'); console.log(` Command: ${redditServer.config.command}`); console.log(` Args: ${JSON.stringify(redditServer.config.args)}`); console.log(''); console.log('💡 Next steps:'); console.log(' 1. Restart the desktop app or reload MCP servers'); console.log(' 2. The Reddit server should now connect properly'); console.log(' 3. Note: You may need Reddit API credentials (REDDIT_CLIENT_ID and REDDIT_CLIENT_SECRET)'); console.log(' to fully use the Reddit MCP server features'); } else { console.log('✅ Reddit server is already using a valid package name'); console.log(` Current package: ${redditServer.config.args?.[1] || 'unknown'}`); } } fixRedditMCPConfig().catch(console.error);