Initial commit: MCP Hub Community Edition v3.0.0

Community edition generated from private repo via sync pipeline.
Includes 9 plugins (WordPress, WooCommerce, WP Advanced, Gitea, n8n,
Supabase, OpenPanel, Appwrite, Directus) with ~587 tools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
airano
2026-02-17 08:34:44 +03:30
commit cf62e65c55
237 changed files with 87596 additions and 0 deletions

172
scripts/deploy.sh Normal file
View File

@@ -0,0 +1,172 @@
#!/bin/bash
# ============================================
# MCP Hub - Deployment Script
# ============================================
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
print_header() {
echo ""
echo -e "${BLUE}═══════════════════════════════════════${NC}"
echo -e "${BLUE} ${1}${NC}"
echo -e "${BLUE}═══════════════════════════════════════${NC}"
echo ""
}
print_info() {
echo -e "${BLUE} ${1}${NC}"
}
print_success() {
echo -e "${GREEN}${1}${NC}"
}
print_warning() {
echo -e "${YELLOW}${1}${NC}"
}
print_error() {
echo -e "${RED}${1}${NC}"
}
# Parse arguments
DEPLOY_MODE=${1:-production}
print_header "MCP Hub Deployment"
# Check if Docker is available
if ! command -v docker &> /dev/null; then
print_error "Docker is not installed"
exit 1
fi
if ! docker compose version &> /dev/null; then
print_error "Docker Compose is not available"
exit 1
fi
# Check if .env exists
if [ ! -f ".env" ]; then
print_error ".env file not found"
print_info "Please create .env file from .env.example:"
echo " cp .env.example .env"
echo " nano .env"
exit 1
fi
case "$DEPLOY_MODE" in
production|prod)
print_info "Deploying in production mode..."
# Run tests first
print_info "Running tests..."
if ./scripts/test.sh quick no > /dev/null 2>&1; then
print_success "Tests passed"
else
print_error "Tests failed. Aborting deployment."
exit 1
fi
# Build and deploy
print_info "Building Docker images..."
docker compose build --no-cache
print_info "Starting containers..."
docker compose up -d
# Wait for health check
print_info "Waiting for health check..."
sleep 5
if docker compose ps | grep -q "Up"; then
print_success "Containers are running"
# Show logs
print_info "Recent logs:"
docker compose logs --tail=20
print_success "Deployment completed!"
echo ""
echo "Container status:"
docker compose ps
echo ""
echo "To view logs: docker compose logs -f"
echo "To stop: docker compose down"
else
print_error "Deployment failed. Checking logs..."
docker compose logs --tail=50
exit 1
fi
;;
development|dev)
print_info "Starting development environment..."
docker compose up --build
;;
stop)
print_info "Stopping containers..."
docker compose down
print_success "Containers stopped"
;;
restart)
print_info "Restarting containers..."
docker compose restart
print_success "Containers restarted"
;;
logs)
print_info "Showing logs..."
docker compose logs -f
;;
status)
print_info "Container status:"
docker compose ps
echo ""
docker compose exec mcp-server curl -s http://localhost:8000/health | python -m json.tool 2>/dev/null || echo "Health check failed"
;;
clean)
print_warning "This will remove all containers, images, and volumes"
read -p "Are you sure? (yes/no): " -r
if [ "$REPLY" = "yes" ]; then
docker compose down -v --rmi all
print_success "Cleaned up successfully"
else
print_info "Cancelled"
fi
;;
*)
print_error "Unknown deployment mode: $DEPLOY_MODE"
echo ""
echo "Usage: ./scripts/deploy.sh [MODE]"
echo ""
echo "Modes:"
echo " production|prod - Deploy in production mode (default)"
echo " development|dev - Start development environment"
echo " stop - Stop running containers"
echo " restart - Restart containers"
echo " logs - View container logs"
echo " status - Show container status and health"
echo " clean - Remove all containers and images"
echo ""
echo "Examples:"
echo " ./scripts/deploy.sh"
echo " ./scripts/deploy.sh dev"
echo " ./scripts/deploy.sh stop"
echo " ./scripts/deploy.sh logs"
exit 1
;;
esac

