Skip to content

Commit 98c674c

Browse files
committed
show all loaded MCP servers on app startup
1 parent 3c64e42 commit 98c674c

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ fn main() -> Result<()> {
2626
tracing_subscriber::EnvFilter::from_default_env()
2727
.add_directive(tracing::Level::WARN.into()),
2828
)
29+
.without_time()
2930
.init();
3031

3132
let cli = Cli::parse();

src/mcp/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl StdioClient {
116116
cmd.args(&args)
117117
.stdin(Stdio::piped())
118118
.stdout(Stdio::piped())
119-
.stderr(Stdio::inherit());
119+
.stderr(Stdio::null());
120120

121121
for (key, value) in env_vars {
122122
cmd.env(key, value);

src/mcp/manager.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::error::{Result, SofosError};
22
use crate::mcp::client::McpClient;
33
use crate::mcp::config::load_mcp_config;
44
use crate::mcp::protocol::{CallToolResult, ToolContent};
5+
use colored::Colorize;
56
use std::collections::HashMap;
67
use std::path::PathBuf;
78
use std::sync::Arc;
@@ -26,12 +27,19 @@ impl McpManager {
2627
// Get tools from this server
2728
match client.list_tools().await {
2829
Ok(tools) => {
30+
let tool_count = tools.len();
2931
for tool in tools {
3032
// Prefix tool name with server name to avoid conflicts
3133
let prefixed_name = format!("{}_{}", server_name, tool.name);
3234
tool_to_server.insert(prefixed_name, server_name.clone());
3335
}
3436
clients.insert(server_name.clone(), client);
37+
println!(
38+
"{} MCP server '{}' initialized ({} tools)",
39+
"✓".bright_green(),
40+
server_name.bright_cyan(),
41+
tool_count
42+
);
3543
}
3644
Err(e) => {
3745
eprintln!(
@@ -102,17 +110,14 @@ impl McpManager {
102110
SofosError::McpError(format!("MCP server '{}' not connected", server_name))
103111
})?;
104112

105-
// Extract the original tool name (remove server prefix)
106113
let original_tool_name = tool_name
107114
.strip_prefix(&format!("{}_", server_name))
108115
.unwrap_or(tool_name);
109116

110-
// Call the tool
111117
let result = client
112118
.call_tool(original_tool_name, Some(input.clone()))
113119
.await?;
114120

115-
// Format the result
116121
Ok(format_tool_result(result))
117122
}
118123

src/repl/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ impl Repl {
8282

8383
let mcp_manager = runtime.block_on(async {
8484
match McpManager::new(workspace.clone()).await {
85-
Ok(manager) => {
86-
println!("{}", "MCP servers initialized".bright_green());
87-
Some(manager)
88-
}
85+
Ok(manager) => Some(manager),
8986
Err(e) => {
9087
eprintln!("Warning: Failed to initialize MCP manager: {}", e);
9188
None

0 commit comments

Comments
 (0)