MCPcopy Create free account
hub / github.com/modelscope/ms-agent / connect

Method connect

ms_agent/tools/tool_manager.py:141–155  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

139 self.extra_tools.append(tool)
140
141 async def connect(self):
142 if self.mcp_client and isinstance(self.mcp_client, MCPClient):
143 self.servers = self.mcp_client
144 await self.servers.add_mcp_config(self.mcp_config)
145 self.mcp_config = self.servers.mcp_config
146 else:
147 self.servers = MCPClient(self.mcp_config, self.config)
148 await self.servers.connect()
149 for tool in self.extra_tools:
150 await tool.connect()
151 await self.reindex_tool()
152
153 # Initialize concurrency limiter
154 self._concurrent_limiter = asyncio.Semaphore(MAX_CONCURRENT_TOOLS)
155 logger.info(f'Tool concurrency limit set to {MAX_CONCURRENT_TOOLS}')
156
157 async def cleanup(self):
158 if self._managed_client and self.servers:

Callers 1

mainMethod · 0.95

Calls 3

reindex_toolMethod · 0.95
MCPClientClass · 0.90
add_mcp_configMethod · 0.80

Tested by 1

mainMethod · 0.76