mcp_stdio_proxy/client/
cli.rs1use anyhow::{Result, bail};
6
7pub use crate::client::support::args::{Cli, Commands};
10
11pub async fn run_cli(cli: Cli) -> Result<()> {
18 match cli.command {
19 Some(Commands::Convert(args)) => {
20 crate::client::cli_impl::run_convert_command(args, cli.verbose, cli.quiet).await
21 }
22 Some(Commands::Check(args)) => {
23 crate::client::cli_impl::run_check_command(args, cli.verbose, cli.quiet).await
24 }
25 Some(Commands::Detect(args)) => {
26 crate::client::cli_impl::run_detect_command(args, cli.verbose, cli.quiet).await
27 }
28 Some(Commands::Proxy(args)) => {
29 super::proxy_server::run_proxy_command(args, cli.verbose, cli.quiet).await
30 }
31 None => {
32 if let Some(url) = cli.url {
34 let args = crate::client::support::args::ConvertArgs {
35 url: Some(url),
36 config: None,
37 config_file: None,
38 name: None,
39 protocol: None,
40 auth: None,
41 header: vec![],
42 retries: 0, allow_tools: None,
44 deny_tools: None,
45 ping_interval: 30, ping_timeout: 10, logging: crate::client::support::LoggingArgs {
48 diagnostic: true, log_dir: None, log_file: None, otlp_endpoint: None, service_name: "mcp-proxy".to_string(),
53 },
54 };
55 crate::client::cli_impl::run_convert_command(args, cli.verbose, cli.quiet).await
56 } else {
57 bail!("请提供 URL 或使用子命令")
58 }
59 }
60 }
61}