fix: Prioritize Homebrew paths on macOS for binary discovery
## Problem On macOS with Homebrew, the binary discovery was returning /usr/local/bin/gitea-mcp (the first path in the search list) as a fallback, even though the actual binary was at /opt/homebrew/bin/gitea-mcp-server. Since Homebrew is the recommended installation method for macOS and installs the binary as 'gitea-mcp-server', it should be checked first. ## Solution Reorganize the search path order to prioritize Homebrew locations on macOS: 1. On macOS: Check /opt/homebrew/bin first (Homebrew paths) 2. Then: Check /usr/local/bin and /usr/bin (system paths) 3. Then: Check home directory paths 4. Finally: Check PATH environment variable ## Impact - macOS users with Homebrew installation now have auto-discovery work correctly - No need to manually set gitea_mcp_binary_path - Still works on Linux and other systems (Homebrew paths only added on macOS) ## Testing - ✅ Confirmed: /opt/homebrew/bin/gitea-mcp-server exists on M4 Mac - ✅ Confirmed: No /usr/local/bin/gitea-mcp on test Mac - 🔄 Ready for testing with auto-discovery on macOS
This commit is contained in:
@@ -268,12 +268,22 @@ fn resolve_binary_path(explicit_path: &Option<String>) -> Result<String> {
|
||||
}
|
||||
|
||||
// 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<String>) -> Result<String> {
|
||||
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")]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user