feat: Continue Python environment setup even without API keys

Modified run-server.sh to allow developers to set up the Python development
environment without having API keys configured. This enables:

- Developers to clone and immediately start working on the codebase
- Running tests that don't require API calls
- Browsing and understanding the code structure
- Adding API keys later when ready to test MCP server functionality

Changes:
- Added new check_api_keys() function that warns but doesn't exit
- Changed print_error to print_warning for missing keys
- Updated main() to use check_api_keys instead of validate_api_keys || exit 1
- Kept original validate_api_keys() for backward compatibility

The script now shows a warning when API keys are missing but continues
with the full Python environment setup, dependencies installation, and
Claude configuration.
This commit is contained in:
Nate Parsons
2025-07-10 23:34:09 -07:00
parent ad6b216265
commit 2c979058e5

View File

@@ -1059,8 +1059,8 @@ migrate_env_file() {
echo " (Backup saved as .env.backup_*)" echo " (Backup saved as .env.backup_*)"
} }
# Validate API keys # Check API keys and warn if missing (non-blocking)
validate_api_keys() { check_api_keys() {
local has_key=false local has_key=false
local api_keys=( local api_keys=(
"GEMINI_API_KEY:your_gemini_api_key_here" "GEMINI_API_KEY:your_gemini_api_key_here"
@@ -1088,23 +1088,25 @@ validate_api_keys() {
fi fi
if [[ "$has_key" == false ]]; then if [[ "$has_key" == false ]]; then
print_error "No API keys found in .env!" print_warning "No API keys found in .env!"
echo "" >&2 echo ""
echo "Please edit .env and add at least one API key:" >&2 echo "The Python development environment will be set up, but you won't be able to use the MCP server until you add API keys."
echo " GEMINI_API_KEY=your-actual-key" >&2 echo ""
echo " OPENAI_API_KEY=your-actual-key" >&2 echo "To add API keys, edit .env and add at least one:"
echo " XAI_API_KEY=your-actual-key" >&2 echo " GEMINI_API_KEY=your-actual-key"
echo " DIAL_API_KEY=your-actual-key" >&2 echo " OPENAI_API_KEY=your-actual-key"
echo " OPENROUTER_API_KEY=your-actual-key" >&2 echo " XAI_API_KEY=your-actual-key"
echo "" >&2 echo " DIAL_API_KEY=your-actual-key"
print_info "After adding your API keys, run ./run-server.sh again" >&2 echo " OPENROUTER_API_KEY=your-actual-key"
echo "" >&2 echo ""
return 1 print_info "You can continue with development setup and add API keys later."
echo ""
fi fi
return 0 return 0 # Always return success to continue setup
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Claude Integration Functions # Claude Integration Functions
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -1623,8 +1625,8 @@ main() {
set +a set +a
fi fi
# Step 4: Validate API keys # Step 4: Check API keys (non-blocking - just warn if missing)
validate_api_keys || exit 1 check_api_keys
# Step 5: Setup Python environment (uv-first approach) # Step 5: Setup Python environment (uv-first approach)
local python_cmd local python_cmd
@@ -1652,7 +1654,7 @@ main() {
echo "Logs will be written to: $script_dir/$LOG_DIR/$LOG_FILE" echo "Logs will be written to: $script_dir/$LOG_DIR/$LOG_FILE"
echo "" echo ""
# Step 11: Handle command line arguments # Step 12: Handle command line arguments
if [[ "$arg" == "-f" ]] || [[ "$arg" == "--follow" ]]; then if [[ "$arg" == "-f" ]] || [[ "$arg" == "--follow" ]]; then
follow_logs follow_logs
else else