Skip to content

Commit 343fbae

Browse files
committed
Fix: Use absolute path to uv executable in Claude Desktop config
1 parent c2ca8e0 commit 343fbae

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/mcp/cli/claude.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
from pathlib import Path
77
from typing import Any
8+
import shutil
89

910
from mcp.server.fastmcp.utilities.logging import get_logger
1011

@@ -30,6 +31,16 @@ def get_claude_config_path() -> Path | None:
3031
return path
3132
return None
3233

34+
def get_uv_path() -> str:
35+
"""Get the full path to the uv executable."""
36+
uv_path = shutil.which("uv")
37+
if not uv_path:
38+
logger.error(
39+
"uv executable not found in PATH, falling back to 'uv'. "
40+
"Please ensure uv is installed and in your PATH"
41+
)
42+
return "uv" # Fall back to just "uv" if not found
43+
return uv_path
3344

3445
def update_claude_config(
3546
file_spec: str,
@@ -54,6 +65,7 @@ def update_claude_config(
5465
Claude Desktop may not be installed or properly set up.
5566
"""
5667
config_dir = get_claude_config_path()
68+
uv_path = get_uv_path()
5769
if not config_dir:
5870
raise RuntimeError(
5971
"Claude Desktop config directory not found. Please ensure Claude Desktop"
@@ -117,7 +129,7 @@ def update_claude_config(
117129
# Add fastmcp run command
118130
args.extend(["mcp", "run", file_spec])
119131

120-
server_config: dict[str, Any] = {"command": "uv", "args": args}
132+
server_config: dict[str, Any] = {"command": uv_path, "args": args}
121133

122134
# Add environment variables if specified
123135
if env_vars:

0 commit comments

Comments
 (0)