refactor: organize scripts into scripts/ directory

Move utility scripts to dedicated scripts/ directory for better project
organization:
- BuildAll.sh
- CleanVendor.sh
- CloneVendorRepos.sh
- StatusCheck.sh
- validate-mcp.sh

Remove temporary build-nextcloud-mcp.sh as nextcloud-mcp is now built.
This commit is contained in:
2026-01-22 18:02:56 -05:00
parent 3c0565d0e9
commit 7c583e2821
6 changed files with 1 additions and 25 deletions

44
scripts/BuildAll.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# BuildAll.sh
# Script to build all MCP/LSP services in KNEL-AIMiddleware
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${GREEN}=== KNEL-AIMiddleware Build Script ===${NC}"
echo ""
echo "Building all services..."
echo ""
# Change to project directory
cd "$(dirname "${BASH_SOURCE[0]}")"
# Get list of all services from docker-compose.yml
SERVICES=$(docker compose config --services)
# Build each service
for SERVICE in $SERVICES; do
echo -e "${BLUE}Building: ${SERVICE}${NC}"
if docker compose build "$SERVICE" 2>&1 | tail -5; then
echo -e "${GREEN}${NC} Successfully built $SERVICE"
else
echo -e "${RED}${NC} Failed to build $SERVICE"
echo -e "${YELLOW}Continuing with next service...${NC}"
fi
echo ""
done
echo -e "${GREEN}=== Build complete! ===${NC}"
echo ""
echo "To start all services:"
echo " docker compose up -d --profile dev"
echo ""
echo "To check status:"
echo " docker ps"

