use turul_mcp_aws_lambda::LambdaMcpServerBuilder;
use turul_mcp_derive::McpTool;
use turul_mcp_server::{McpResult, SessionContext};
#[derive(McpTool, Clone, Default)]
#[tool(name = "echo", description = "Echo back the provided message",
output = String
)]
struct EchoTool {
#[param(description = "Message to echo back")]
message: String,
}
impl EchoTool {
async fn execute(&self, _session: Option<SessionContext>) -> McpResult<String> {
Ok(format!("Echo: {}", self.message))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_target(false)
.without_time()
.init();
let server = LambdaMcpServerBuilder::new()
.name("echo-lambda-server")
.version("1.0.0")
.tool(EchoTool::default()) .sse(true) .cors_allow_all_origins() .build()
.await?;
let handler = server.handler().await?;
tracing::info!("🚀 Echo Lambda MCP server ready!");
tracing::info!("📋 Available tools: ping (built-in), echo (custom)");
turul_mcp_aws_lambda::run_streaming(handler).await
}