use mcp_tools::{
common::{McpServerBase, ServerConfig},
servers::GitToolsServer,
Result,
};
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().with_env_filter("info").init();
println!("Starting Basic MCP Server Example");
let config = ServerConfig {
name: "example-git-server".to_string(),
description: "Example Git Tools MCP Server".to_string(),
version: "1.0.0".to_string(),
host: "127.0.0.1".to_string(),
port: 8080,
max_connections: 10,
request_timeout_secs: 60,
log_requests: true,
server_config: HashMap::new(),
};
let mut server = GitToolsServer::new(config).await?;
server.initialize().await?;
let capabilities = server.get_capabilities().await?;
println!(
"Server initialized with {} tools:",
capabilities.tools.len()
);
for tool in &capabilities.tools {
println!(
" - {} ({}): {}",
tool.name, tool.category, tool.description
);
}
let stats = server.get_stats().await?;
println!("Server stats: {:?}", stats);
println!("Server is ready! In a real application, you would:");
println!("1. Start the MCP transport layer (HTTP/WebSocket/Stdio)");
println!("2. Handle incoming MCP requests");
println!("3. Route requests to the appropriate tools");
println!("4. Return responses to clients");
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
server.shutdown().await?;
println!("Server shutdown complete");
Ok(())
}