_mcpctl() { local cur prev words cword _init_completion || return local commands="status login logout config get describe delete logs create edit apply backup restore help" local global_opts="-v --version --daemon-url --direct -h --help" local resources="servers instances secrets templates projects users groups rbac" case "${words[1]}" in config) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "view set path reset claude-generate impersonate help" -- "$cur")) fi return ;; status) COMPREPLY=($(compgen -W "-h --help" -- "$cur")) return ;; login) COMPREPLY=($(compgen -W "--url --email --password -h --help" -- "$cur")) return ;; logout) return ;; get) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "$resources" -- "$cur")) else COMPREPLY=($(compgen -W "-o --output -h --help" -- "$cur")) fi return ;; describe) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "$resources" -- "$cur")) else COMPREPLY=($(compgen -W "-o --output --show-values -h --help" -- "$cur")) fi return ;; delete) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "$resources" -- "$cur")) fi return ;; edit) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "servers projects" -- "$cur")) fi return ;; logs) COMPREPLY=($(compgen -W "--tail --since -f --follow -h --help" -- "$cur")) return ;; create) if [[ $cword -eq 2 ]]; then COMPREPLY=($(compgen -W "server secret project user group rbac help" -- "$cur")) fi return ;; apply) COMPREPLY=($(compgen -f -- "$cur")) return ;; backup) COMPREPLY=($(compgen -W "-o --output -p --password -h --help" -- "$cur")) return ;; restore) COMPREPLY=($(compgen -W "-i --input -p --password -c --conflict -h --help" -- "$cur")) 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