49
scripts/CleanVendor.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
# CleanVendor.sh
# Script to remove all cloned vendor repositories
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${YELLOW}=== KNEL-AIMiddleware Vendor Cleanup Script ===${NC}"
echo ""
echo -e "${RED}WARNING: This will DELETE all cloned vendor repositories!${NC}"
echo ""
read -p "Are you sure you want to continue? (yes/no): " CONFIRM
if [ "$CONFIRM" != "yes" ]; then
echo "Aborted."
exit 0
fi
# Vendor directory
VENDOR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/vendor"
echo ""
echo "Removing vendor directories..."
echo ""
# Count removed
COUNT=0
# Remove all directories in vendor/ except .gitkeep
for DIR in "$VENDOR_DIR"/*; do
if [ -d "$DIR" ]; then
DIRNAME=$(basename "$DIR")
echo -e "${RED}[DELETE]${NC} $DIRNAME"
rm -rf "$DIR"
((COUNT++))
fi
done
echo ""
echo -e "${GREEN}=== Cleanup complete! Removed $COUNT directories ===${NC}"
echo ""
echo "To re-clone repositories, run:"
echo " ./CloneVendorRepos.sh"

86
scripts/CloneVendorRepos.sh Executable file
View File

@@ -0,0 +1,86 @@
#!/bin/bash
# CloneVendorRepos.sh
# Script to clone all vendor MCP/LSP repositories for KNEL-AIMiddleware
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Vendor directory
VENDOR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/vendor"
echo -e "${GREEN}=== KNEL-AIMiddleware Vendor Repository Clone Script ===${NC}"
echo ""
echo "Vendor directory: $VENDOR_DIR"
echo ""
# Check if vendor directory exists
if [ ! -d "$VENDOR_DIR" ]; then
echo -e "${YELLOW}Creating vendor directory...${NC}"
mkdir -p "$VENDOR_DIR"
fi
# Clone repositories (using subshell to avoid associative array issues)
clone_repo() {
local dir_name="$1"
local repo_url="$2"
local target_dir="$VENDOR_DIR/$dir_name"
if [ -d "$target_dir" ]; then
echo -e "${YELLOW}[SKIP]${NC} $dir_name (already exists)"
else
echo -e "${GREEN}[CLONE]${NC} $dir_name from $repo_url"
git clone --depth 1 "$repo_url" "$target_dir"
if [ $? -eq 0 ]; then
echo -e "${GREEN}${NC} Successfully cloned $dir_name"
else
echo -e "${RED}${NC} Failed to clone $dir_name"
return 1
fi
fi
echo ""
}
# Clone all repositories
clone_repo "KiCAD-MCP-Server" "https://github.com/mixelpixx/KiCAD-MCP-Server.git"
clone_repo "blender-mcp" "https://github.com/ahujasid/blender-mcp.git"
clone_repo "freecad-mcp" "https://github.com/ahujasid/freecad-mcp.git"
clone_repo "context7" "https://github.com/upstash/context7.git"
clone_repo "gimp-mcp" "https://github.com/ahujasid/gimp-mcp.git"
clone_repo "bash-language-server" "https://github.com/bash-lsp/bash-language-server.git"
clone_repo "docker-language-server" "https://github.com/rcjsuen/docker-language-server.git"
clone_repo "marksman" "https://github.com/artempyanykh/marksman.git"
clone_repo "drawio-mcp-server" "https://github.com/ahujasid/drawio-mcp-server.git"
clone_repo "matomo-mcp-client" "https://github.com/ahujasid/matomo-mcp-client.git"
clone_repo "imap-mcp" "https://github.com/ahujasid/imap-mcp.git"
clone_repo "mcp-redmine" "https://github.com/ahujasid/mcp-redmine.git"
clone_repo "ghost-mcp" "https://github.com/ahujasid/ghost-mcp.git"
clone_repo "discourse-mcp" "https://github.com/ahujasid/discourse-mcp.git"
clone_repo "mcp-cloudron" "https://github.com/ahujasid/mcp-cloudron.git"
clone_repo "postizz-MCP" "https://github.com/ahujasid/postizz-MCP.git"
clone_repo "snipeit-mcp" "https://github.com/ahujasid/snipeit-mcp.git"
clone_repo "nextcloud-mcp-server" "https://github.com/ahujasid/nextcloud-mcp-server.git"
clone_repo "docspace-mcp" "https://github.com/ahujasid/docspace-mcp.git"
clone_repo "docker-mcp" "https://github.com/ahujasid/docker-mcp.git"
clone_repo "kubernetes-mcp-server" "https://github.com/ahujasid/kubernetes-mcp-server.git"
clone_repo "ProxmoxMCP" "https://github.com/ahujasid/ProxmoxMCP.git"
clone_repo "terraform-mcp-server" "https://github.com/ahujasid/terraform-mcp-server.git"
clone_repo "mcp-ansible" "https://github.com/ahujasid/mcp-ansible.git"
clone_repo "mcp-server" "https://github.com/Bitwarden/clients.git"
clone_repo "mcp-adapter" "https://github.com/ahujasid/mcp-adapter.git"
clone_repo "audiobook-mcp-server" "https://github.com/ahujasid/audiobook-mcp-server.git"
clone_repo "mcp-server-elasticsearch" "https://github.com/ahujasid/mcp-server-elasticsearch.git"
clone_repo "penpot-mcp" "https://github.com/ahujasid/penpot-mcp.git"
echo -e "${GREEN}=== All repositories cloned successfully! ===${NC}"
echo ""
echo "Next steps:"
echo " 1. Review and configure environment variables in .env"
echo " 2. Build and test services: docker compose build <service-name>"
echo " 3. Start services: docker compose up -d --profile dev"

65
scripts/StatusCheck.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
# StatusCheck.sh
# Script to check build status of all MCP/LSP services
set -e # Exit on error
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}=== KNEL-AIMiddleware Service Status Check ===${NC}"
echo ""
# Change to project directory
cd "$(dirname "${BASH_SOURCE[0]}")"
# Get list of all services from docker-compose.yml
SERVICES=$(docker compose config --services | sort)
# Counters
TOTAL=0
BUILT=0
NOT_BUILT=0
echo "Checking Docker images for all services..."
echo ""
for SERVICE in $SERVICES; do
TOTAL=$((TOTAL + 1))
# Construct expected image name
IMAGE_NAME="kneldevstack-aimiddleware-$SERVICE"
# Check if image exists
if docker images --format '{{.Repository}}' | grep -q "^${IMAGE_NAME}$"; then
echo -e "${GREEN}${NC} $SERVICE (image exists)"
BUILT=$((BUILT + 1))
else
echo -e "${RED}${NC} $SERVICE (not built)"
NOT_BUILT=$((NOT_BUILT + 1))
fi
done
echo ""
echo -e "${BLUE}=== Summary ===${NC}"
echo -e "Total services: $TOTAL"
echo -e "${GREEN}Built: $BUILT${NC}"
echo -e "${RED}Not built: $NOT_BUILT${NC}"
echo ""
# Show STATUS.md
if [ -f "STATUS.md" ]; then
echo -e "${BLUE}=== STATUS.md Summary ===${NC}"
grep -c "Built" STATUS.md | xargs -I {} echo -e "${GREEN}Built: {}${NC}"
grep -c "Pending" STATUS.md | xargs -I {} echo -e "${YELLOW}Pending: {}${NC}"
echo ""
fi
echo "Next steps:"
echo " - To build missing services: docker compose build <service-name>"
echo " - To build all services: ./BuildAll.sh"
echo " - To view detailed status: cat STATUS.md"

103
scripts/validate-mcp.sh Executable file
View File

@@ -0,0 +1,103 @@
#!/bin/bash
# MCP Server Validation Script
# Tests each MCP server with actual protocol messages
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Initialize JSON message
INIT_MSG='{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"protocolVersion":"2024-11-05","clientInfo":{"name":"test","version":"1.0.0"}},"id":1}'
# Test a container with initialize message
test_mcp_server() {
local container_name=$1
local timeout=${2:-10}
shift 2
local env_vars=("$@")
echo -e "${YELLOW}Testing $container_name...${NC}"
# Build environment arguments
local env_args=""
for env_var in "${env_vars[@]}"; do
env_args="$env_args -e $env_var"
done
# Run container with stdin input and environment variables
# Note: Using subshell with timeout for the docker run command
result=$( (echo "$INIT_MSG" | timeout $timeout docker run --rm -i --name "$container_name-test" $env_args "$container_name" 2>&1) || true )
# Check for valid JSON-RPC response
if echo "$result" | grep -q '"result"'; then
# Check if it has server info
if echo "$result" | grep -q '"serverInfo"'; then
server_name=$(echo "$result" | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)
version=$(echo "$result" | grep -o '"version":"[^"]*"' | head -1 | cut -d'"' -f4)
echo -e "${GREEN}$container_name: Working ($server_name v${version})${NC}"
return 0
fi
fi
# Check if server requires environment variables
if echo "$result" | grep -qi "environment variable"; then
echo -e "${YELLOW}$container_name: Needs environment variables${NC}"
return 1
fi
# Check if server needs external service
if echo "$result" | grep -qi "connection refused\|not connected"; then
echo -e "${YELLOW}$container_name: Needs external service (expected)${NC}"
return 1
fi
# Check other errors
echo -e "${RED}$container_name: Failed${NC}"
echo -e "${RED} Error: $(echo "$result" | head -3 | tail -1)${NC}"
return 1
}
# Test all built containers
echo -e "${YELLOW}=== MCP Server Validation ===${NC}\n"
# Stdio-based MCP servers
test_mcp_server "kneldevstack-aimiddleware-ghost-mcp" 5 \
"GHOST_API_URL=https://ghost.example.com" \
"GHOST_ADMIN_API_KEY=012345678901234567890123:0123456789012345678901234567890123456789012345678901234567890123"
test_mcp_server "kneldevstack-aimiddleware-penpot-mcp" 5 \
"PENPOT_URL=https://design.penpot.app" \
"PENPOT_TOKEN=dummy-token"
test_mcp_server "kneldevstack-aimiddleware-imap-mcp" 5 \
"IMAP_HOST=imap.example.com" \
"IMAP_USERNAME=user@example.com" \
"IMAP_PASSWORD=dummy-password"
test_mcp_server "kneldevstack-aimiddleware-proxmox-mcp" 5 \
"PROXMOX_HOST=https://proxmox.example.com" \
"PROXMOX_USER=root@pam" \
"PROXMOX_TOKEN=dummy-token" \
"PROXMOX_NODE=pve"
test_mcp_server "kneldevstack-aimiddleware-context7-mcp" 5
test_mcp_server "kneldevstack-aimiddleware-docker-mcp" 5
test_mcp_server "kneldevstack-aimiddleware-drawio-mcp" 5
test_mcp_server "kneldevstack-aimiddleware-mcp-redmine" 5 \
"REDMINE_URL=https://redmine.example.com" \
"REDMINE_API_KEY=dummy-key"
# HTTP-based MCP servers
echo -e "${YELLOW}Testing nextcloud-mcp (HTTP endpoint)...${NC}"
result=$(timeout 5 curl -s http://localhost:8083/health/live 2>&1 || echo "Connection failed")
if echo "$result" | grep -q "200 OK\|healthy"; then
echo -e "${GREEN}✓ nextcloud-mcp (HTTP): Running on http://localhost:8083${NC}"
else
echo -e "${YELLOW}⚠ nextcloud-mcp (HTTP): Not running or unhealthy${NC}"
fi
echo -e "\n${YELLOW}=== Validation Complete ===${NC}"