60
scripts/dev.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
# ============================================
# MCP Hub - Development Server
# ============================================
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${BLUE}════════════════════════════════════${NC}"
echo -e "${BLUE} MCP Hub - Dev Server${NC}"
echo -e "${BLUE}════════════════════════════════════${NC}"
echo ""
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo -e "${YELLOW}⚠ Virtual environment not found${NC}"
echo "Run: ./scripts/setup.sh"
exit 1
fi
# Activate virtual environment
if [ -z "$VIRTUAL_ENV" ]; then
echo -e "${BLUE} Activating virtual environment...${NC}"
source venv/bin/activate
fi
# Check if .env exists
if [ ! -f ".env" ]; then
echo -e "${YELLOW}⚠ .env file not found${NC}"
if [ -f ".env.example" ]; then
echo -e "${BLUE} Creating .env from .env.example...${NC}"
cp .env.example .env
echo -e "${YELLOW}⚠ Please edit .env with your credentials${NC}"
echo " nano .env"
exit 1
else
echo -e "${RED}✗ .env.example not found${NC}"
exit 1
fi
fi
# Create logs directory if it doesn't exist
mkdir -p logs
# Start development server
echo -e "${GREEN}✓ Starting development server...${NC}"
echo ""
echo -e "${BLUE}Press Ctrl+C to stop${NC}"
echo ""
# Run with auto-reload if available
if command -v watchmedo &> /dev/null; then
watchmedo auto-restart --directory=./src --pattern=*.py --recursive -- python src/main.py
else
python src/main.py
fi

191
scripts/setup.ps1 Normal file
View File

@@ -0,0 +1,191 @@
# ============================================
# MCP Hub - Setup Script (Windows)
# ============================================
# Requires -Version 5.0
$ErrorActionPreference = "Stop"
# Colors
function Write-Info {
Write-Host " $args" -ForegroundColor Blue
}
function Write-Success {
Write-Host "$args" -ForegroundColor Green
}
function Write-Warning {
Write-Host "$args" -ForegroundColor Yellow
}
function Write-Error {
Write-Host "$args" -ForegroundColor Red
}
function Write-Header {
param([string]$Message)
Write-Host ""
Write-Host "═══════════════════════════════════════" -ForegroundColor Blue
Write-Host " $Message" -ForegroundColor Blue
Write-Host "═══════════════════════════════════════" -ForegroundColor Blue
Write-Host ""
}
# Check if command exists
function Test-Command {
param([string]$Command)
$null -ne (Get-Command $Command -ErrorAction SilentlyContinue)
}
# Main setup
function Main {
Write-Header "MCP Hub Setup"
# 1. Check Python version
Write-Info "Checking Python version..."
if (-not (Test-Command python)) {
Write-Error "Python is not installed. Please install Python 3.11 or higher."
Write-Host "Download from: https://www.python.org/downloads/"
exit 1
}
$pythonVersion = python --version 2>&1
if ($pythonVersion -match "Python (\d+)\.(\d+)\.(\d+)") {
$major = [int]$matches[1]
$minor = [int]$matches[2]
if (($major -lt 3) -or (($major -eq 3) -and ($minor -lt 11))) {
Write-Error "Python 3.11+ is required. Found: $pythonVersion"
exit 1
}
Write-Success "Python $pythonVersion found"
} else {
Write-Error "Could not determine Python version"
exit 1
}
# 2. Check Docker
Write-Info "Checking Docker..."
if (Test-Command docker) {
$dockerVersion = docker --version
Write-Success "Docker found: $dockerVersion"
} else {
Write-Warning "Docker not found. Docker is optional but recommended for deployment."
Write-Host "Download from: https://www.docker.com/products/docker-desktop"
}
# 3. Check Docker Compose
Write-Info "Checking Docker Compose..."
if ((Test-Command docker) -and (docker compose version 2>&1)) {
$composeVersion = docker compose version --short
Write-Success "Docker Compose $composeVersion found"
} else {
Write-Warning "Docker Compose not found. Required for Docker deployment."
}
# 4. Create virtual environment
Write-Info "Creating virtual environment..."
if (Test-Path "venv") {
Write-Warning "Virtual environment already exists. Skipping creation."
} else {
python -m venv venv
Write-Success "Virtual environment created"
}
# 5. Activate virtual environment
Write-Info "Activating virtual environment..."
& ".\venv\Scripts\Activate.ps1"
Write-Success "Virtual environment activated"
# 6. Upgrade pip
Write-Info "Upgrading pip..."
python -m pip install --upgrade pip --quiet
Write-Success "pip upgraded"
# 7. Install dependencies
Write-Info "Installing dependencies..."
if (Test-Path "requirements.txt") {
pip install -r requirements.txt --quiet
Write-Success "Dependencies installed"
} else {
Write-Error "requirements.txt not found"
exit 1
}
# 8. Install development dependencies
Write-Info "Installing development dependencies..."
pip install pytest pytest-asyncio pytest-cov pytest-mock black ruff mypy --quiet
Write-Success "Development dependencies installed"
# 9. Setup environment file
Write-Info "Setting up environment file..."
if (Test-Path ".env") {
Write-Warning ".env file already exists. Skipping creation."
Write-Warning "Please ensure your .env file is properly configured."
} else {
if (Test-Path ".env.example") {
Copy-Item ".env.example" ".env"
Write-Success ".env file created from .env.example"
Write-Warning "Please edit .env file with your WordPress credentials."
} else {
Write-Error ".env.example not found"
exit 1
}
}
# 10. Create logs directory
Write-Info "Creating logs directory..."
if (-not (Test-Path "logs")) {
New-Item -ItemType Directory -Path "logs" | Out-Null
}
Write-Success "Logs directory ready"
# 11. Run tests (optional)
Write-Info "Running tests..."
try {
$testResult = pytest -q 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Success "All tests passed!"
} else {
Write-Warning "Some tests failed. Please check the output above."
}
} catch {
Write-Warning "Could not run tests. pytest may not be available."
}
# 12. Final instructions
Write-Header "Setup Complete!"
Write-Success "Setup completed successfully!"
Write-Host ""
Write-Host "Next steps:" -ForegroundColor White
Write-Host ""
Write-Host "1. Edit the .env file with your credentials:"
Write-Host " notepad .env" -ForegroundColor Blue
Write-Host ""
Write-Host "2. Activate the virtual environment:"
Write-Host " .\venv\Scripts\Activate.ps1" -ForegroundColor Blue
Write-Host ""
Write-Host "3. Run the MCP server:"
Write-Host " python src/main.py" -ForegroundColor Blue
Write-Host ""
Write-Host "4. Or deploy with Docker:"
Write-Host " docker compose up -d" -ForegroundColor Blue
Write-Host ""
Write-Host "5. Run tests:"
Write-Host " pytest --cov" -ForegroundColor Blue
Write-Host ""
Write-Host "For more information, visit:"
Write-Host "https://github.com/mcphub/mcphub" -ForegroundColor Blue
Write-Host ""
}
# Run main function
try {
Main
} catch {
Write-Error "Setup failed: $_"
exit 1
}

