use anyhow::Result;
use tracing::{error, info};
use crate::mcp::MCPServer;
pub async fn run_mcp_interface() -> Result<()> {
info!("🤖 Starting MCP interface (HTTP client mode)");
let http_base_url =
std::env::var("HTTP_BASE_URL").unwrap_or_else(|_| "http://localhost:8080".to_string());
let l402_token = std::env::var("HTTP_L402_TOKEN").ok();
if l402_token.is_some() {
info!("✅ L402 token configured for paywalled endpoints");
} else {
info!("⚠️ No L402 token configured - endpoints may require payment");
}
info!("🌐 HTTP base URL: {}", http_base_url);
let mcp_server = MCPServer::new(http_base_url, l402_token);
info!("✅ MCP interface ready - listening on stdio transport");
info!(" All tool calls will be proxied to HTTP endpoints");
if let Err(e) = mcp_server.run().await {
error!("❌ MCP interface error: {}", e);
return Err(e);
}
Ok(())
}