feat(gui): Integrate External MCPs into Operations Hub with status indicators

This commit is contained in:
2026-03-12 15:54:52 -04:00
parent 828fadf829
commit 3b2588ad61
3 changed files with 71 additions and 1 deletions

View File

@@ -925,12 +925,14 @@ class StdioMCPServer:
self.tools = {}
self._id_counter = 0
self._pending_requests = {}
self.status = 'idle'
def _get_id(self):
self._id_counter += 1
return self._id_counter
async def start(self):
self.status = 'starting'
self.proc = await asyncio.create_subprocess_exec(
self.config.command,
*self.config.args,
@@ -940,6 +942,7 @@ class StdioMCPServer:
)
asyncio.create_task(self._read_stderr())
await self.list_tools()
self.status = 'running'
async def stop(self):
if self.proc:
@@ -955,6 +958,7 @@ class StdioMCPServer:
except Exception:
pass
self.proc = None
self.status = 'idle'
async def _read_stderr(self):
while self.proc and not self.proc.stdout.at_eof():
@@ -1015,9 +1019,12 @@ class ExternalMCPManager:
all_tools = {}
for sname, server in self.servers.items():
for tname, tool in server.tools.items():
all_tools[tname] = {**tool, 'server': sname}
all_tools[tname] = {**tool, 'server': sname, 'server_status': server.status}
return all_tools
def get_servers_status(self) -> dict[str, str]:
return {name: server.status for name, server in self.servers.items()}
async def async_dispatch(self, tool_name: str, tool_input: dict) -> str:
for server in self.servers.values():
if tool_name in server.tools: