105 lines
3.7 KiB
Bash
105 lines
3.7 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
echo "🔧 Setting up Claude Code MCP servers..."
|
|
|
|
# Create necessary directories
|
|
mkdir -p ~/.config/claude-code
|
|
mkdir -p ~/.local/bin
|
|
mkdir -p ~/.local/share/mcp-logs
|
|
|
|
# Copy Claude Code configuration
|
|
cp /workspaces/boilerplate/.devcontainer/claude-code-config.json ~/.config/claude-code/config.json
|
|
|
|
# Install or update Forgejo MCP server if Go is available
|
|
if command -v go &> /dev/null; then
|
|
echo "📦 Installing Forgejo MCP server..."
|
|
if [ ! -f ~/.local/bin/forgejo-mcp ]; then
|
|
# Clone and build Forgejo MCP (fallback if binary not available)
|
|
cd /tmp
|
|
git clone https://forgejo.org/forgejo/forgejo-mcp.git 2>/dev/null || echo "⚠️ Forgejo MCP repository not available, skipping..."
|
|
if [ -d forgejo-mcp ]; then
|
|
cd forgejo-mcp
|
|
make build 2>/dev/null && cp forgejo-mcp ~/.local/bin/ || echo "⚠️ Could not build Forgejo MCP"
|
|
cd /workspaces/boilerplate
|
|
rm -rf /tmp/forgejo-mcp
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Ensure MCP servers are accessible
|
|
echo "🔍 Checking MCP server availability..."
|
|
|
|
# Test Node.js based servers
|
|
echo " - test-runner-mcp: $(npm list -g test-runner-mcp 2>/dev/null | grep test-runner-mcp || echo 'not found')"
|
|
echo " - devcontainers: $(npm list -g @crunchloop/mcp-devcontainers 2>/dev/null | grep mcp-devcontainers || echo 'not found')"
|
|
echo " - kubernetes: $(npm list -g kubernetes-mcp-server 2>/dev/null | grep kubernetes-mcp-server || echo 'not found')"
|
|
|
|
# Test Python-based servers
|
|
echo " - ruff: $(python -c 'import ruff_mcp_server; print("available")' 2>/dev/null || echo 'not found')"
|
|
|
|
# Test uvx-based servers
|
|
echo " - uv-mcp: $(uvx --help 2>/dev/null | grep -q 'uv-mcp' && echo 'available' || echo 'not found')"
|
|
|
|
# Create wrapper scripts for containerized MCP servers
|
|
echo "📝 Creating wrapper scripts..."
|
|
|
|
# Prometheus MCP wrapper
|
|
cat > ~/.local/bin/prometheus-mcp << 'EOF'
|
|
#!/bin/bash
|
|
exec docker run -i --rm \
|
|
-e PROMETHEUS_URL="${PROMETHEUS_URL:-http://localhost:9090}" \
|
|
ghcr.io/pab1it0/prometheus-mcp-server:latest "$@"
|
|
EOF
|
|
chmod +x ~/.local/bin/prometheus-mcp
|
|
|
|
# Grafana MCP wrapper
|
|
cat > ~/.local/bin/grafana-mcp << 'EOF'
|
|
#!/bin/bash
|
|
exec docker run -i --rm \
|
|
-e GRAFANA_API_TOKEN="${GRAFANA_API_TOKEN}" \
|
|
ghcr.io/grafana/mcp-grafana:latest "$@"
|
|
EOF
|
|
chmod +x ~/.local/bin/grafana-mcp
|
|
|
|
# Create environment template file
|
|
cat > ~/.local/share/mcp-env-template << 'EOF'
|
|
# MCP Server Environment Variables
|
|
# Copy this to ~/.bashrc or ~/.zshrc and customize
|
|
|
|
# Forgejo/Gitea Configuration
|
|
export FORGEJO_PAT="your-forgejo-personal-access-token"
|
|
export GITEA_ACCESS_TOKEN="$FORGEJO_PAT"
|
|
|
|
# Prometheus Configuration
|
|
export PROMETHEUS_URL="http://localhost:9090"
|
|
|
|
# Grafana Configuration
|
|
export GRAFANA_API_TOKEN="your-grafana-api-token"
|
|
|
|
# Kubernetes Configuration
|
|
export KUBECONFIG="~/.kube/config"
|
|
|
|
# Docker Configuration (if using remote Docker)
|
|
# export DOCKER_HOST="tcp://docker.example.com:2376"
|
|
EOF
|
|
|
|
echo ""
|
|
echo "✅ MCP setup complete!"
|
|
echo ""
|
|
echo "📋 Next steps:"
|
|
echo "1. Copy environment variables from ~/.local/share/mcp-env-template to your shell config"
|
|
echo "2. Configure your tokens and endpoints"
|
|
echo "3. Run 'claude-code' to start with MCP servers enabled"
|
|
echo ""
|
|
echo "🔧 Available MCP servers:"
|
|
echo " - forgejo: Git repository management"
|
|
echo " - tests: Test runner with uv + ruff"
|
|
echo " - ruff: Python linting and formatting"
|
|
echo " - uv: Python package management"
|
|
echo " - devcontainers: Development container management"
|
|
echo " - kubernetes: Kubernetes cluster operations"
|
|
echo " - prometheus: Metrics and monitoring queries"
|
|
echo " - grafana: Dashboard and alerting management"
|
|
echo " - tofu: Infrastructure as Code with OpenTofu"
|
|
echo "" |