mcp.run(transport='stdio') 再建一个client.py程序 importasynciofromtypingimportOptionalfromcontextlibimportAsyncExitStackfrommcpimportClientSession,StdioServerParametersfrommcp.client.stdioimportstdio_clientfromanthr
# Lines 111-219 of `MCPClient.add_mcp_server`# https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/inference/_mcp/mcp_client.py#L111:L219classMCPClient:...asyncdefadd_mcp_server(self,type:ServerType,**params:Any):# 'type' can be "stdio", "sse", or "http"...
client = OpenAI(api_key=self.openai_api_key, base_url=self.base_url) 25 + self.session: Optional[ClientSession] = None 26 + 27 + async def connect_to_server(self, server_script_path: str): 28 + # 对服务器脚本进行判断,只允许是 .py 或 .js 29 + is_python = server_script_path...