11import asyncio
2- import logging
32import json
3+ import logging
44import shutil
55
6- from mcp import ClientSession , StdioServerParameters
7- from mcp .client .stdio import stdio_client
86import click
7+ from mcp import ClientSession
8+ from mcp import StdioServerParameters
9+ from mcp .client .stdio import stdio_client
910
1011logging .basicConfig (level = logging .INFO )
1112
13+
1214# New mcp group
1315@click .group ()
1416def mcp ():
@@ -34,10 +36,7 @@ def create_mcp_proxy():
3436 # Process inputs first
3537 for input_def in mcp_config .get ("inputs" , []):
3638 input_id = input_def ["id" ]
37- inputs [input_id ] = click .prompt (
38- input_def .get ("description" , input_id ),
39- hide_input = input_def .get ("password" , False )
40- )
39+ inputs [input_id ] = click .prompt (input_def .get ("description" , input_id ), hide_input = input_def .get ("password" , False ))
4140
4241 # Process servers
4342 servers = mcp_config .get ("servers" , {})
@@ -55,14 +54,11 @@ def create_mcp_proxy():
5554 }
5655
5756 # Execute with processed parameters
58- output = asyncio .run (list_tools (
59- command = server_config ["command" ],
60- args = processed_args ,
61- env = processed_env
62- ))
57+ output = asyncio .run (list_tools (command = server_config ["command" ], args = processed_args , env = processed_env ))
6358 click .echo (f"\n Server: { server_name } " )
6459 click .echo (json .dumps (output , indent = 2 ))
6560
61+
6662async def list_tools (command : str , args : list [str ], env : dict [str , str ]):
6763 command_path = shutil .which (command )
6864 if not command_path :
0 commit comments