🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix: prevent stale PID false positives in MCP server startup
rUv3f650bcbf15e
diff --git a/v3/@claude-flow/cli/src/mcp-server.ts b/v3/@claude-flow/cli/src/mcp-server.tsindex 5c156b4952..7567d72e38 100644--- a/v3/@claude-flow/cli/src/mcp-server.ts+++ b/v3/@claude-flow/cli/src/mcp-server.ts@@ -649,18 +649,42 @@ export class MCPServerManager extends EventEmitter {} catch {// Ignore errors}+ // Also clean up legacy PID file location from older versions+ try {+ const legacyPath = path.join(process.cwd(), '.claude-flow', 'mcp-server.pid');+ if (legacyPath !== this.options.pidFile) {+ await fs.promises.unlink(legacyPath);+ }+ } catch {+ // Ignore — file may not exist+ }}/**- * Check if process is running+ * Check if process is running AND is a node/claude-flow process.+ * Plain `kill -0` returns true for any process with the same owner,+ * which causes false positives when the OS recycles the PID.*/private isProcessRunning(pid: number): boolean {try {process.kill(pid, 0);- return true;} catch {return false;}++ // Verify it's actually a node process (guards against PID reuse)+ try {+ const { execSync } = require('child_process') as typeof import('child_process');+ const cmdline = execSync(`cat /proc/${pid}/cmdline 2>/dev/null || ps -p ${pid} -o comm= 2>/dev/null`, {+ encoding: 'utf8',+ timeout: 1000,+ }).trim();+ // Must be a node process to be our MCP server+ return cmdline.includes('node') || cmdline.includes('claude-flow') || cmdline.includes('npx');+ } catch {+ // If we can't inspect the process (macOS, Windows, permissions), fall back to kill check+ return true;+ }}/**