Skip to main content
Glama

MCPMan

by semistrict
find-claude.ts1.11 kB
import { execFile } from "node:child_process"; import { promisify } from "node:util"; import { TRACE } from "./logging.js"; const execFilePromise = promisify(execFile); /** * Find Claude Code executable path */ export async function findClaudeExecutable(): Promise<string | undefined> { try { // Try to find claude in PATH // Run which in user's default shell const { stdout } = await execFilePromise("which", ["claude"]); const whichPath = stdout.trim(); if (!whichPath) { return undefined; } // Try to resolve symlinks using readlink try { const { stdout: resolvedPath } = await execFilePromise("readlink", ["-f", whichPath]); return resolvedPath.trim(); } catch { // readlink failed, try realpath try { const { stdout: resolvedPath } = await execFilePromise("realpath", [whichPath]); return resolvedPath.trim(); } catch { // Both failed, return the which path return whichPath; } } } catch (error) { TRACE("Failed to find claude executable:", error); return undefined; } }

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/semistrict/mcpman'

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