Skip to content

Commit e2d4833

Browse files
committed
fix: windows config path for cursor and windsurf
1 parent 70d4bf7 commit e2d4833

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

src/mcpm/clients/managers/continue_extension.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ def __init__(self, config_path=None):
4343
self.config_path = config_path
4444
else:
4545
# Set config path based on detected platform
46-
if os.name == "Darwin": # macOS
47-
self.config_path = os.path.expanduser("~/.continue/config.yaml")
48-
elif os.name == "Windows":
46+
if self._system == "Windows":
4947
self.config_path = os.path.join(os.environ.get("USERPROFILE", ""), ".continue", "config.yaml")
5048
else:
51-
# Linux
49+
# MacOS or Linux
5250
self.config_path = os.path.expanduser("~/.continue/config.yaml")
5351

5452
# Also check for workspace config

src/mcpm/clients/managers/cursor.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ def __init__(self, config_path=None):
3131
self.config_path = config_path
3232
else:
3333
# Set config path based on detected platform
34-
if self._system == "Darwin": # macOS
35-
self.config_path = os.path.expanduser("~/Library/Application Support/Cursor/User/mcp_config.json")
36-
elif self._system == "Windows":
37-
self.config_path = os.path.join(os.environ.get("APPDATA", ""), "Cursor", "User", "mcp_config.json")
34+
if self._system == "Windows":
35+
self.config_path = os.path.join(os.environ.get("USERPROFILE", ""), ".cursor", "mcp.json")
3836
else:
39-
# Linux
40-
self.config_path = os.path.expanduser("~/.config/Cursor/User/mcp_config.json")
37+
# MacOS or Linux
38+
self.config_path = os.path.expanduser("~/.cursor/mcp.json")
4139

4240
def _get_empty_config(self) -> Dict[str, Any]:
4341
"""Get empty config structure for Cursor"""

src/mcpm/clients/managers/goose.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ def __init__(self, config_path=None):
4141
self.config_path = config_path
4242
else:
4343
# Set config path based on detected platform
44-
if os.name == "Darwin": # macOS
45-
self.config_path = os.path.expanduser("~/.config/goose/config.yaml")
46-
elif os.name == "Windows":
44+
if self._system == "Windows":
4745
self.config_path = os.path.join(os.environ.get("USERPROFILE", ""), ".config", "goose", "config.yaml")
4846
else:
49-
# Linux
47+
# MacOS or Linux
5048
self.config_path = os.path.expanduser("~/.config/goose/config.yaml")
5149

5250
# Also check for workspace config

src/mcpm/clients/managers/windsurf.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ def __init__(self, config_path=None):
3232
self.config_path = config_path
3333
else:
3434
# Set config path based on detected platform
35-
if self._system == "Darwin": # macOS
36-
self.config_path = os.path.expanduser("~/.codeium/windsurf/mcp_config.json")
37-
elif self._system == "Windows":
35+
if self._system == "Windows":
3836
self.config_path = os.path.join(
39-
os.environ.get("LOCALAPPDATA", ""), "Codeium", "windsurf", "mcp_config.json"
37+
os.environ.get("USERPROFILE", ""), ".codeium", "windsurf", "mcp_config.json"
4038
)
4139
else:
42-
# Linux
40+
# MacOS or Linux
4341
self.config_path = os.path.expanduser("~/.codeium/windsurf/mcp_config.json")
4442

4543
def to_client_format(self, server_config: ServerConfig) -> Dict[str, Any]:

src/mcpm/commands/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ def set_client(client_name):
8383
8484
CLIENT is the name of the client to set as active.
8585
"""
86+
# block the user to change client with a specific profile activated, or user will fail to deactivate a profile
87+
# cause mcpm router is not attached to the client switched
88+
active_profile = ClientRegistry.get_active_profile()
89+
if active_profile:
90+
console.print(
91+
f"[bold blue]Note:[/] Profile '{active_profile}' needs to be deactivated before switching clients."
92+
)
93+
console.print("Please run [bold cyan]mcpm deactivate[/] to release the current profile.")
94+
return
95+
8696
# Get the list of supported clients
8797
supported_clients = ClientRegistry.get_supported_clients()
8898

src/mcpm/commands/server_operations/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ def client_get_server(client: str, server: str) -> ServerConfig | None:
5454

5555
def profile_add_server(profile: str, server_config: ServerConfig, force: bool = False) -> bool:
5656
profile_manager = ProfileConfigManager()
57-
if not profile_manager.get_profile(profile):
57+
profile_info = profile_manager.get_profile(profile)
58+
if profile_info is None:
5859
console.print(f"[bold red]Error:[/] Profile '{profile}' not found.")
5960
return False
61+
6062
if profile_manager.get_profile_server(profile, server_config.name) and not force:
6163
console.print(f"[bold red]Error:[/] Server '{server_config.name}' already exists in {profile}.")
6264
console.print("Use --force to override.")

0 commit comments

Comments
 (0)