Skip to main content
Glama

CodeCompass MCP

docker-logs.sh3.05 kB
#!/bin/bash # CodeCompass MCP Docker Logs Script # Utility script for viewing container logs set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Default values CONTAINER_NAME="codecompass-mcp" FOLLOW=false TAIL_LINES=100 SHOW_TIMESTAMPS=false # Function to display usage show_usage() { echo "Usage: $0 [OPTIONS]" echo "Options:" echo " -n, --name NAME Container name (default: codecompass-mcp)" echo " -f, --follow Follow log output" echo " -t, --tail LINES Number of lines to show (default: 100)" echo " --timestamps Show timestamps" echo " --all Show all logs (no tail limit)" echo " -h, --help Show this help message" echo "" echo "Examples:" echo " $0 # Show last 100 lines" echo " $0 -f # Follow logs" echo " $0 -t 50 # Show last 50 lines" echo " $0 --all # Show all logs" echo " $0 --timestamps -f # Follow with timestamps" } # Parse command line arguments while [[ $# -gt 0 ]]; do case $1 in -n|--name) CONTAINER_NAME="$2" shift 2 ;; -f|--follow) FOLLOW=true shift ;; -t|--tail) TAIL_LINES="$2" shift 2 ;; --timestamps) SHOW_TIMESTAMPS=true shift ;; --all) TAIL_LINES="all" shift ;; -h|--help) show_usage exit 0 ;; *) echo "Unknown option: $1" show_usage exit 1 ;; esac done echo -e "${BLUE}CodeCompass MCP Docker Logs${NC}" echo -e "${BLUE}===========================${NC}" echo "Container: $CONTAINER_NAME" echo "" # Check if container exists if ! docker ps -a --format "table {{.Names}}" | grep -q "^$CONTAINER_NAME$"; then echo -e "${RED}Error: Container '$CONTAINER_NAME' not found${NC}" echo "Available containers:" docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" exit 1 fi # Check if container is running if ! docker ps --format "table {{.Names}}" | grep -q "^$CONTAINER_NAME$"; then echo -e "${YELLOW}Warning: Container '$CONTAINER_NAME' is not running${NC}" echo "Showing logs from stopped container..." echo "" fi # Build docker logs command DOCKER_CMD="docker logs" if [ "$SHOW_TIMESTAMPS" = true ]; then DOCKER_CMD="$DOCKER_CMD --timestamps" fi if [ "$FOLLOW" = true ]; then DOCKER_CMD="$DOCKER_CMD --follow" fi if [ "$TAIL_LINES" != "all" ]; then DOCKER_CMD="$DOCKER_CMD --tail $TAIL_LINES" fi DOCKER_CMD="$DOCKER_CMD $CONTAINER_NAME" echo -e "${YELLOW}Showing logs for container '$CONTAINER_NAME'${NC}" if [ "$FOLLOW" = true ]; then echo -e "${YELLOW}Following logs... (Press Ctrl+C to stop)${NC}" fi echo "" # Execute the command eval $DOCKER_CMD

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/TheAlchemist6/codecompass-mcp'

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