Skip to content

Commit c32c338

Browse files
committed
Fix: Use absolute path to uv executable in Claude Desktop config
1 parent 490132a commit c32c338

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/client/test_config.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,28 @@ def test_command_execution(mock_config_path: Path):
4848

4949
assert result.returncode == 0
5050
assert "usage" in result.stdout.lower()
51+
52+
53+
def test_absolute_uv_path(mock_config_path: Path):
54+
"""Test that the absolute path to uv is used when available."""
55+
# Mock the shutil.which function to return a fake path
56+
mock_uv_path = "/usr/local/bin/uv"
57+
58+
with patch("mcp.cli.claude.get_uv_path", return_value=mock_uv_path):
59+
# Setup
60+
server_name = "test_server"
61+
file_spec = "test_server.py:app"
62+
63+
# Update config
64+
success = update_claude_config(file_spec=file_spec, server_name=server_name)
65+
assert success
66+
67+
# Read the generated config
68+
config_file = mock_config_path / "claude_desktop_config.json"
69+
config = json.loads(config_file.read_text())
70+
71+
# Verify the command is the absolute path
72+
server_config = config["mcpServers"][server_name]
73+
command = server_config["command"]
74+
75+
assert command == mock_uv_path

0 commit comments

Comments
 (0)