Skip to content

Commit 9dc8746

Browse files
fix: npx path in windows is npx.cmd (#169)
1 parent 64c31ed commit 9dc8746

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/mcpm/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def main(ctx, help_flag, version):
9898
# Check if a command is being executed (and it's not help, no command, or the client command)
9999
if (
100100
ctx.invoked_subcommand
101-
and ctx.invoked_subcommand not in ["target", "client", "profile", "router", "share"]
101+
and ctx.invoked_subcommand not in ["target", "client", "profile", "router", "share", "inspector"]
102102
and not help_flag
103103
):
104104
# Check if active client is set

src/mcpm/commands/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from mcpm.clients.client_config import ClientConfigManager
1616
from mcpm.clients.client_registry import ClientRegistry
1717
from mcpm.utils.display import print_client_error, print_error, print_server_config
18+
from mcpm.utils.platform import NPX_CMD
1819

1920
console = Console()
2021
client_config_manager = ClientConfigManager()
@@ -111,7 +112,7 @@ def edit_client():
111112
basic_config = {
112113
"mcpServers": {
113114
"filesystem": {
114-
"command": "npx",
115+
"command": NPX_CMD,
115116
"args": [
116117
"-y",
117118
"@modelcontextprotocol/server-filesystem",

src/mcpm/commands/inspector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from rich.console import Console
1212
from rich.panel import Panel
1313

14+
from mcpm.utils.platform import NPX_CMD
15+
1416
console = Console()
1517

1618
# Define context settings to handle help flag properly
@@ -48,7 +50,7 @@ def inspector(args, yes):
4850
if args:
4951
# Pass all arguments directly to the inspector
5052
arg_string = " ".join(args)
51-
cmd = f"npx @modelcontextprotocol/inspector {arg_string}"
53+
cmd = f"{NPX_CMD} @modelcontextprotocol/inspector {arg_string}"
5254
console.print(f"[bold]Running MCPM Inspector with arguments:[/] {arg_string}")
5355
else:
5456
# No arguments provided, prompt for confirmation
@@ -59,7 +61,7 @@ def inspector(args, yes):
5961
console.print("[yellow]Inspector cancelled.[/]")
6062
return
6163

62-
cmd = "npx @modelcontextprotocol/inspector"
64+
cmd = f"{NPX_CMD} @modelcontextprotocol/inspector"
6365

6466
console.print("[cyan]Starting MCPM Inspector...[/]")
6567
console.print("The Inspector UI will open in your web browser.")

src/mcpm/utils/platform.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,6 @@ def get_frpc_directory(app_name: str = "mcpm") -> Path:
103103

104104
# Default to ~/.local/share if XDG_DATA_HOME is not defined
105105
return Path.home() / ".local" / "share" / app_name / "frpc"
106+
107+
108+
NPX_CMD = "npx" if sys.platform != "win32" else "npx.cmd"

0 commit comments

Comments
 (0)