Skip to content

Publish to MCP Registry #15

Publish to MCP Registry

Publish to MCP Registry #15

name: Publish to MCP Registry
on:
push:
tags: ["v*"] # Triggers on version tags like v1.0.0
workflow_dispatch: # Allow manual triggering
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC authentication
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Fetch tags
run: git fetch --tags
- name: Install MCP Publisher
run: |
# Build publisher from source (requires Go)
git clone https://github.com/modelcontextprotocol/registry publisher-repo
cd publisher-repo
make publisher
cp bin/mcp-publisher ../mcp-publisher
cd ..
chmod +x mcp-publisher
- name: Update server.json version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
# Use the tag that triggered the workflow
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
echo "Using triggered tag: ${{ github.ref_name }}"
else
# Fallback to latest tag (for manual triggers)
LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
if [ -z "$LATEST_TAG" ]; then
echo "❌ No release tag found. Cannot determine version."
exit 1
fi
TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
echo "Using latest tag: $LATEST_TAG"
fi
sed -i "s/\${VERSION}/$TAG_VERSION/g" server.json
echo "Updated server.json version to $TAG_VERSION"
- name: Display updated server.json
run: |
echo "Final server.json contents:"
cat server.json
echo ""
echo "JSON validation check:"
python3 -m json.tool server.json > /dev/null && echo "✅ Valid JSON" || echo "❌ Invalid JSON"
- name: Login to MCP Registry (OIDC)
run: ./mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: ./mcp-publisher publish