#!/bin/bash
echo "========================================"
echo "Apollo.io MCP Server Verification"
echo "========================================"
echo ""
# Check Node.js
echo "1. Checking Node.js version..."
if command -v node &> /dev/null; then
NODE_VERSION=$(node --version)
echo " ✓ Node.js installed: $NODE_VERSION"
# Extract major version
MAJOR_VERSION=$(echo $NODE_VERSION | cut -d'.' -f1 | sed 's/v//')
if [ "$MAJOR_VERSION" -ge 18 ]; then
echo " ✓ Version is 18 or higher"
else
echo " ✗ Warning: Node.js 18+ recommended (you have $NODE_VERSION)"
fi
else
echo " ✗ Node.js not found. Please install Node.js 18+"
exit 1
fi
echo ""
# Check if we're in the right directory
echo "2. Checking project structure..."
if [ -f "package.json" ]; then
echo " ✓ package.json found"
else
echo " ✗ package.json not found. Are you in the apollo.io-mcp directory?"
exit 1
fi
echo ""
# Check dependencies
echo "3. Checking dependencies..."
if [ -d "node_modules" ]; then
echo " ✓ node_modules directory exists"
else
echo " ✗ node_modules not found. Running 'npm install'..."
npm install
fi
echo ""
# Check build
echo "4. Checking build..."
if [ -f "build/index.js" ]; then
echo " ✓ build/index.js exists"
# Check if executable
if [ -x "build/index.js" ]; then
echo " ✓ build/index.js is executable"
else
echo " ⚠ build/index.js not executable. Making it executable..."
chmod +x build/index.js
echo " ✓ Fixed"
fi
else
echo " ✗ build/index.js not found. Running 'npm run build'..."
npm run build
chmod +x build/index.js
fi
echo ""
# Show absolute path
echo "5. Absolute path for configuration:"
ABSOLUTE_PATH=$(pwd)
echo " $ABSOLUTE_PATH/build/index.js"
echo ""
# Check API key
echo "6. Checking API key..."
if [ -z "$APOLLO_API_KEY" ]; then
echo " ⚠ APOLLO_API_KEY environment variable not set"
echo " This is OK - it should be set in claude_desktop_config.json"
else
echo " ✓ APOLLO_API_KEY is set (length: ${#APOLLO_API_KEY} characters)"
fi
echo ""
# Test server startup
echo "7. Testing server startup..."
if [ -z "$APOLLO_API_KEY" ]; then
# Use a dummy key for testing
export APOLLO_API_KEY="test_key_for_verification"
echo " Using dummy API key for test..."
fi
# Try to start server with timeout
timeout 2 node build/index.js 2>&1 | head -5 &
PID=$!
sleep 1
if ps -p $PID > /dev/null 2>&1; then
echo " ✓ Server started successfully"
kill $PID 2>/dev/null
else
echo " ✓ Server ran (may have exited normally)"
fi
echo ""
# Configuration template
echo "========================================"
echo "Configuration for Claude Desktop"
echo "========================================"
echo ""
echo "Add this to your claude_desktop_config.json:"
echo ""
cat << EOF
{
"mcpServers": {
"apollo": {
"command": "node",
"args": [
"$ABSOLUTE_PATH/build/index.js"
],
"env": {
"APOLLO_API_KEY": "your_apollo_api_key_here"
}
}
}
}
EOF
echo ""
echo "Config file locations:"
echo " macOS: ~/Library/Application Support/Claude/claude_desktop_config.json"
echo " Windows: %APPDATA%\\Claude\\claude_desktop_config.json"
echo ""
echo "Get your API key from:"
echo " https://app.apollo.io/#/settings/integrations/api"
echo ""
echo "========================================"
echo "Verification Complete!"
echo "========================================"
echo ""
echo "Next steps:"
echo "1. Get your Apollo.io API key (see URL above)"
echo "2. Add the configuration to claude_desktop_config.json"
echo "3. Replace 'your_apollo_api_key_here' with your actual key"
echo "4. Restart Claude Desktop"
echo ""
echo "For troubleshooting, see: TROUBLESHOOTING.md"