Humanlearning commited on
Commit
06e607f
·
1 Parent(s): b749aa6

feat: add MCPClient for managing connections to MCP servers and modify app launch parameters.

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. src/credentialwatch_agent/mcp_client.py +12 -3
app.py CHANGED
@@ -7,4 +7,4 @@ sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
7
  from credentialwatch_agent.main import demo
8
 
9
  if __name__ == "__main__":
10
- demo.launch()
 
7
  from credentialwatch_agent.main import demo
8
 
9
  if __name__ == "__main__":
10
+ demo.launch(ssr_mode=False)
src/credentialwatch_agent/mcp_client.py CHANGED
@@ -39,7 +39,10 @@ class MCPClient:
39
  )
40
  await self._sessions["npi"].initialize()
41
  except Exception as e:
42
- print(f"Warning: Failed to connect to NPI MCP at {self.npi_url}. Using mock data. Error: {e}")
 
 
 
43
 
44
  # Connect to Cred DB MCP
45
  try:
@@ -49,7 +52,10 @@ class MCPClient:
49
  )
50
  await self._sessions["cred_db"].initialize()
51
  except Exception as e:
52
- print(f"Warning: Failed to connect to Cred DB MCP at {self.cred_db_url}. Using mock data. Error: {e}")
 
 
 
53
 
54
  # Connect to Alert MCP
55
  try:
@@ -59,7 +65,10 @@ class MCPClient:
59
  )
60
  await self._sessions["alert"].initialize()
61
  except Exception as e:
62
- print(f"Warning: Failed to connect to Alert MCP at {self.alert_url}. Using mock data. Error: {e}")
 
 
 
63
 
64
  self._connected = True
65
 
 
39
  )
40
  await self._sessions["npi"].initialize()
41
  except Exception as e:
42
+ import traceback
43
+ print(f"Warning: Failed to connect to NPI MCP at {self.npi_url}. Using mock data.")
44
+ print(f"Error details: {e}")
45
+ traceback.print_exc()
46
 
47
  # Connect to Cred DB MCP
48
  try:
 
52
  )
53
  await self._sessions["cred_db"].initialize()
54
  except Exception as e:
55
+ import traceback
56
+ print(f"Warning: Failed to connect to Cred DB MCP at {self.cred_db_url}. Using mock data.")
57
+ print(f"Error details: {e}")
58
+ traceback.print_exc()
59
 
60
  # Connect to Alert MCP
61
  try:
 
65
  )
66
  await self._sessions["alert"].initialize()
67
  except Exception as e:
68
+ import traceback
69
+ print(f"Warning: Failed to connect to Alert MCP at {self.alert_url}. Using mock data.")
70
+ print(f"Error details: {e}")
71
+ traceback.print_exc()
72
 
73
  self._connected = True
74