Skip to main content
Glama

Desktop Commander MCP

MIT License
14,614
5
  • Linux
  • Apple
index.ts1.98 kB
#!/usr/bin/env node import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { server } from './server.js'; import { commandManager } from './command-manager.js'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); async function runSetup() { const setupScript = join(__dirname, 'setup-claude-server.js'); const { default: setupModule } = await import(setupScript); if (typeof setupModule === 'function') { await setupModule(); } } async function runServer() { try { // Check if first argument is "setup" if (process.argv[2] === 'setup') { await runSetup(); return; } // Handle uncaught exceptions process.on('uncaughtException', async (error) => { const errorMessage = error instanceof Error ? error.message : String(error); process.exit(1); }); // Handle unhandled rejections process.on('unhandledRejection', async (reason) => { const errorMessage = reason instanceof Error ? reason.message : String(reason); process.exit(1); }); const transport = new StdioServerTransport(); // Load blocked commands from config file await commandManager.loadBlockedCommands(); await server.connect(transport); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); process.stderr.write(JSON.stringify({ type: 'error', timestamp: new Date().toISOString(), message: `Failed to start server: ${errorMessage}` }) + '\n'); process.exit(1); } } runServer().catch(async (error) => { const errorMessage = error instanceof Error ? error.message : String(error); process.stderr.write(JSON.stringify({ type: 'error', timestamp: new Date().toISOString(), message: `Fatal error running server: ${errorMessage}` }) + '\n'); process.exit(1); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MrGNSS/ClaudeDesktopCommander'

If you have feedback or need assistance with the MCP directory API, please join our Discord server