_mcpctl() { local cur prev words cword _init_completion || return local commands="config status get describe instance instances apply setup claude project projects backup restore help" local global_opts="-v --version -o --output --daemon-url -h --help" local resources="servers profiles projects instances" case "${words[1]}" in config) COMPREPLY=($(compgen -W "view set path reset help" -- "$cur")) return ;; status) COMPREPLY=($(compgen -W "--daemon-url -h --help" -- "$cur")) return ;; get) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "$resources" -- "$cur")) else COMPREPLY=($(compgen -W "-o --output --daemon-url -h --help" -- "$cur")) fi return ;; describe) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "$resources" -- "$cur")) else COMPREPLY=($(compgen -W "-o --output --daemon-url -h --help" -- "$cur")) fi return ;; instance|instances) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "list ls start stop restart remove rm logs inspect help" -- "$cur")) else case "${words[2]}" in logs) COMPREPLY=($(compgen -W "--tail --since -h --help" -- "$cur")) ;; start) COMPREPLY=($(compgen -W "--env --image -h --help" -- "$cur")) ;; list|ls) COMPREPLY=($(compgen -W "--server-id -o --output -h --help" -- "$cur")) ;; esac fi return ;; claude) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "generate show add remove help" -- "$cur")) else case "${words[2]}" in generate|show|add|remove) COMPREPLY=($(compgen -W "--path -p -h --help" -- "$cur")) ;; esac fi return ;; project|projects) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "list ls create delete rm show profiles set-profiles help" -- "$cur")) else case "${words[2]}" in create) COMPREPLY=($(compgen -W "--description -d -h --help" -- "$cur")) ;; list|ls) COMPREPLY=($(compgen -W "-o --output -h --help" -- "$cur")) ;; esac fi return ;; apply) COMPREPLY=($(compgen -f -- "$cur")) return ;; backup) COMPREPLY=($(compgen -W "-o --output -p --password -r --resources -h --help" -- "$cur")) return ;; restore) COMPREPLY=($(compgen -W "-i --input -p --password -c --conflict -h --help" -- "$cur")) return ;; setup) return ;; help) COMPREPLY=($(compgen -W "$commands" -- "$cur")) return ;; esac if [[ $cword -eq 1 ]]; then COMPREPLY=($(compgen -W "$commands $global_opts" -- "$cur")) fi } complete -F _mcpctl mcpctl