Skip to content

Commit a6a34e5

Browse files
committed
Clean up edit
1 parent 01050de commit a6a34e5

File tree

1 file changed

+11
-32
lines changed

1 file changed

+11
-32
lines changed

src/mcpm/commands/edit.py

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
console = Console()
1616

1717
@click.command()
18-
@click.option("--edit", is_flag=True, help="Open the active client's config in default editor")
19-
@click.option("--create", is_flag=True, help="Create a basic config file if it doesn't exist")
20-
def edit(edit, create):
18+
def edit():
2119
"""View or edit the active MCP client's configuration file.
2220
2321
The edit command operates on the currently active MCP client (set via 'mcpm client').
2422
By default, this is Claude Desktop, but can be changed to other supported clients.
2523
24+
The command will automatically display the config file content when it exists,
25+
and offer to create it when it doesn't exist. You'll also be prompted if you
26+
want to open the file in your default editor.
27+
2628
Examples:
27-
mcpm edit # Show current client's config file location and content
28-
mcpm edit --edit # Open the config file in your default editor
29-
mcpm edit --create # Create a basic config file if it doesn't exist
29+
mcpm edit # Show current client's config file and offer to edit it
3030
"""
3131
# Get the active client manager and related information
3232
client_manager = ClientRegistry.get_active_client_manager()
@@ -55,8 +55,8 @@ def edit(edit, create):
5555
console.print(f"[bold]{client_name} config file:[/] {config_path}")
5656
console.print(f"[bold]Status:[/] {'[green]Exists[/]' if config_exists else '[yellow]Does not exist[/]'}\n")
5757

58-
# Create config file if requested and it doesn't exist
59-
if not config_exists and create:
58+
# Create config file if it doesn't exist and user confirms
59+
if not config_exists:
6060
console.print(f"[bold yellow]Creating new {client_name} config file...[/]")
6161

6262
# Create a basic config template
@@ -136,31 +136,10 @@ def edit(edit, create):
136136
except Exception as e:
137137
console.print(f"[bold red]Error reading config file:[/] {str(e)}")
138138

139-
# Prompt to edit if file exists, or if we need to create it
140-
should_edit = edit
141-
if not should_edit and config_exists:
139+
# Prompt to edit if file exists
140+
should_edit = False
141+
if config_exists:
142142
should_edit = Confirm.ask("Would you like to open this file in your default editor?")
143-
elif not config_exists and not create:
144-
should_create = Confirm.ask("Config file doesn't exist. Would you like to create it?")
145-
if should_create:
146-
# Create a basic config template
147-
basic_config = {
148-
"mcpServers": {}
149-
}
150-
151-
# Create the directory if it doesn't exist
152-
os.makedirs(os.path.dirname(config_path), exist_ok=True)
153-
154-
# Write the template to file
155-
try:
156-
with open(config_path, 'w') as f:
157-
json.dump(basic_config, f, indent=2)
158-
console.print("[green]Successfully created config file![/]")
159-
should_edit = Confirm.ask("Would you like to open it in your default editor?")
160-
config_exists = True
161-
except Exception as e:
162-
console.print(f"[bold red]Error creating config file:[/] {str(e)}")
163-
return
164143

165144
# Open in default editor if requested
166145
if should_edit and config_exists:

0 commit comments

Comments
 (0)