get_mcp_status
Verify the status of MCP handler and Claude Desktop processes to ensure uninterrupted operation and enable plugin reloading without closing the application.
Instructions
Check if MCP handler and Claude Desktop processes are running
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:109-147 (handler)The main execution logic for the 'get_mcp_status' tool. It uses ProcessDetector to find MCP handler and Claude Desktop processes, constructs a status object, and returns it as JSON text content.case 'get_mcp_status': { try { const mcpProcess = await processDetector.findMCPHandlerProcess(); const claudeProcess = await processDetector.findClaudeDesktopProcess(); const status = { mcp_handler: mcpProcess ? { running: true, pid: mcpProcess.pid, name: mcpProcess.name, cmd: mcpProcess.cmd, } : { running: false, }, claude_desktop: claudeProcess ? { running: true, pid: claudeProcess.pid, name: claudeProcess.name, } : { running: false, }, timestamp: new Date().toISOString(), }; return { content: [ { type: 'text', text: JSON.stringify(status, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get status: ${error}` ); } }
- src/index.ts:51-60 (registration)Registration of the 'get_mcp_status' tool in the listTools response, including name, description, and empty inputSchema (also serves as schema).{ name: 'get_mcp_status', description: 'Check if MCP handler and Claude Desktop processes are running', inputSchema: { type: 'object', properties: {}, required: [], }, }, ],
- src/process-detector.ts:15-71 (helper)Helper method to detect the running MCP handler process by filtering Node.js processes with MCP-related command patterns using ps-list and find-process.async findMCPHandlerProcess(): Promise<MCPProcess | null> { try { const processes = await psList(); // Look for Node.js processes that are running MCP-related code const mcpCandidates = processes.filter(proc => { const cmd = proc.cmd || ''; const name = proc.name || ''; // Check for Node.js processes running MCP servers return ( (name.includes('node') || name.includes('Node')) && (cmd.includes('mcp') || cmd.includes('modelcontextprotocol') || cmd.includes('claude-desktop-internal') || cmd.includes('@anthropic')) ); }); // If we have multiple candidates, try to identify the main MCP handler if (mcpCandidates.length > 0) { // Prefer processes that look like the main MCP handler const mainHandler = mcpCandidates.find(proc => proc.cmd?.includes('mcp-server') || proc.cmd?.includes('mcp-handler') || proc.cmd?.includes('desktop-mcp') ); const selected = mainHandler || mcpCandidates[0]; return { pid: selected.pid, name: selected.name, cmd: selected.cmd || '', ppid: selected.ppid }; } // Fallback: look for processes by port or specific patterns const nodeProcesses = await findProcess('name', 'node') as any[]; for (const proc of nodeProcesses) { if (proc.cmd?.includes('mcp') || proc.cmd?.includes('modelcontextprotocol')) { return { pid: proc.pid, name: proc.name, cmd: proc.cmd }; } } return null; } catch (error) { console.error('Error finding MCP handler process:', error); return null; } }
- src/process-detector.ts:73-97 (helper)Helper method to find the Claude Desktop process by matching process names containing 'claude' and 'desktop' or 'app'.async findClaudeDesktopProcess(): Promise<MCPProcess | null> { try { const processes = await psList(); const claude = processes.find(proc => { const name = proc.name.toLowerCase(); return name.includes('claude') && (name.includes('desktop') || name.includes('app')); }); if (claude) { return { pid: claude.pid, name: claude.name, cmd: claude.cmd || '', ppid: claude.ppid }; } return null; } catch (error) { console.error('Error finding Claude Desktop process:', error); return null; } }