mod args;
mod auth;
mod config_store;
mod providers;
mod resources;
use anyhow::Result;
pub use args::{
AddArgs, AddMcpStdioArgs, AddMcpStreamableHttpArgs, AddMcpTransportArgs, AppArgs, GetArgs, ListArgs, LoginArgs,
LogoutArgs, RemoveArgs, ResourcesArgs,
};
use clap::Subcommand;
pub use config_store::set_global_config_path_override_for_tests;
use std::path::Path;
#[derive(Debug, Clone, Subcommand)]
pub enum McpCommands {
List(ListArgs),
Get(GetArgs),
Add(AddArgs),
Remove(RemoveArgs),
Login(LoginArgs),
Logout(LogoutArgs),
Resources(ResourcesArgs),
App(AppArgs),
}
pub async fn handle_mcp_command(command: McpCommands, workspace: &Path) -> Result<()> {
match command {
McpCommands::List(args) => providers::run_list(args).await,
McpCommands::Get(args) => providers::run_get(args).await,
McpCommands::Add(args) => providers::run_add(args).await,
McpCommands::Remove(args) => providers::run_remove(args).await,
McpCommands::Login(args) => auth::run_login(args).await,
McpCommands::Logout(args) => auth::run_logout(args).await,
McpCommands::Resources(args) => resources::run_resources(args, workspace).await,
McpCommands::App(args) => resources::run_app(args, workspace).await,
}
}