vtcode_core/mcp/cli/
mod.rs1mod args;
4mod auth;
5mod config_store;
6mod providers;
7mod resources;
8
9use anyhow::Result;
10pub use args::{
11 AddArgs, AddMcpStdioArgs, AddMcpStreamableHttpArgs, AddMcpTransportArgs, AppArgs, GetArgs, ListArgs, LoginArgs,
12 LogoutArgs, RemoveArgs, ResourcesArgs,
13};
14use clap::Subcommand;
15pub use config_store::set_global_config_path_override_for_tests;
16use std::path::Path;
17
18#[derive(Debug, Clone, Subcommand)]
20pub enum McpCommands {
21 List(ListArgs),
23
24 Get(GetArgs),
26
27 Add(AddArgs),
29
30 Remove(RemoveArgs),
32
33 Login(LoginArgs),
35
36 Logout(LogoutArgs),
38
39 Resources(ResourcesArgs),
41
42 App(AppArgs),
44}
45
46pub async fn handle_mcp_command(command: McpCommands, workspace: &Path) -> Result<()> {
48 match command {
49 McpCommands::List(args) => providers::run_list(args).await,
50 McpCommands::Get(args) => providers::run_get(args).await,
51 McpCommands::Add(args) => providers::run_add(args).await,
52 McpCommands::Remove(args) => providers::run_remove(args).await,
53 McpCommands::Login(args) => auth::run_login(args).await,
54 McpCommands::Logout(args) => auth::run_logout(args).await,
55 McpCommands::Resources(args) => resources::run_resources(args, workspace).await,
56 McpCommands::App(args) => resources::run_app(args, workspace).await,
57 }
58}