fix: MCP server bd executable path resolution
Fixes issue where MCP tools failed with "bd executable not found" when BEADS_PATH was set to command name instead of absolute path. Changes: - Remove BEADS_PATH=bd from plugin.json (use auto-detection) - Enhance config validator to resolve command names via PATH - Add comprehensive config validation tests (11 new tests) The validator now accepts both: - Absolute paths: /usr/local/bin/bd - Command names: bd (resolved via shutil.which) This makes the MCP server more robust and user-friendly while maintaining backward compatibility. All 90 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -43,21 +43,27 @@ class Config(BaseSettings):
|
||||
"""Validate BEADS_PATH points to an executable bd binary.
|
||||
|
||||
Args:
|
||||
v: Path to bd executable
|
||||
v: Path to bd executable (can be command name or absolute path)
|
||||
|
||||
Returns:
|
||||
Validated path
|
||||
Validated absolute path
|
||||
|
||||
Raises:
|
||||
ValueError: If path is invalid or not executable
|
||||
"""
|
||||
path = Path(v)
|
||||
|
||||
# If not an absolute/existing path, try to find it in PATH
|
||||
if not path.exists():
|
||||
raise ValueError(
|
||||
f"bd executable not found at: {v}\n"
|
||||
+ "Please verify BEADS_PATH points to a valid bd executable."
|
||||
)
|
||||
found = shutil.which(v)
|
||||
if found:
|
||||
v = found
|
||||
path = Path(v)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"bd executable not found at: {v}\n"
|
||||
+ "Please verify BEADS_PATH points to a valid bd executable."
|
||||
)
|
||||
|
||||
if not os.access(v, os.X_OK):
|
||||
raise ValueError(
|
||||
|
||||
Reference in New Issue
Block a user