qudag_cli/mcp/
mod.rs

1//! MCP (Model Context Protocol) server management module
2
3use crate::CliError;
4use std::path::PathBuf;
5
6pub mod config;
7pub mod server;
8
9pub use config::*;
10pub use server::*;
11
12/// Handle MCP server start command
13pub async fn handle_mcp_start(
14    bind: String,
15    transport: String,
16    config: Option<PathBuf>,
17    verbose: bool,
18    background: bool,
19) -> Result<(), CliError> {
20    if background {
21        start_mcp_server_background(bind, transport, config, verbose).await
22    } else {
23        start_mcp_server_foreground(bind, transport, config, verbose).await
24    }
25}
26
27/// Handle MCP server stop command
28pub async fn handle_mcp_stop(force: bool) -> Result<(), CliError> {
29    stop_mcp_server(force).await
30}
31
32/// Handle MCP server status command
33pub async fn handle_mcp_status() -> Result<(), CliError> {
34    show_mcp_server_status().await
35}
36
37/// Handle MCP config show command
38pub async fn handle_mcp_config_show() -> Result<(), CliError> {
39    show_mcp_config().await
40}
41
42/// Handle MCP config init command
43pub async fn handle_mcp_config_init(output: Option<PathBuf>, force: bool) -> Result<(), CliError> {
44    init_mcp_config(output, force).await
45}
46
47/// Handle MCP config validate command
48pub async fn handle_mcp_config_validate(config_path: PathBuf) -> Result<(), CliError> {
49    validate_mcp_config(config_path).await
50}
51
52/// Handle MCP tools list command
53pub async fn handle_mcp_tools() -> Result<(), CliError> {
54    list_mcp_tools().await
55}
56
57/// Handle MCP resources list command
58pub async fn handle_mcp_resources() -> Result<(), CliError> {
59    list_mcp_resources().await
60}
61
62/// Handle MCP server test command
63pub async fn handle_mcp_test(endpoint: String) -> Result<(), CliError> {
64    test_mcp_server(endpoint).await
65}