Skip to content

Commit 298a7a7

Browse files
feat: support alias for server
1 parent 8caafe8 commit 298a7a7

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

mcp-registry/servers/youtube.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
},
1313
"license": "MIT",
1414
"categories": [
15-
"youtube",
16-
"api"
15+
"Youtube",
16+
"API"
1717
],
1818
"tags": [
1919
"youtube",
@@ -34,13 +34,6 @@
3434
}
3535
}
3636
},
37-
"examples": [
38-
{
39-
"title": "Managing Videos",
40-
"description": "Example code for managing videos using the YouTube MCP Server.",
41-
"prompt": "// Get video details\nconst video = await youtube.videos.getVideo({\n videoId: \"video-id\"\n});"
42-
}
43-
],
4437
"arguments": {
4538
"YOUTUBE_API_KEY": {
4639
"description": "Your YouTube Data API key, needed for authentication when making requests to the YouTube API.",

src/mcpm/commands/add.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
@click.command()
2222
@click.argument("server_name")
2323
@click.option("--force", is_flag=True, help="Force reinstall if server is already installed")
24-
def add(server_name, force=False):
24+
@click.option("--alias", help="Alias for the server", required=False)
25+
def add(server_name, force=False, alias=None):
2526
"""Add an MCP server to a client configuration.
2627
2728
Examples:
2829
mcpm add time
2930
mcpm add everything --force
31+
mcpm add youtube --alias yt
3032
"""
3133
# Get the active client info
3234
client = ClientRegistry.get_active_client()
@@ -42,10 +44,12 @@ def add(server_name, force=False):
4244
console.print(f"[bold red]Error:[/] Unsupported client '{client}'.")
4345
return
4446

47+
config_name = alias or server_name
48+
4549
# Check if server already exists in client config
46-
existing_server = client_manager.get_server(server_name)
50+
existing_server = client_manager.get_server(config_name)
4751
if existing_server and not force:
48-
console.print(f"[yellow]Server '{server_name}' is already added to {client}.[/]")
52+
console.print(f"[yellow]Server '{config_name}' is already added to {client}.[/]")
4953
console.print("Use '--force' to overwrite the existing configuration.")
5054
return
5155

@@ -74,7 +78,7 @@ def add(server_name, force=False):
7478
client_display_name = client_info.get("name", client)
7579

7680
# Confirm addition
77-
if not force and not Confirm.ask(f"Add this server to {client_display_name}?"):
81+
if not force and not Confirm.ask(f"Add this server to {client_display_name}{' as ' + alias if alias else ''}?"):
7882
console.print("[yellow]Operation cancelled.[/]")
7983
return
8084

@@ -310,7 +314,7 @@ def add(server_name, force=False):
310314

311315
# Create server configuration using ServerConfig
312316
server_config = ServerConfig(
313-
name=server_name,
317+
name=config_name,
314318
display_name=display_name,
315319
description=description,
316320
command=mcp_command, # Use the actual MCP server command

0 commit comments

Comments
 (0)