Skip to content

Commit 4cf1404

Browse files
committed
feat: prompt user to select server when multiple configured
1 parent 3aa8e71 commit 4cf1404

File tree

1 file changed

+17
-2
lines changed
  • src/datapilot/core/mcp_utils

1 file changed

+17
-2
lines changed

src/datapilot/core/mcp_utils/mcp.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,24 @@ def create_mcp_proxy():
5858
hide_input=input_def.get("password", False)
5959
)
6060

61-
# Process servers
61+
# Select server
6262
servers = mcp_config.get("servers", {})
63-
for server_name, server_config in servers.items():
63+
server_names = list(servers.keys())
64+
65+
if not server_names:
66+
raise click.UsageError("No servers configured in mcp config")
67+
68+
if len(server_names) > 1:
69+
server_name = click.prompt(
70+
"Choose a server",
71+
type=click.Choice(server_names),
72+
show_choices=True
73+
)
74+
else:
75+
server_name = server_names[0]
76+
77+
if server_name in servers:
78+
server_config = servers[server_name]
6479
# Replace input tokens in args
6580
processed_args = [
6681
inputs.get(arg[8:-1], arg) if isinstance(arg, str) and arg.startswith("${input:") else arg

0 commit comments

Comments
 (0)