Skip to content

Commit d5290c5

Browse files
committed
chore: added generate script
Signed-off-by: Ivan Pedrazas <ivan.pedrazas@docker.com>
1 parent 39aa2b2 commit d5290c5

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

scripts/generate.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+

0 commit comments

Comments
 (0)