MCPcopy Create free account
hub / github.com/IBM/mcp-cli / _chat_command

Function _chat_command

src/mcp_cli/main.py:470–732  ·  view source on GitHub ↗

Start chat mode (same as default behavior without subcommand).

(
    config_file: str = typer.Option(
        "server_config.json", help="Configuration file path"
    ),
    server: str | None = typer.Option(None, help="Server to connect to"),
    provider: str | None = typer.Option(None, help="LLM provider name"),
    model: str | None = typer.Option(None, help="Model name"),
    api_base: str | None = typer.Option(None, "--api-base", help="API base URL"),
    api_key: str | None = typer.Option(None, "--api-key", help="API key"),
    disable_filesystem: bool = typer.Option(False, help="Disable filesystem access"),
    quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"),
    verbose: bool = typer.Option(
        False, "-v", "--verbose", help="Enable verbose logging"
    ),
    log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"),
    theme: str = typer.Option(
        "default", "--theme", help="UI theme (default, dark, light, minimal, terminal)"
    ),
    confirm_mode: str = typer.Option(
        None,
        "--confirm-mode",
        help="Tool confirmation mode: always, never, or smart (risk-based)",
    ),
    init_timeout: float = typer.Option(
        120.0,
        "--init-timeout",
        help="Server initialization timeout in seconds",
    ),
    vm: bool = typer.Option(
        False,
        "--vm",
        help="[Experimental] Enable AI virtual memory for context management",
    ),
    vm_mode: str = typer.Option(
        "passive",
        "--vm-mode",
        help="VM mode: passive (runtime-managed), relaxed, or strict (model-driven paging)",
    ),
    vm_budget: int = typer.Option(
        128_000,
        "--vm-budget",
        help="Token budget for conversation events in VM mode (on top of system prompt)",
    ),
    health_interval: int = typer.Option(
        0,
        "--health-interval",
        help="Background server health check interval in seconds (0 = disabled)",
    ),
    plan_tools: bool = typer.Option(
        False,
        "--plan-tools",
        help="Enable plan_create/plan_execute as LLM-callable tools for autonomous multi-step planning",
    ),
    dashboard: bool = typer.Option(
        False,
        "--dashboard",
        help="Open browser dashboard alongside chat (requires: pip install mcp-cli[dashboard])",
    ),
    no_browser: bool = typer.Option(
        False,
        "--no-browser",
        help="Start dashboard server but do not auto-open the browser (prints URL instead)",
    ),
    dashboard_port: int = typer.Option(
        0,
        "--dashboard-port",
        help="Dashboard HTTP port (0 = auto-select starting at 9120)",
    ),
    multi_agent: bool = typer.Option(
        False,
        "--multi-agent",
        help="Enable multi-agent orchestration tools (agent_spawn, agent_stop, etc.). Implies --dashboard.",
    ),
    attach: list[str] | None = typer.Option(
        None,
        "--attach",
        help="Attach files to the first message (repeatable: --attach img.png --attach code.py).",
    ),
    no_tools: bool = typer.Option(
        False,
        "--no-tools",
        help="Disable tool calling — chat with the LLM directly without MCP tools.",
    ),
)

Source from the content-addressed store, hash-verified

468 help="Start chat mode (default behavior, provided for backward compatibility)",
469)
470def _chat_command(
471 config_file: str = typer.Option(
472 "server_config.json", help="Configuration file path"
473 ),
474 server: str | None = typer.Option(None, help="Server to connect to"),
475 provider: str | None = typer.Option(None, help="LLM provider name"),
476 model: str | None = typer.Option(None, help="Model name"),
477 api_base: str | None = typer.Option(None, "--api-base", help="API base URL"),
478 api_key: str | None = typer.Option(None, "--api-key", help="API key"),
479 disable_filesystem: bool = typer.Option(False, help="Disable filesystem access"),
480 quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"),
481 verbose: bool = typer.Option(
482 False, "-v", "--verbose", help="Enable verbose logging"
483 ),
484 log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"),
485 theme: str = typer.Option(
486 "default", "--theme", help="UI theme (default, dark, light, minimal, terminal)"
487 ),
488 confirm_mode: str = typer.Option(
489 None,
490 "--confirm-mode",
491 help="Tool confirmation mode: always, never, or smart (risk-based)",
492 ),
493 init_timeout: float = typer.Option(
494 120.0,
495 "--init-timeout",
496 help="Server initialization timeout in seconds",
497 ),
498 vm: bool = typer.Option(
499 False,
500 "--vm",
501 help="[Experimental] Enable AI virtual memory for context management",
502 ),
503 vm_mode: str = typer.Option(
504 "passive",
505 "--vm-mode",
506 help="VM mode: passive (runtime-managed), relaxed, or strict (model-driven paging)",
507 ),
508 vm_budget: int = typer.Option(
509 128_000,
510 "--vm-budget",
511 help="Token budget for conversation events in VM mode (on top of system prompt)",
512 ),
513 health_interval: int = typer.Option(
514 0,
515 "--health-interval",
516 help="Background server health check interval in seconds (0 = disabled)",
517 ),
518 plan_tools: bool = typer.Option(
519 False,
520 "--plan-tools",
521 help="Enable plan_create/plan_execute as LLM-callable tools for autonomous multi-step planning",
522 ),
523 dashboard: bool = typer.Option(
524 False,
525 "--dashboard",
526 help="Open browser dashboard alongside chat (requires: pip install mcp-cli[dashboard])",
527 ),

Callers

nothing calls this directly

Calls 15

add_runtime_providerMethod · 0.95
validate_providerMethod · 0.95
get_default_modelMethod · 0.95
get_active_providerMethod · 0.95
get_active_modelMethod · 0.95
setup_loggingFunction · 0.90
get_preference_managerFunction · 0.90
ModelManagerClass · 0.90
process_optionsFunction · 0.90
_start_chatFunction · 0.85

Tested by

no test coverage detected