Download MCP Registry #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Download MCP Registry | |
| on: | |
| schedule: | |
| # Run daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| permissions: | |
| contents: write | |
| jobs: | |
| download-registry: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Checkout static repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: modelcontextprotocol/static | |
| path: static-repo | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm -F @teamsparkai/mcp-registry-client build | |
| - name: Sync schemas from static repo | |
| run: | | |
| echo "🔍 Syncing schemas from modelcontextprotocol/static..." | |
| mkdir -p registry/schema | |
| # Copy all versioned schema directories | |
| for dir in static-repo/schemas/*/; do | |
| if [ -f "$dir/server.schema.json" ]; then | |
| version=$(basename "$dir") | |
| if [ ! -d "registry/schema/$version" ]; then | |
| echo "⬇ Adding $version/" | |
| mkdir -p "registry/schema/$version" | |
| cp "$dir/server.schema.json" "registry/schema/$version/server.schema.json" | |
| fi | |
| fi | |
| done | |
| # Find latest version and update current schema if needed | |
| LATEST=$(ls static-repo/schemas/ | sort -r | head -n1) | |
| echo "Latest schema version: $LATEST" | |
| if [ -f "registry/schema/server.schema.json" ]; then | |
| CURRENT=$(jq -r '.["$id"]' registry/schema/server.schema.json | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}') | |
| if [ "$CURRENT" != "$LATEST" ]; then | |
| echo "⬇ Updating schema from $CURRENT to $LATEST" | |
| cp "static-repo/schemas/$LATEST/server.schema.json" registry/schema/server.schema.json | |
| else | |
| echo "✓ Current schema is already at latest version ($LATEST)" | |
| fi | |
| else | |
| echo "⬇ Creating initial current schema ($LATEST)" | |
| cp "static-repo/schemas/$LATEST/server.schema.json" registry/schema/server.schema.json | |
| fi | |
| echo "✅ Schema sync complete" | |
| - name: Download MCP Registry | |
| run: pnpm run registry:download | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| # Check for both modified and untracked files | |
| if [ -n "$(git status --porcelain public/server-registry.json registry/schema/)" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add public/server-registry.json registry/schema/ | |
| git commit -m "Update MCP registry data and schemas [skip ci]" | |
| git push |