Skip to content

fix: npx path in windows is npx.cmd #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mcpm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def main(ctx, help_flag, version):
# Check if a command is being executed (and it's not help, no command, or the client command)
if (
ctx.invoked_subcommand
and ctx.invoked_subcommand not in ["target", "client", "profile", "router", "share"]
and ctx.invoked_subcommand not in ["target", "client", "profile", "router", "share", "inspector"]
and not help_flag
):
# Check if active client is set
Expand Down
3 changes: 2 additions & 1 deletion src/mcpm/commands/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from mcpm.clients.client_config import ClientConfigManager
from mcpm.clients.client_registry import ClientRegistry
from mcpm.utils.display import print_client_error, print_error, print_server_config
from mcpm.utils.platform import NPX_CMD

console = Console()
client_config_manager = ClientConfigManager()
Expand Down Expand Up @@ -111,7 +112,7 @@ def edit_client():
basic_config = {
"mcpServers": {
"filesystem": {
"command": "npx",
"command": NPX_CMD,
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
Expand Down
6 changes: 4 additions & 2 deletions src/mcpm/commands/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from rich.console import Console
from rich.panel import Panel

from mcpm.utils.platform import NPX_CMD

console = Console()

# Define context settings to handle help flag properly
Expand Down Expand Up @@ -48,7 +50,7 @@ def inspector(args, yes):
if args:
# Pass all arguments directly to the inspector
arg_string = " ".join(args)
cmd = f"npx @modelcontextprotocol/inspector {arg_string}"
cmd = f"{NPX_CMD} @modelcontextprotocol/inspector {arg_string}"
console.print(f"[bold]Running MCPM Inspector with arguments:[/] {arg_string}")
else:
# No arguments provided, prompt for confirmation
Expand All @@ -59,7 +61,7 @@ def inspector(args, yes):
console.print("[yellow]Inspector cancelled.[/]")
return

cmd = "npx @modelcontextprotocol/inspector"
cmd = f"{NPX_CMD} @modelcontextprotocol/inspector"

console.print("[cyan]Starting MCPM Inspector...[/]")
console.print("The Inspector UI will open in your web browser.")
Expand Down
3 changes: 3 additions & 0 deletions src/mcpm/utils/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,6 @@ def get_frpc_directory(app_name: str = "mcpm") -> Path:

# Default to ~/.local/share if XDG_DATA_HOME is not defined
return Path.home() / ".local" / "share" / app_name / "frpc"


NPX_CMD = "npx" if sys.platform != "win32" else "npx.cmd"