-
Notifications
You must be signed in to change notification settings - Fork 0
chore: auto-publish to MCP Registry on release #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| name: Publish to MCP Registry | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||
| release: | ||||||||||||||||||||||||||||||||||||||||||||||
| types: [published] | ||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||
| id-token: write # Required for OIDC authentication with MCP Registry | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||
| publish: | ||||||||||||||||||||||||||||||||||||||||||||||
| name: Publish server.json to MCP Registry | ||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repo | ||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v7 | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Extract version from release tag | ||||||||||||||||||||||||||||||||||||||||||||||
| id: version | ||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
| TAG="${{ github.event.release.tag_name }}" | ||||||||||||||||||||||||||||||||||||||||||||||
| if [ -z "$TAG" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||
| TAG="$(git describe --tags --abbrev=0)" | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
| VERSION="${TAG#v}" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Untrusted template expansion into shell ( Interpolating 🛡️ Proposed fix - name: Extract version from release tag
id: version
+ env:
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
- TAG="${{ github.event.release.tag_name }}"
+ TAG="$RELEASE_TAG"
if [ -z "$TAG" ]; then
TAG="$(git describe --tags --abbrev=0)"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"As per static analysis hints, zizmor flagged "code injection via template expansion (template-injection): may expand into attacker-controllable code" at line 23. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[error] 23-23: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Set version in server.json | ||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
| VERSION="${{ steps.version.outputs.version }}" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Setting server.json version to $VERSION" | ||||||||||||||||||||||||||||||||||||||||||||||
| jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.json.tmp | ||||||||||||||||||||||||||||||||||||||||||||||
| mv server.json.tmp server.json | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "=== Updated server.json ===" | ||||||||||||||||||||||||||||||||||||||||||||||
| cat server.json | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Same template-injection pattern for Prefer 🛡️ Proposed fix - name: Set version in server.json
+ env:
+ VERSION: ${{ steps.version.outputs.version }}
run: |
- VERSION="${{ steps.version.outputs.version }}"
echo "Setting server.json version to $VERSION"
jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.json.tmp
mv server.json.tmp server.json
echo "=== Updated server.json ==="
cat server.jsonAs per static analysis hints, zizmor flagged "code injection via template expansion (template-injection)" at line 33. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[info] 33-33: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - 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: Authenticate to MCP Registry (OIDC) | ||||||||||||||||||||||||||||||||||||||||||||||
| run: ./mcp-publisher login github-oidc | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Publish server to MCP Registry | ||||||||||||||||||||||||||||||||||||||||||||||
| run: ./mcp-publisher publish | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Checkout doesn't set
persist-credentials: falseorfetch-depth.Two related gaps in the checkout step:
mcp-publisher), so persisting the token viapersist-credentials(defaulttrue) is unnecessary credential exposure — flagged by zizmor asartipacked.fetch-depth: 1fetches only the triggering commit with no tags, which breaks thegit describe --tags --abbrev=0fallback used later (see lines 24-26) whenever the workflow runs viaworkflow_dispatch— the git command will fail on a shallow clone with no tags.🔧 Proposed fix
- name: Checkout repo uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: falseAs per static analysis hints, zizmor flagged "credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false" for these lines.
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 17-18: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools