diff --git a/src/mcp_server_gitea.rs b/src/mcp_server_gitea.rs index 97eb128..e343997 100644 --- a/src/mcp_server_gitea.rs +++ b/src/mcp_server_gitea.rs @@ -268,12 +268,22 @@ fn resolve_binary_path(explicit_path: &Option) -> Result { } // Build list of common binary paths to try - let mut search_paths = vec![ - PathBuf::from("/usr/local/bin/gitea-mcp"), - PathBuf::from("/usr/local/bin/gitea-mcp-server"), - PathBuf::from("/usr/bin/gitea-mcp"), - PathBuf::from("/usr/bin/gitea-mcp-server"), - ]; + // Note: On macOS, Homebrew paths are checked first since that's the recommended + // installation method and Homebrew installs as 'gitea-mcp-server' + let mut search_paths = vec![]; + + // macOS M-series (ARM64) Homebrew locations - check first on macOS + #[cfg(target_os = "macos")] + { + search_paths.push(PathBuf::from("/opt/homebrew/bin/gitea-mcp")); + search_paths.push(PathBuf::from("/opt/homebrew/bin/gitea-mcp-server")); + } + + // Standard system paths (work on Linux, macOS, Windows) + search_paths.push(PathBuf::from("/usr/local/bin/gitea-mcp")); + search_paths.push(PathBuf::from("/usr/local/bin/gitea-mcp-server")); + search_paths.push(PathBuf::from("/usr/bin/gitea-mcp")); + search_paths.push(PathBuf::from("/usr/bin/gitea-mcp-server")); // Add home directory paths if let Ok(home) = std::env::var("HOME") { @@ -285,13 +295,6 @@ fn resolve_binary_path(explicit_path: &Option) -> Result { search_paths.push(PathBuf::from(&home).join(".cargo/bin/gitea-mcp-server")); } - // macOS M-series (ARM64) Homebrew locations - #[cfg(target_os = "macos")] - { - search_paths.push(PathBuf::from("/opt/homebrew/bin/gitea-mcp")); - search_paths.push(PathBuf::from("/opt/homebrew/bin/gitea-mcp-server")); - } - // Windows locations #[cfg(target_os = "windows")] {