Skip to content

Commit 3457f70

Browse files
authored
Feature/sdg/registry (#163)
* Fallback for duplicate push on MCP Registry
1 parent b2c4518 commit 3457f70

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.github/workflows/publish_mcp.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
echo "Get the latest release version"
3434
LATEST_VERSION=$(curl -s https://api.github.com/repos/modelcontextprotocol/registry/releases/latest | jq -r '.tag_name')
3535
echo "Installing MCP Publisher version: $LATEST_VERSION"
36-
echo "Download and extract the latest release"
3736
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/${LATEST_VERSION}/mcp-publisher_${LATEST_VERSION#v}_${OS}_${ARCH}.tar.gz" \
3837
| tar xz mcp-publisher
3938
@@ -45,4 +44,28 @@ jobs:
4544
- name: Publish server.json to MCP Registry
4645
run: |
4746
echo "Publish server.json to MCP Registry"
48-
./mcp-publisher publish
47+
# Try to publish, with fallback for duplicate version
48+
if ./mcp-publisher publish; then
49+
echo "Successfully published to MCP Registry"
50+
else
51+
PUBLISH_EXIT_CODE=$?
52+
echo "Publish failed with exit code: $PUBLISH_EXIT_CODE"
53+
54+
# Check if it's a duplicate version error
55+
if [ $PUBLISH_EXIT_CODE -ne 0 ]; then
56+
echo "Checking if version already exists in registry..."
57+
58+
# Get current version from server.json
59+
CURRENT_VERSION=$(jq -r '.version' server.json)
60+
echo "Current version: $CURRENT_VERSION"
61+
62+
# Check if version exists in registry
63+
if curl -s "https://registry.modelcontextprotocol.io/v0/servers/io.github.robotmcp/ros-mcp-server" | jq -e ".version == \"$CURRENT_VERSION\"" > /dev/null; then
64+
echo "Version $CURRENT_VERSION already exists in registry. Skipping publication."
65+
echo "Server is already published with version $CURRENT_VERSION"
66+
else
67+
echo "Publication failed for unknown reason"
68+
exit $PUBLISH_EXIT_CODE
69+
fi
70+
fi
71+
fi

.github/workflows/publish_pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish to PyPI Only
1+
name: Publish PyPI
22

33
on:
44
workflow_dispatch:
@@ -12,7 +12,7 @@ concurrency:
1212

1313
jobs:
1414
pypi:
15-
name: Publish to PyPI
15+
name: Publish PyPI
1616
runs-on: ubuntu-latest
1717
permissions:
1818
contents: read

0 commit comments

Comments
 (0)