181
scripts/setup.sh Normal file
View File

@@ -0,0 +1,181 @@
#!/bin/bash
# ============================================
# MCP Hub - Setup Script (Linux/Mac)
# ============================================
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
# Helper functions
print_info() {
echo -e "${BLUE} ${1}${NC}"
}
print_success() {
echo -e "${GREEN}${1}${NC}"
}
print_warning() {
echo -e "${YELLOW}${1}${NC}"
}
print_error() {
echo -e "${RED}${1}${NC}"
}
print_header() {
echo ""
echo -e "${BLUE}═══════════════════════════════════════${NC}"
echo -e "${BLUE} ${1}${NC}"
echo -e "${BLUE}═══════════════════════════════════════${NC}"
echo ""
}
# Check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Main setup
main() {
print_header "MCP Hub Setup"
# 1. Check Python version
print_info "Checking Python version..."
if ! command_exists python3; then
print_error "Python 3 is not installed. Please install Python 3.11 or higher."
exit 1
fi
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d'.' -f1)
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d'.' -f2)
if [ "$PYTHON_MAJOR" -lt 3 ] || { [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 11 ]; }; then
print_error "Python 3.11+ is required. Found: $PYTHON_VERSION"
exit 1
fi
print_success "Python $PYTHON_VERSION found"
# 2. Check Docker
print_info "Checking Docker..."
if command_exists docker; then
DOCKER_VERSION=$(docker --version | cut -d' ' -f3 | sed 's/,$//')
print_success "Docker $DOCKER_VERSION found"
else
print_warning "Docker not found. Docker is optional but recommended for deployment."
fi
# 3. Check Docker Compose
print_info "Checking Docker Compose..."
if command_exists docker && docker compose version >/dev/null 2>&1; then
COMPOSE_VERSION=$(docker compose version --short)
print_success "Docker Compose $COMPOSE_VERSION found"
else
print_warning "Docker Compose not found. Required for Docker deployment."
fi
# 4. Create virtual environment
print_info "Creating virtual environment..."
if [ -d "venv" ]; then
print_warning "Virtual environment already exists. Skipping creation."
else
python3 -m venv venv
print_success "Virtual environment created"
fi
# 5. Activate virtual environment
print_info "Activating virtual environment..."
source venv/bin/activate
print_success "Virtual environment activated"
# 6. Upgrade pip
print_info "Upgrading pip..."
pip install --upgrade pip >/dev/null 2>&1
print_success "pip upgraded"
# 7. Install dependencies
print_info "Installing dependencies..."
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt >/dev/null 2>&1
print_success "Dependencies installed"
else
print_error "requirements.txt not found"
exit 1
fi
# 8. Install development dependencies
print_info "Installing development dependencies..."
pip install pytest pytest-asyncio pytest-cov pytest-mock black ruff mypy >/dev/null 2>&1
print_success "Development dependencies installed"
# 9. Setup environment file
print_info "Setting up environment file..."
if [ -f ".env" ]; then
print_warning ".env file already exists. Skipping creation."
print_warning "Please ensure your .env file is properly configured."
else
if [ -f ".env.example" ]; then
cp .env.example .env
print_success ".env file created from .env.example"
print_warning "Please edit .env file with your WordPress credentials."
else
print_error ".env.example not found"
exit 1
fi
fi
# 10. Create logs directory
print_info "Creating logs directory..."
mkdir -p logs
print_success "Logs directory ready"
# 11. Run tests (optional)
print_info "Running tests..."
if pytest --version >/dev/null 2>&1; then
if pytest -q 2>&1 | tail -1 | grep -q "passed"; then
print_success "All tests passed!"
else
print_warning "Some tests failed. Please check the output above."
fi
else
print_warning "pytest not available. Skipping tests."
fi
# 12. Final instructions
print_header "Setup Complete!"
echo -e "${GREEN}✓ Setup completed successfully!${NC}"
echo ""
echo "Next steps:"
echo ""
echo "1. Edit the .env file with your credentials:"
echo -e " ${BLUE}nano .env${NC}"
echo ""
echo "2. Activate the virtual environment:"
echo -e " ${BLUE}source venv/bin/activate${NC}"
echo ""
echo "3. Run the MCP server:"
echo -e " ${BLUE}python src/main.py${NC}"
echo ""
echo "4. Or deploy with Docker:"
echo -e " ${BLUE}docker compose up -d${NC}"
echo ""
echo "5. Run tests:"
echo -e " ${BLUE}pytest --cov${NC}"
echo ""
echo "For more information, visit:"
echo -e "${BLUE}https://github.com/mcphub/mcphub${NC}"
echo ""
}
# Run main function
main

