File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ # Output file
6+ OUTPUT_FILE=" mcp-servers.yaml"
7+
8+ # Remove existing output file if it exists
9+ rm -f " $OUTPUT_FILE "
10+
11+ # Counter for tracking progress
12+ count=0
13+
14+ # Walk through all directories in ./servers
15+ for server_dir in ./servers/* /; do
16+ # Extract the directory name
17+ dir_name=$( basename " $server_dir " )
18+
19+ # Check if server.yaml exists in this directory
20+ if [[ -f " $server_dir /server.yaml" ]]; then
21+ echo " Processing: $dir_name "
22+
23+ if [[ $count -eq 0 ]]; then
24+ # First server: add dash and content with no leading newline
25+ sed ' s/^/- /' " $server_dir /server.yaml" | sed ' 2,$s/^- / /' >> " $OUTPUT_FILE "
26+ else
27+ # Subsequent servers: add newline, then dash and content
28+ echo " " >> " $OUTPUT_FILE "
29+ sed ' s/^/- /' " $server_dir /server.yaml" | sed ' 2,$s/^- / /' >> " $OUTPUT_FILE "
30+ fi
31+
32+ (( count++ ))
33+ else
34+ echo " Warning: No server.yaml found in $dir_name "
35+ fi
36+ done
37+
38+ echo " "
39+ echo " ✅ Generated $OUTPUT_FILE with $count servers"
40+ echo " 📁 Output location: $( pwd) /$OUTPUT_FILE "
41+
You can’t perform that action at this time.
0 commit comments