Skip to main content
Glama
install.sh7.32 kB
#!/bin/bash # GEP MCP Control Layer - Installation Script # # Author: Gary W. Floyd / Lumiea Systems Research Division # Date: December 2025 set -euo pipefail echo "============================================================================" echo "GEP-NATIVE MCP CONTROL LAYER - Installation" echo "Paper: Entropy-Guided Motor Control for Autonomous Tool Execution" echo "============================================================================" echo "" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # Check PostgreSQL if ! command -v psql &> /dev/null; then echo -e "${RED}✗ PostgreSQL not found${NC}" echo " Install: sudo apt-get install postgresql postgresql-contrib" exit 1 fi echo -e "${GREEN}✓ PostgreSQL found${NC}" # Check Python if ! command -v python3 &> /dev/null; then echo -e "${RED}✗ Python 3 not found${NC}" echo " Install: sudo apt-get install python3 python3-pip" exit 1 fi echo -e "${GREEN}✓ Python 3 found${NC}" # Check pgvector echo "" echo "Checking pgvector extension..." if ! psql -U postgres -d postgres -c "SELECT * FROM pg_extension WHERE extname='vector';" 2>/dev/null | grep -q vector; then echo -e "${YELLOW}! pgvector not installed${NC}" echo " Installing pgvector (this may require sudo)..." cd /tmp if [ ! -d "pgvector" ]; then git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git fi cd pgvector make clean make # Try with sudo first, fall back to user install if sudo make install 2>/dev/null; then echo -e "${GREEN}✓ pgvector installed (system)${NC}" elif make install 2>/dev/null; then echo -e "${GREEN}✓ pgvector installed (user)${NC}" else echo -e "${RED}✗ pgvector installation failed${NC}" echo " Try manually: cd /tmp/pgvector && sudo make install" exit 1 fi else echo -e "${GREEN}✓ pgvector already installed${NC}" fi # Install Python dependencies echo "" echo "Installing Python dependencies..." if pip3 install -r requirements.txt --break-system-packages 2>/dev/null; then echo -e "${GREEN}✓ Dependencies installed (system)${NC}" elif pip3 install -r requirements.txt 2>/dev/null; then echo -e "${GREEN}✓ Dependencies installed${NC}" else echo -e "${RED}✗ Failed to install Python dependencies${NC}" exit 1 fi # Database setup echo "" echo "Database Setup" echo "==============" read -p "PostgreSQL superuser [postgres]: " PG_USER PG_USER=${PG_USER:-postgres} read -sp "PostgreSQL superuser password (enter if none): " PG_PASS echo "" if [ -n "$PG_PASS" ]; then export PGPASSWORD="$PG_PASS" fi # Create database (skip if exists) echo "" echo "Creating database gep_mcp_v2..." if psql -U "$PG_USER" -lqt | cut -d \| -f 1 | grep -qw gep_mcp_v2; then echo -e "${YELLOW}! Database gep_mcp_v2 already exists${NC}" read -p "Drop and recreate? [y/N]: " DROP_DB if [[ "$DROP_DB" =~ ^[Yy]$ ]]; then psql -U "$PG_USER" -c "DROP DATABASE gep_mcp_v2;" || { echo -e "${RED}✗ Failed to drop database${NC}" exit 1 } psql -U "$PG_USER" -c "CREATE DATABASE gep_mcp_v2;" || { echo -e "${RED}✗ Failed to create database${NC}" exit 1 } echo -e "${GREEN}✓ Database recreated${NC}" else echo "Using existing database" fi else psql -U "$PG_USER" -c "CREATE DATABASE gep_mcp_v2;" || { echo -e "${RED}✗ Failed to create database${NC}" exit 1 } echo -e "${GREEN}✓ Database created${NC}" fi # Enable pgvector extension echo "Enabling pgvector extension..." psql -U "$PG_USER" -d gep_mcp_v2 -c "CREATE EXTENSION IF NOT EXISTS vector;" psql -U "$PG_USER" -d gep_mcp_v2 -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" # Run schema setup echo "Setting up schema and tables..." # The SQL file has CREATE DATABASE which will fail - filter that out grep -v "^CREATE DATABASE" gep_mcp_control_layer.sql | grep -v "^\\\\c gep_mcp_v2" | \ psql -U "$PG_USER" -d gep_mcp_v2 2>&1 | grep -v "already exists" | grep -v "does not exist" || true echo -e "${GREEN}✓ Schema setup complete${NC}" # Set role passwords echo "" echo "Role Configuration" echo "==================" echo "Enter passwords for database roles (used by the application)" echo "" read -sp "Password for nexus_mcp role (read/write): " MCP_PASS echo "" if [ -z "$MCP_PASS" ]; then echo -e "${RED}✗ nexus_mcp password required${NC}" exit 1 fi read -sp "Password for nexus_readonly role (read-only): " RO_PASS echo "" if [ -z "$RO_PASS" ]; then echo -e "${RED}✗ nexus_readonly password required${NC}" exit 1 fi psql -U "$PG_USER" -d gep_mcp_v2 -c "ALTER ROLE nexus_mcp PASSWORD '$MCP_PASS';" psql -U "$PG_USER" -d gep_mcp_v2 -c "ALTER ROLE nexus_readonly PASSWORD '$RO_PASS';" echo -e "${GREEN}✓ Roles configured${NC}" # Setup tool directory (prefer user directory to avoid sudo) echo "" echo "Tool Directory Setup" echo "====================" # Try user directory first TOOL_DIR="$HOME/.local/share/nexus/tools" mkdir -p "$TOOL_DIR" # Copy example tools if they exist if [ -f "sys_health.sh" ]; then cp sys_health.sh journal_tail.sh config_update.sh "$TOOL_DIR/" 2>/dev/null || true chmod +x "$TOOL_DIR"/*.sh 2>/dev/null || true echo -e "${GREEN}✓ Example tools installed to $TOOL_DIR${NC}" else echo -e "${YELLOW}! Example tool scripts not found in current directory${NC}" fi # Update intent embeddings echo "" echo "Generating Intent Embeddings" echo "=============================" python3 gep_mcp_motor.py \ --db "postgresql://nexus_mcp:${MCP_PASS}@localhost/gep_mcp_v2" \ --update-embeddings echo -e "${GREEN}✓ Intent embeddings generated${NC}" # Create config file cat > gep_mcp_config.env <<EOF # GEP MCP Control Layer Configuration # Generated: $(date) # Author: Gary W. Floyd / Lumiea Systems Research Division # Database connection export GEP_DB_HOST=localhost export GEP_DB_PORT=5432 export GEP_DB_NAME=gep_mcp_v2 export GEP_DB_USER=nexus_mcp export GEP_DB_PASS='${MCP_PASS}' # Connection string export GEP_DB_CONN="postgresql://nexus_mcp:${MCP_PASS}@localhost/gep_mcp_v2" # Tool directory export GEP_TOOL_DIR="${TOOL_DIR}" EOF chmod 600 gep_mcp_config.env echo "" echo "============================================================================" echo -e "${GREEN}Installation Complete!${NC}" echo "============================================================================" echo "" echo "Configuration: gep_mcp_config.env (chmod 600 for security)" echo "Tools: $TOOL_DIR" echo "" echo "Next Steps:" echo " 1. Source config:" echo " source gep_mcp_config.env" echo "" echo " 2. Test installation:" echo " python3 gep_mcp_motor.py --db \"\$GEP_DB_CONN\" --stats" echo "" echo " 3. Run test execution:" echo " python3 gep_mcp_motor.py --db \"\$GEP_DB_CONN\" --test" echo "" echo " 4. Use in Python:" echo " from gep_mcp_motor import GEPMotorNeuron" echo " motor = GEPMotorNeuron(\"\$GEP_DB_CONN\")" echo "" echo "Paper: \"Entropy-Guided Motor Control for Autonomous Tool Execution\"" echo "Author: Gary W. Floyd / Lumiea Systems Research Division" echo "============================================================================"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/darkt22002/gep-mcp-motor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server