Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 9 additions & 11 deletions src/mcpm/commands/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def edit(server_name, new, editor):

if isinstance(server_config, STDIOServerConfig):
table.add_row("Command", server_config.command)
table.add_row("Arguments", ", ".join(server_config.args) if server_config.args else "[dim]None[/]")
table.add_row("Arguments", " ".join(server_config.args) if server_config.args else "[dim]None[/]")
table.add_row(
"Environment",
", ".join(f"{k}={v}" for k, v in server_config.env.items()) if server_config.env else "[dim]None[/]",
Expand Down Expand Up @@ -187,10 +187,10 @@ def interactive_server_edit(server_config) -> Optional[Dict[str, Any]]:
keybindings={"interrupt": [{"key": "escape"}]},
).execute()

# Arguments as comma-separated string
current_args = ", ".join(server_config.args) if server_config.args else ""
# Arguments as space-separated string
current_args = " ".join(server_config.args) if server_config.args else ""
answers["args"] = inquirer.text(
message="Arguments (comma-separated):",
message="Arguments (space-separated):",
default=current_args,
instruction="(Leave empty for no arguments)",
keybindings={"interrupt": [{"key": "escape"}]},
Expand Down Expand Up @@ -237,7 +237,7 @@ def interactive_server_edit(server_config) -> Optional[Dict[str, Any]]:

if isinstance(server_config, STDIOServerConfig):
console.print(f"Command: [cyan]{server_config.command}[/] → [cyan]{answers['command']}[/]")
new_args = [arg.strip() for arg in answers["args"].split(",") if arg.strip()] if answers["args"] else []
new_args = answers["args"].split() if answers["args"] else []
console.print(f"Arguments: [cyan]{server_config.args}[/] → [cyan]{new_args}[/]")

new_env = {}
Expand Down Expand Up @@ -298,7 +298,7 @@ def apply_interactive_changes(server_config, interactive_result):

# Parse arguments
if answers["args"].strip():
server_config.args = [arg.strip() for arg in answers["args"].split(",") if arg.strip()]
server_config.args = answers["args"].split()
else:
server_config.args = []

Expand Down Expand Up @@ -381,9 +381,7 @@ def _create_new_server():
server_config = STDIOServerConfig(
name=server_name,
command=result["answers"]["command"],
args=[arg.strip() for arg in result["answers"]["args"].split(",") if arg.strip()]
if result["answers"]["args"]
else [],
args=result["answers"]["args"].split() if result["answers"]["args"] else [],
env={},
)

Expand Down Expand Up @@ -462,7 +460,7 @@ def _interactive_new_server_form() -> Optional[Dict[str, Any]]:
).execute()

answers["args"] = inquirer.text(
message="Arguments (comma-separated):",
message="Arguments (space-separated):",
instruction="(Leave empty for no arguments)",
keybindings={"interrupt": [{"key": "escape"}]},
).execute()
Expand Down Expand Up @@ -497,7 +495,7 @@ def _interactive_new_server_form() -> Optional[Dict[str, Any]]:

if answers["type"] == "stdio":
console.print(f"Command: [cyan]{answers['command']}[/]")
new_args = [arg.strip() for arg in answers["args"].split(",") if arg.strip()] if answers["args"] else []
new_args = answers["args"].split() if answers["args"] else []
console.print(f"Arguments: [cyan]{new_args}[/]")

new_env = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_edit_server_interactive_fallback(monkeypatch):
assert result.exit_code == 0 # CliRunner may not properly handle our return codes
assert "Current Configuration for 'test-server'" in result.output
assert "test-cmd" in result.output
assert "arg1, arg2" in result.output
assert "arg1 arg2" in result.output
assert "KEY=value" in result.output
assert "test-profile" in result.output
assert "Interactive editing not available" in result.output
Expand Down
Loading