Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .github/workflows/update-mcp-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Update MCP Registry

on:
workflow_run:
workflows: ["Build and Push Docker Image"]
types:
- completed
branches:
- main

jobs:
check-and-update-registry:
# Only run on tag pushes and if the docker workflow succeeded
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
startsWith(github.event.workflow_run.head_branch, 'v')

runs-on: ubuntu-latest
permissions:
id-token: write # Required for GitHub OIDC authentication with MCP Registry
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Wait for PyPI release to complete
uses: fountainhead/action-wait-for-check@v1.2.0
id: wait-for-pypi
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "Build and publish Python distributions to PyPI"
ref: ${{ github.event.workflow_run.head_sha }}
timeoutSeconds: 600
intervalSeconds: 10

- name: Check PyPI release status
if: steps.wait-for-pypi.outputs.conclusion != 'success'
run: |
echo "PyPI release did not succeed. Status: ${{ steps.wait-for-pypi.outputs.conclusion }}"
exit 1

- name: Validate version consistency
id: version
run: |
# Read versions from files
ROOT_VERSION=$(jq -r '.version' server.json)
# Only get versions from packages that have a version field (exclude null/empty)
PACKAGE_VERSIONS=$(jq -r '.packages[] | select(.version != null) | .version' server.json | sort -u)
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
TAG_VERSION=${GITHUB_REF_NAME#v}

echo "Version Check:"
echo " server.json root: $ROOT_VERSION"
echo " server.json packages:"
jq -r '.packages[] |
if .version != null then
" - \(.registryType):\(.identifier) = \(.version)"
else
" - \(.registryType):\(.identifier) (no version field)"
end' server.json
echo " pyproject.toml: $PYPROJECT_VERSION"
echo " Git tag: $TAG_VERSION"
echo ""

# Check if all package versions match root version (only for packages with version field)
MISMATCH=false
if [ -n "$PACKAGE_VERSIONS" ]; then
while IFS= read -r pkg_ver; do
if [ "$pkg_ver" != "$ROOT_VERSION" ]; then
echo "ERROR: Package version ($pkg_ver) doesn't match root version ($ROOT_VERSION)"
MISMATCH=true
fi
done <<< "$PACKAGE_VERSIONS"
fi

if [ "$MISMATCH" = true ]; then
echo ""
echo "Fix: Update server.json so all package versions match the root version"
exit 1
fi

# Check if root version matches tag
if [ "$ROOT_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: server.json version ($ROOT_VERSION) doesn't match tag ($TAG_VERSION)"
echo "Fix: Update server.json root version to match the tag"
exit 1
fi

# Warn if pyproject.toml doesn't match
if [ "$PYPROJECT_VERSION" != "$TAG_VERSION" ]; then
echo "WARNING: pyproject.toml version ($PYPROJECT_VERSION) doesn't match tag ($TAG_VERSION)"
echo "This may cause PyPI issues"
fi

# Check Docker image tags in OCI identifiers
echo ""
echo "Checking Docker image tags..."
OCI_PACKAGES=$(jq -r '.packages[] | select(.registryType == "oci") | .identifier' server.json)
if [ -n "$OCI_PACKAGES" ]; then
OCI_TAG_MISMATCH=false
while IFS= read -r oci_id; do
# Extract tag from identifier (everything after last :)
IMAGE_TAG="${oci_id##*:}"
echo " - Image: $oci_id"
echo " Tag: $IMAGE_TAG"

if [ "$IMAGE_TAG" != "$ROOT_VERSION" ]; then
echo " ERROR: Docker image tag ($IMAGE_TAG) doesn't match version ($ROOT_VERSION)"
OCI_TAG_MISMATCH=true
else
echo " Tag matches"
fi
done <<< "$OCI_PACKAGES"

if [ "$OCI_TAG_MISMATCH" = true ]; then
echo ""
echo "Fix: Update Docker image tags in server.json to match the version"
exit 1
fi
fi

echo ""
echo "All version checks passed!"
echo "version=$ROOT_VERSION" >> $GITHUB_OUTPUT

- name: Install MCP Publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher

- name: Login to MCP Registry
run: ./mcp-publisher login github-oidc

- name: Publish to MCP Registry
run: ./mcp-publisher publish

- name: Notify completion
if: success()
run: |
echo "MCP Registry updated successfully for version ${{ steps.version.outputs.version }}"
echo "Docker image: docker.io/couchbaseecosystem/mcp-server-couchbase:${{ steps.version.outputs.version }}"
echo "PyPI package: couchbase-mcp-server==${{ steps.version.outputs.version }}"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ An [MCP](https://modelcontextprotocol.io/) server implementation of Couchbase th
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Couchbase-Ecosystem/mcp-server-couchbase/badge" alt="Couchbase Server MCP server" />
</a>

<!-- mcp-name: io.github.Couchbase-Ecosystem/mcp-server-couchbase -->

## Features

- Get a list of all the buckets in the cluster
Expand Down
Loading