Columbia MCP Server

#!/bin/bash # Check if required argument is provided if [ "$#" -lt 1 ]; then echo "Usage: $0 <server_path>" echo "Example: $0 services/ai/minimax" exit 1 fi SERVER_PATH=$1 RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Function to check if a file exists check_file() { if [ -f "$1" ]; then echo -e "${GREEN}✓${NC} Found $2" return 0 else echo -e "${RED}✗${NC} Missing $2" return 1 fi } # Function to check if a directory exists check_dir() { if [ -d "$1" ]; then echo -e "${GREEN}✓${NC} Found $2" return 0 else echo -e "${RED}✗${NC} Missing $2" return 1 fi } # Function to check package.json contents check_package_json() { local pkg_file="$SERVER_PATH/package.json" if [ ! -f "$pkg_file" ]; then return 1 fi echo "Checking package.json configuration..." # Check if package name follows convention local name=$(node -p "require('$pkg_file').name") if [[ $name == @columbia-mcp/* ]]; then echo -e "${GREEN}✓${NC} Package name follows convention: $name" else echo -e "${RED}✗${NC} Package name should start with @columbia-mcp/" fi # Check required scripts local scripts=("build" "test" "lint" "clean") for script in "${scripts[@]}"; do if node -e "process.exit(require('$pkg_file').scripts['$script'] ? 0 : 1)" 2>/dev/null; then echo -e "${GREEN}✓${NC} Found script: $script" else echo -e "${RED}✗${NC} Missing script: $script" fi done } # Function to check TypeScript configuration check_tsconfig() { local tsconfig_file="$SERVER_PATH/tsconfig.json" if [ ! -f "$tsconfig_file" ]; then return 1 fi echo "Checking TypeScript configuration..." # Check if extends base config if grep -q '"extends": "../../tsconfig.json"' "$tsconfig_file"; then echo -e "${GREEN}✓${NC} Extends base tsconfig.json" else echo -e "${RED}✗${NC} Should extend base tsconfig.json" fi } # Main verification process echo "Verifying server setup in $SERVER_PATH..." # Check required files check_file "$SERVER_PATH/package.json" "package.json" check_file "$SERVER_PATH/tsconfig.json" "tsconfig.json" check_file "$SERVER_PATH/jest.config.js" "jest.config.js" check_file "$SERVER_PATH/README.md" "README.md" # Check required directories check_dir "$SERVER_PATH/src" "src directory" check_dir "$SERVER_PATH/tests" "tests directory" # Check package.json configuration check_package_json # Check TypeScript configuration check_tsconfig # Check source files if [ -d "$SERVER_PATH/src" ]; then if [ -f "$SERVER_PATH/src/index.ts" ]; then echo -e "${GREEN}✓${NC} Found main entry point (index.ts)" else echo -e "${RED}✗${NC} Missing main entry point (index.ts)" fi if [ -f "$SERVER_PATH/src/types.ts" ]; then echo -e "${GREEN}✓${NC} Found type definitions (types.ts)" else echo -e "${YELLOW}!${NC} Consider adding type definitions (types.ts)" fi fi # Check test files if [ -d "$SERVER_PATH/tests" ]; then if [ -f "$SERVER_PATH/tests/setup.ts" ]; then echo -e "${GREEN}✓${NC} Found test setup file" else echo -e "${YELLOW}!${NC} Consider adding test setup file" fi if ls "$SERVER_PATH/tests"/**/*.test.ts 1> /dev/null 2>&1; then echo -e "${GREEN}✓${NC} Found test files" else echo -e "${RED}✗${NC} No test files found" fi fi # Try to build the server echo -e "\nAttempting to build server..." (cd "$SERVER_PATH" && npm run build 2>/dev/null) if [ $? -eq 0 ]; then echo -e "${GREEN}✓${NC} Build successful" else echo -e "${RED}✗${NC} Build failed" fi echo -e "\nVerification complete!"