1+ #! /bin/bash
2+ set -e
3+
4+ # Script to show status of all MCP servers in a directory
5+ # Usage: ./scripts/mcp-status.sh [directory]
6+
7+ # Color codes
8+ RED=' \033[0;31m'
9+ GREEN=' \033[0;32m'
10+ YELLOW=' \033[1;33m'
11+ BLUE=' \033[0;34m'
12+ CYAN=' \033[0;36m'
13+ NC=' \033[0m'
14+
15+ # Default to parent directory if not specified
16+ SEARCH_DIR=" ${1:- ..} "
17+
18+ echo " MCP Server Status Report"
19+ echo " ========================"
20+ echo " "
21+ echo -e " Searching in: ${BLUE} $SEARCH_DIR ${NC} "
22+ echo " "
23+
24+ # Find all directories with package.json that look like MCP servers
25+ find " $SEARCH_DIR " -maxdepth 2 -name " package.json" -type f | sort | while read -r pkg_file; do
26+ dir=$( dirname " $pkg_file " )
27+ dir_name=$( basename " $dir " )
28+
29+ # Skip node_modules
30+ if [[ " $dir " == * " node_modules" * ]]; then
31+ continue
32+ fi
33+
34+ # Check if it's an MCP server (has @modelcontextprotocol dependency)
35+ if grep -q " @modelcontextprotocol" " $pkg_file " 2> /dev/null; then
36+ echo -e " ${GREEN} ━━━ $dir_name ━━━${NC} "
37+
38+ # Get package info
39+ name=$( grep ' "name"' " $pkg_file " | head -1 | cut -d' "' -f4)
40+ version=$( grep ' "version"' " $pkg_file " | head -1 | cut -d' "' -f4)
41+ description=$( grep ' "description"' " $pkg_file " | head -1 | cut -d' "' -f4)
42+
43+ echo -e " Package: ${CYAN} $name @$version ${NC} "
44+ echo -e " Description: $description "
45+
46+ # Check for scripts directory
47+ if [ -d " $dir /scripts" ]; then
48+ script_count=$( find " $dir /scripts" -name " *.sh" -type f | wc -l | tr -d ' ' )
49+ echo -e " Scripts: ${GREEN} ✓${NC} ($script_count scripts found)"
50+ else
51+ echo -e " Scripts: ${YELLOW} ✗${NC} (no scripts directory)"
52+ fi
53+
54+ # Check git status if it's a git repo
55+ if [ -d " $dir /.git" ]; then
56+ cd " $dir "
57+
58+ # Get current branch
59+ branch=$( git branch --show-current 2> /dev/null || echo " unknown" )
60+ echo -e " Git Branch: ${BLUE} $branch ${NC} "
61+
62+ # Check for uncommitted changes
63+ if git diff-index --quiet HEAD -- 2> /dev/null; then
64+ echo -e " Git Status: ${GREEN} ✓ Clean${NC} "
65+ else
66+ changes=$( git status --porcelain | wc -l | tr -d ' ' )
67+ echo -e " Git Status: ${YELLOW} ⚠ $changes uncommitted changes${NC} "
68+ fi
69+
70+ # Check for unpushed commits
71+ if [ " $branch " != " unknown" ]; then
72+ ahead=$( git rev-list --count @{u}..HEAD 2> /dev/null || echo " 0" )
73+ if [ " $ahead " -gt 0 ]; then
74+ echo -e " Unpushed: ${YELLOW} ⚠ $ahead commits ahead${NC} "
75+ fi
76+ fi
77+
78+ cd - > /dev/null
79+ else
80+ echo -e " Git: ${RED} Not a git repository${NC} "
81+ fi
82+
83+ # Check last modified
84+ if [ -f " $dir /src/index.ts" ]; then
85+ if [[ " $OSTYPE " == " darwin" * ]]; then
86+ last_modified=$( stat -f " %Sm" -t " %Y-%m-%d %H:%M" " $dir /src/index.ts" )
87+ else
88+ last_modified=$( stat -c " %y" " $dir /src/index.ts" | cut -d' ' -f1,2 | cut -d' .' -f1)
89+ fi
90+ echo -e " Last Modified: $last_modified "
91+ fi
92+
93+ # Count tools
94+ if [ -d " $dir /src/tools" ]; then
95+ tool_count=$( find " $dir /src/tools" -name " *.ts" -not -name " *.test.ts" -not -name " *.spec.ts" | wc -l | tr -d ' ' )
96+ echo -e " Tools: $tool_count "
97+ fi
98+
99+ echo " "
100+ fi
101+ done
102+
103+ echo -e " ${BLUE} Summary:${NC} "
104+ echo -e " Run ${CYAN} ./scripts/install-scripts.sh <path>${NC} to add merge scripts to any MCP server"
105+ echo -e " Run ${CYAN} ./scripts/analyze-template-diff.sh${NC} in any MCP server to check template differences"
0 commit comments