Skip to content

Commit 4185553

Browse files
authored
MCP registry publishing (#75)
1 parent 4a54048 commit 4185553

File tree

7 files changed

+495
-5
lines changed

7 files changed

+495
-5
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Update MCP Registry
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build and Push Docker Image"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
jobs:
12+
check-and-update-registry:
13+
# Only run on tag pushes and if the docker workflow succeeded
14+
if: |
15+
github.event.workflow_run.conclusion == 'success' &&
16+
github.event.workflow_run.event == 'push' &&
17+
startsWith(github.event.workflow_run.head_branch, 'v')
18+
19+
runs-on: ubuntu-latest
20+
permissions:
21+
id-token: write # Required for GitHub OIDC authentication with MCP Registry
22+
contents: read
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.event.workflow_run.head_branch }}
29+
30+
- name: Wait for PyPI release to complete
31+
uses: fountainhead/[email protected]
32+
id: wait-for-pypi
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
checkName: "Build and publish Python distributions to PyPI"
36+
ref: ${{ github.event.workflow_run.head_sha }}
37+
timeoutSeconds: 600
38+
intervalSeconds: 10
39+
40+
- name: Check PyPI release status
41+
if: steps.wait-for-pypi.outputs.conclusion != 'success'
42+
run: |
43+
echo "PyPI release did not succeed. Status: ${{ steps.wait-for-pypi.outputs.conclusion }}"
44+
exit 1
45+
46+
- name: Validate version consistency
47+
id: version
48+
run: |
49+
# Read versions from files
50+
ROOT_VERSION=$(jq -r '.version' server.json)
51+
# Only get versions from packages that have a version field (exclude null/empty)
52+
PACKAGE_VERSIONS=$(jq -r '.packages[] | select(.version != null) | .version' server.json | sort -u)
53+
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
54+
TAG_VERSION=${GITHUB_REF_NAME#v}
55+
56+
echo "Version Check:"
57+
echo " server.json root: $ROOT_VERSION"
58+
echo " server.json packages:"
59+
jq -r '.packages[] |
60+
if .version != null then
61+
" - \(.registryType):\(.identifier) = \(.version)"
62+
else
63+
" - \(.registryType):\(.identifier) (no version field)"
64+
end' server.json
65+
echo " pyproject.toml: $PYPROJECT_VERSION"
66+
echo " Git tag: $TAG_VERSION"
67+
echo ""
68+
69+
# Check if all package versions match root version (only for packages with version field)
70+
MISMATCH=false
71+
if [ -n "$PACKAGE_VERSIONS" ]; then
72+
while IFS= read -r pkg_ver; do
73+
if [ "$pkg_ver" != "$ROOT_VERSION" ]; then
74+
echo "ERROR: Package version ($pkg_ver) doesn't match root version ($ROOT_VERSION)"
75+
MISMATCH=true
76+
fi
77+
done <<< "$PACKAGE_VERSIONS"
78+
fi
79+
80+
if [ "$MISMATCH" = true ]; then
81+
echo ""
82+
echo "Fix: Update server.json so all package versions match the root version"
83+
exit 1
84+
fi
85+
86+
# Check if root version matches tag
87+
if [ "$ROOT_VERSION" != "$TAG_VERSION" ]; then
88+
echo "ERROR: server.json version ($ROOT_VERSION) doesn't match tag ($TAG_VERSION)"
89+
echo "Fix: Update server.json root version to match the tag"
90+
exit 1
91+
fi
92+
93+
# Warn if pyproject.toml doesn't match
94+
if [ "$PYPROJECT_VERSION" != "$TAG_VERSION" ]; then
95+
echo "WARNING: pyproject.toml version ($PYPROJECT_VERSION) doesn't match tag ($TAG_VERSION)"
96+
echo "This may cause PyPI issues"
97+
fi
98+
99+
# Check Docker image tags in OCI identifiers
100+
echo ""
101+
echo "Checking Docker image tags..."
102+
OCI_PACKAGES=$(jq -r '.packages[] | select(.registryType == "oci") | .identifier' server.json)
103+
if [ -n "$OCI_PACKAGES" ]; then
104+
OCI_TAG_MISMATCH=false
105+
while IFS= read -r oci_id; do
106+
# Extract tag from identifier (everything after last :)
107+
IMAGE_TAG="${oci_id##*:}"
108+
echo " - Image: $oci_id"
109+
echo " Tag: $IMAGE_TAG"
110+
111+
if [ "$IMAGE_TAG" != "$ROOT_VERSION" ]; then
112+
echo " ERROR: Docker image tag ($IMAGE_TAG) doesn't match version ($ROOT_VERSION)"
113+
OCI_TAG_MISMATCH=true
114+
else
115+
echo " Tag matches"
116+
fi
117+
done <<< "$OCI_PACKAGES"
118+
119+
if [ "$OCI_TAG_MISMATCH" = true ]; then
120+
echo ""
121+
echo "Fix: Update Docker image tags in server.json to match the version"
122+
exit 1
123+
fi
124+
fi
125+
126+
echo ""
127+
echo "All version checks passed!"
128+
echo "version=$ROOT_VERSION" >> $GITHUB_OUTPUT
129+
130+
- name: Install MCP Publisher
131+
run: |
132+
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
133+
134+
- name: Login to MCP Registry
135+
run: ./mcp-publisher login github-oidc
136+
137+
- name: Publish to MCP Registry
138+
run: ./mcp-publisher publish
139+
140+
- name: Notify completion
141+
if: success()
142+
run: |
143+
echo "MCP Registry updated successfully for version ${{ steps.version.outputs.version }}"
144+
echo "Docker image: docker.io/couchbaseecosystem/mcp-server-couchbase:${{ steps.version.outputs.version }}"
145+
echo "PyPI package: couchbase-mcp-server==${{ steps.version.outputs.version }}"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ An [MCP](https://modelcontextprotocol.io/) server implementation of Couchbase th
88
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Couchbase-Ecosystem/mcp-server-couchbase/badge" alt="Couchbase Server MCP server" />
99
</a>
1010

11+
<!-- mcp-name: io.github.Couchbase-Ecosystem/mcp-server-couchbase -->
12+
1113
## Features
1214

1315
- Get a list of all the buckets in the cluster

0 commit comments

Comments
 (0)