@@ -45,19 +45,6 @@ def create_mcp_proxy():
4545 inputs = {}
4646 mcp_config = config .get ("mcp" , {})
4747
48- # Collect all input IDs from config and server templates
49- input_ids = set ()
50- input_ids .update (find_input_tokens (mcp_config .get ("servers" , {})))
51- input_ids .update (input_def ["id" ] for input_def in mcp_config .get ("inputs" , []))
52-
53- # Create prompt definitions merging config and discovered inputs
54- for input_id in input_ids :
55- input_def = next ((d for d in mcp_config .get ("inputs" , []) if d ["id" ] == input_id ), {})
56- inputs [input_id ] = click .prompt (
57- input_def .get ("description" , input_id ),
58- hide_input = input_def .get ("password" , False )
59- )
60-
6148 # Select server
6249 servers = mcp_config .get ("servers" , {})
6350 server_names = list (servers .keys ())
@@ -76,6 +63,23 @@ def create_mcp_proxy():
7663
7764 if server_name in servers :
7865 server_config = servers [server_name ]
66+
67+ # Collect input tokens ONLY from this server's config
68+ input_ids = find_input_tokens (server_config .get ("args" , []))
69+ input_ids .update (find_input_tokens (server_config .get ("env" , {})))
70+
71+ # Create prompt definitions using BOTH discovered tokens AND configured inputs
72+ existing_input_ids = {i ["id" ] for i in mcp_config .get ("inputs" , [])}
73+ inputs_to_prompt = input_ids .intersection (existing_input_ids )
74+ inputs_to_prompt .update (input_ids ) # Add any undiscovered-by-config inputs
75+
76+ for input_id in inputs_to_prompt :
77+ input_def = next ((d for d in mcp_config .get ("inputs" , []) if d ["id" ] == input_id ), {})
78+ inputs [input_id ] = click .prompt (
79+ input_def .get ("description" , input_id ),
80+ hide_input = input_def .get ("password" , False ),
81+ )
82+
7983 # Replace input tokens in args
8084 processed_args = [
8185 inputs .get (arg [8 :- 1 ], arg ) if isinstance (arg , str ) and arg .startswith ("${input:" ) else arg
0 commit comments