94
scripts/test.sh Normal file
View File

@@ -0,0 +1,94 @@
#!/bin/bash
# ============================================
# MCP Hub - Test Runner Script
# ============================================
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${BLUE}════════════════════════════════════${NC}"
echo -e "${BLUE} MCP Hub - Test Runner${NC}"
echo -e "${BLUE}════════════════════════════════════${NC}"
echo ""
# Check if virtual environment is activated
if [ -z "$VIRTUAL_ENV" ]; then
echo -e "${YELLOW}⚠ Virtual environment not activated${NC}"
echo "Activating..."
source venv/bin/activate
fi
# Parse arguments
TEST_TYPE=${1:-all}
COVERAGE=${2:-yes}
case "$TEST_TYPE" in
unit)
echo -e "${BLUE}Running unit tests...${NC}"
if [ "$COVERAGE" = "yes" ]; then
pytest tests/test_*.py --cov=src --cov-report=term-missing --cov-report=html -v
else
pytest tests/test_*.py -v
fi
;;
integration)
echo -e "${BLUE}Running integration tests...${NC}"
if [ "$COVERAGE" = "yes" ]; then
pytest tests/integration/ --cov=src --cov-report=term-missing -v
else
pytest tests/integration/ -v
fi
;;
security)
echo -e "${BLUE}Running security tests...${NC}"
pytest tests/test_security.py -v
;;
quick)
echo -e "${BLUE}Running quick tests (no coverage)...${NC}"
pytest -x --ff
;;
all)
echo -e "${BLUE}Running all tests with coverage...${NC}"
pytest --cov=src --cov-report=term-missing --cov-report=html -v
;;
*)
echo -e "${YELLOW}Unknown test type: $TEST_TYPE${NC}"
echo ""
echo "Usage: ./scripts/test.sh [TYPE] [COVERAGE]"
echo ""
echo "Types:"
echo " all - Run all tests (default)"
echo " unit - Run only unit tests"
echo " integration - Run only integration tests"
echo " security - Run only security tests"
echo " quick - Quick test run (exit on first failure)"
echo ""
echo "Coverage (optional):"
echo " yes - Generate coverage report (default)"
echo " no - Skip coverage"
echo ""
echo "Examples:"
echo " ./scripts/test.sh"
echo " ./scripts/test.sh unit"
echo " ./scripts/test.sh all no"
echo " ./scripts/test.sh quick"
exit 1
;;
esac
echo ""
if [ "$COVERAGE" = "yes" ]; then
echo -e "${GREEN}✓ Coverage report saved to: htmlcov/index.html${NC}"
fi
echo -e "${GREEN}✓ Tests completed${NC}"