From d29e1f78e6f271b5fbf9d256a534411e3d37eed4 Mon Sep 17 00:00:00 2001 From: giveen Date: Wed, 21 Jan 2026 11:15:21 -0700 Subject: [PATCH] tui: instantiate MCPManager at startup to auto-connect and register MCP tools --- pentestagent/interface/tui.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pentestagent/interface/tui.py b/pentestagent/interface/tui.py index a368a70..a7aefa4 100644 --- a/pentestagent/interface/tui.py +++ b/pentestagent/interface/tui.py @@ -1316,10 +1316,18 @@ class PentestAgentTUI(App): # MCP: automatic install/start has been removed. Operators should # run the scripts in `third_party/` manually to install and start # any vendored MCP servers (e.g., HexStrike, MetasploitMCP) and - # then configure `mcp_servers.json` accordingly. No automatic - # background installs or starts will be performed. - self.mcp_manager = None - mcp_server_count = 0 + # then configure `mcp_servers.json` accordingly. If a config is + # present, `MCPManager` will auto-connect and register tools so + # the TUI can display MCP-provided tools. + try: + from ..mcp import MCPManager + + self.mcp_manager = MCPManager() + # connected servers are available synchronously + mcp_server_count = len(self.mcp_manager.get_all_servers()) + except Exception: + self.mcp_manager = None + mcp_server_count = 0 # Runtime - Docker or Local if self.use_docker: