File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,5 +107,22 @@ jobs:
107107 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
108108 - name : Authenticate to MCP Registry
109109 run : ./mcp-publisher login github-oidc
110+ - name : Check if version exists in MCP Registry
111+ id : check-version
112+ run : |
113+ VERSION=$(grep -oP '^version\s*=\s*"\K[^"]+' pyproject.toml || grep -oP 'version\s*=\s*"\K[^"]+' pyproject.toml | head -1)
114+ echo "version=$VERSION" >> $GITHUB_OUTPUT
115+
116+ # 检查版本是否已存在于 MCP Registry
117+ HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.modelcontextprotocol.io/v0/servers/io.github.xt765/mcp_documents_reader/versions/$VERSION")
118+
119+ if [ "$HTTP_CODE" = "200" ]; then
120+ echo "exists=true" >> $GITHUB_OUTPUT
121+ echo "::warning::Version $VERSION already exists in MCP Registry, skipping publish"
122+ else
123+ echo "exists=false" >> $GITHUB_OUTPUT
124+ echo "Version $VERSION does not exist in MCP Registry, will publish"
125+ fi
110126 - name : Publish server to MCP Registry
127+ if : steps.check-version.outputs.exists == 'false'
111128 run : ./mcp-publisher publish
You can’t perform that action at this time.
0 commit comments