From b6276776fdfc19314ce73c9334285cf478243692 Mon Sep 17 00:00:00 2001 From: thibaud-lclr Date: Wed, 15 Apr 2026 10:59:23 +0200 Subject: [PATCH] feat(install): chain MCP configuration after setup --- install.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 209b2f2..40c04c5 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,9 @@ PROFILE_ENV="EMAIL_MCP_PROFILE" RELEASE_BASE_URL="https://gitea.lclr.dev" RELEASE_REPOSITORY="AI/email-mcp" INSTALLED_BINARY_PATH="" +PREFILL_SERVER_NAME="" +PREFILL_PROFILE_VALUE="" +PREFILL_COMMAND_PATH="" if [ -t 2 ] && [ -z "${NO_COLOR:-}" ]; then C_RESET="$(printf '\033[0m')" @@ -386,24 +389,32 @@ run_setup_wizard() { fi ui_info "Lancement de $BINARY_NAME setup" - if [ -r /dev/tty ] && [ -w /dev/tty ]; then + if [ -t 2 ] && [ -r /dev/tty ] && [ -w /dev/tty ]; then env "${PROFILE_ENV}=${profile}" "$binary_path" setup < /dev/tty > /dev/tty else env "${PROFILE_ENV}=${profile}" "$binary_path" setup fi ui_success "Setup termine pour le profil \"$profile\"." + + PREFILL_SERVER_NAME="$(sanitize_server_name "$BINARY_NAME")" + PREFILL_PROFILE_VALUE="$profile" + PREFILL_COMMAND_PATH="$binary_path" } collect_server_inputs() { local default_name - default_name="$(sanitize_server_name "$BINARY_NAME")" + default_name="$(sanitize_server_name "${PREFILL_SERVER_NAME:-$BINARY_NAME}")" SERVER_NAME="$(prompt "Nom du serveur MCP" "$default_name")" SERVER_NAME="$(sanitize_server_name "$SERVER_NAME")" - PROFILE_VALUE="$(prompt "Valeur de ${PROFILE_ENV}" "$DEFAULT_PROFILE")" + PROFILE_VALUE="$(prompt "Valeur de ${PROFILE_ENV}" "${PREFILL_PROFILE_VALUE:-$DEFAULT_PROFILE}")" local default_command - default_command="$(resolve_binary_path)" + if [ -n "${PREFILL_COMMAND_PATH:-}" ]; then + default_command="$PREFILL_COMMAND_PATH" + else + default_command="$(resolve_binary_path)" + fi COMMAND_PATH="$(prompt "Chemin du binaire serveur MCP" "$default_command")" } @@ -542,6 +553,34 @@ print_header() { printf "%bSelectionne une action dans le menu interactif.%b\n" "$C_DIM" "$C_RESET" >&2 } +post_setup_configure_mcp() { + ui_title "Configuration MCP apres setup" + local next_action + next_action="$(menu_select \ + "Configurer le MCP maintenant ?" \ + "Configurer Claude Code (apply direct)" \ + "Configurer Codex (apply direct)" \ + "Generer JSON MCP manuel" \ + "Terminer sans config MCP")" + printf "\n" >&2 + + case "$next_action" in + "Configurer Claude Code (apply direct)") + apply_claude_mcp + ;; + "Configurer Codex (apply direct)") + apply_codex_mcp + ;; + "Generer JSON MCP manuel") + ui_info "JSON MCP genere sur stdout." + print_mcp_json + ;; + *) + ui_info "Setup termine sans configuration MCP additionnelle." + ;; + esac +} + main() { print_header @@ -558,6 +597,7 @@ main() { case "$action" in "Installer/mettre a jour le binaire + setup") run_setup_wizard + post_setup_configure_mcp ;; "Configurer Claude Code (apply direct)") apply_claude_mcp