1+ name : Publish to MCP Registry
2+
3+ on :
4+ push :
5+ tags : ["v*"] # Triggers on version tags like v1.0.0
6+ workflow_dispatch : # Allow manual triggering
7+
8+ jobs :
9+ publish :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ id-token : write # Required for OIDC authentication
13+ contents : read
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v5
18+
19+ - name : Setup Go
20+ uses : actions/setup-go@v6
21+ with :
22+ go-version : " stable"
23+
24+ - name : Fetch tags
25+ run : |
26+ if [[ "${{ github.ref_type }}" != "tag" ]]; then
27+ git fetch --tags
28+ else
29+ echo "Skipping tag fetch - already on tag ${{ github.ref_name }}"
30+ fi
31+
32+ - name : Install MCP Publisher
33+ run : |
34+ git clone --quiet https://github.com/modelcontextprotocol/registry publisher-repo
35+ cd publisher-repo && make publisher > /dev/null && cd ..
36+ cp publisher-repo/bin/mcp-publisher . && chmod +x mcp-publisher
37+
38+ - name : Update server.json version
39+ run : |
40+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
41+ TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
42+ else
43+ LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
44+ [ -z "$LATEST_TAG" ] && { echo "No release tag found"; exit 1; }
45+ TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
46+ echo "Using latest tag: $LATEST_TAG"
47+ fi
48+ sed -i "s/\${VERSION}/$TAG_VERSION/g" server.json
49+ echo "Version: $TAG_VERSION"
50+
51+ - name : Validate configuration
52+ run : |
53+ python3 -m json.tool server.json > /dev/null && echo "Configuration valid" || exit 1
54+
55+ - name : Display final server.json
56+ run : |
57+ echo "Final server.json contents:"
58+ cat server.json
59+
60+ - name : Login to MCP Registry (OIDC)
61+ run : ./mcp-publisher login github-oidc
62+
63+ - name : Publish to MCP Registry
64+ run : ./mcp-publisher publish
0 commit comments