use super::*;
use rmcp::{ServiceExt, transport::stdio};
mod handler;
pub(crate) mod install;
pub(crate) mod params;
mod tools;
use handler::RailwayMcp;
#[derive(Parser)]
pub struct Args {
#[clap(subcommand)]
command: Option<Commands>,
}
#[derive(Parser)]
enum Commands {
Install(install::Args),
}
pub async fn command(args: Args) -> Result<()> {
match args.command {
None => serve_stdio().await,
Some(Commands::Install(install_args)) => install::command(install_args).await,
}
}
async fn serve_stdio() -> Result<()> {
let configs = Configs::new()?;
let client = GQLClient::new_authorized(&configs)?;
let handler = RailwayMcp::new(client, configs);
let service = handler
.serve(stdio())
.await
.context("Failed to start MCP server")?;
service.waiting().await?;
Ok(())
}