feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
_mcpctl() {
|
|
|
|
|
local cur prev words cword
|
|
|
|
|
_init_completion || return
|
|
|
|
|
|
2026-02-23 12:00:31 +00:00
|
|
|
local commands="status login logout config get describe delete logs create edit apply backup restore help"
|
2026-02-23 19:08:29 +00:00
|
|
|
local project_commands="attach-server detach-server get describe delete logs create edit help"
|
|
|
|
|
local global_opts="-v --version --daemon-url --direct --project -h --help"
|
2026-02-23 12:00:31 +00:00
|
|
|
local resources="servers instances secrets templates projects users groups rbac"
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
|
2026-02-23 19:08:29 +00:00
|
|
|
# Check if --project was given
|
|
|
|
|
local has_project=false
|
|
|
|
|
local i
|
|
|
|
|
for ((i=1; i < cword; i++)); do
|
|
|
|
|
if [[ "${words[i]}" == "--project" ]]; then
|
|
|
|
|
has_project=true
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Find the first subcommand (skip --project and its argument, skip flags)
|
|
|
|
|
local subcmd=""
|
|
|
|
|
local subcmd_pos=0
|
|
|
|
|
for ((i=1; i < cword; i++)); do
|
|
|
|
|
if [[ "${words[i]}" == "--project" || "${words[i]}" == "--daemon-url" ]]; then
|
|
|
|
|
((i++)) # skip the argument
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
if [[ "${words[i]}" != -* ]]; then
|
|
|
|
|
subcmd="${words[i]}"
|
|
|
|
|
subcmd_pos=$i
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Find the resource type after get/describe/delete/edit
|
|
|
|
|
local resource_type=""
|
|
|
|
|
if [[ -n "$subcmd_pos" ]] && [[ $subcmd_pos -gt 0 ]]; then
|
|
|
|
|
for ((i=subcmd_pos+1; i < cword; i++)); do
|
|
|
|
|
if [[ "${words[i]}" != -* ]] && [[ " $resources " == *" ${words[i]} "* ]]; then
|
|
|
|
|
resource_type="${words[i]}"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# If completing the --project value
|
|
|
|
|
if [[ "$prev" == "--project" ]]; then
|
|
|
|
|
local names
|
2026-02-23 19:23:21 +00:00
|
|
|
names=$(mcpctl get projects -o json 2>/dev/null | jq -r '.[].name' 2>/dev/null)
|
2026-02-23 19:08:29 +00:00
|
|
|
COMPREPLY=($(compgen -W "$names" -- "$cur"))
|
|
|
|
|
return
|
|
|
|
|
fi
|
|
|
|
|
|
2026-02-23 19:23:21 +00:00
|
|
|
# Fetch resource names dynamically (jq extracts only top-level names)
|
2026-02-23 19:08:29 +00:00
|
|
|
_mcpctl_resource_names() {
|
|
|
|
|
local rt="$1"
|
|
|
|
|
if [[ -n "$rt" ]]; then
|
2026-02-23 19:23:21 +00:00
|
|
|
mcpctl get "$rt" -o json 2>/dev/null | jq -r '.[].name' 2>/dev/null
|
2026-02-23 19:08:29 +00:00
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case "$subcmd" in
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
config)
|
2026-02-23 19:08:29 +00:00
|
|
|
if [[ $((cword - subcmd_pos)) -eq 1 ]]; then
|
2026-02-23 12:00:31 +00:00
|
|
|
COMPREPLY=($(compgen -W "view set path reset claude-generate impersonate help" -- "$cur"))
|
|
|
|
|
fi
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
return ;;
|
|
|
|
|
status)
|
2026-02-23 12:00:31 +00:00
|
|
|
COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
|
|
|
|
|
return ;;
|
|
|
|
|
login)
|
|
|
|
|
COMPREPLY=($(compgen -W "--url --email --password -h --help" -- "$cur"))
|
|
|
|
|
return ;;
|
|
|
|
|
logout)
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
return ;;
|
2026-02-23 19:08:29 +00:00
|
|
|
get|describe|delete)
|
|
|
|
|
if [[ -z "$resource_type" ]]; then
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
COMPREPLY=($(compgen -W "$resources" -- "$cur"))
|
|
|
|
|
else
|
2026-02-23 19:08:29 +00:00
|
|
|
local names
|
|
|
|
|
names=$(_mcpctl_resource_names "$resource_type")
|
|
|
|
|
COMPREPLY=($(compgen -W "$names -o --output -h --help" -- "$cur"))
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
fi
|
|
|
|
|
return ;;
|
2026-02-23 12:00:31 +00:00
|
|
|
edit)
|
2026-02-23 19:08:29 +00:00
|
|
|
if [[ -z "$resource_type" ]]; then
|
2026-02-23 12:00:31 +00:00
|
|
|
COMPREPLY=($(compgen -W "servers projects" -- "$cur"))
|
2026-02-23 19:08:29 +00:00
|
|
|
else
|
|
|
|
|
local names
|
|
|
|
|
names=$(_mcpctl_resource_names "$resource_type")
|
|
|
|
|
COMPREPLY=($(compgen -W "$names -h --help" -- "$cur"))
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
fi
|
|
|
|
|
return ;;
|
2026-02-23 12:00:31 +00:00
|
|
|
logs)
|
|
|
|
|
COMPREPLY=($(compgen -W "--tail --since -f --follow -h --help" -- "$cur"))
|
|
|
|
|
return ;;
|
|
|
|
|
create)
|
2026-02-23 19:08:29 +00:00
|
|
|
if [[ $((cword - subcmd_pos)) -eq 1 ]]; then
|
2026-02-23 12:00:31 +00:00
|
|
|
COMPREPLY=($(compgen -W "server secret project user group rbac help" -- "$cur"))
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
fi
|
|
|
|
|
return ;;
|
|
|
|
|
apply)
|
|
|
|
|
COMPREPLY=($(compgen -f -- "$cur"))
|
|
|
|
|
return ;;
|
|
|
|
|
backup)
|
2026-02-23 12:00:31 +00:00
|
|
|
COMPREPLY=($(compgen -W "-o --output -p --password -h --help" -- "$cur"))
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
return ;;
|
|
|
|
|
restore)
|
|
|
|
|
COMPREPLY=($(compgen -W "-i --input -p --password -c --conflict -h --help" -- "$cur"))
|
|
|
|
|
return ;;
|
2026-02-23 19:08:29 +00:00
|
|
|
attach-server|detach-server)
|
|
|
|
|
local names
|
|
|
|
|
names=$(_mcpctl_resource_names "servers")
|
|
|
|
|
COMPREPLY=($(compgen -W "$names" -- "$cur"))
|
|
|
|
|
return ;;
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
help)
|
|
|
|
|
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
|
|
|
|
|
return ;;
|
|
|
|
|
esac
|
|
|
|
|
|
2026-02-23 19:08:29 +00:00
|
|
|
# No subcommand yet — offer commands based on context
|
|
|
|
|
if [[ -z "$subcmd" ]]; then
|
|
|
|
|
if $has_project; then
|
|
|
|
|
COMPREPLY=($(compgen -W "$project_commands $global_opts" -- "$cur"))
|
|
|
|
|
else
|
|
|
|
|
COMPREPLY=($(compgen -W "$commands $global_opts" -- "$cur"))
|
|
|
|
|
fi
|
feat: implement v2 3-tier architecture (mcpctl → mcplocal → mcpd)
- Rename local-proxy to mcplocal with HTTP server, LLM pipeline, mcpd discovery
- Add LLM pre-processing: token estimation, filter cache, metrics, Gemini CLI + DeepSeek providers
- Add mcpd auth (login/logout) and MCP proxy endpoints
- Update CLI: dual URLs (mcplocalUrl/mcpdUrl), auth commands, --direct flag
- Add tiered health monitoring, shell completions, e2e integration tests
- 57 test files, 597 tests passing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:42:06 +00:00
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
complete -F _mcpctl mcpctl
|