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
49 changes: 49 additions & 0 deletions .github/workflows/publish-mcp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish to MCP Registry

on:
release:
types: [published]
Comment on lines +5 to +6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize MCP publish after PyPI upload

When a release is published, this new workflow starts from the same release.published event as .github/workflows/release.yml, but that separate release job only uploads the distribution to PyPI at its final step. If the release job is queued behind this job or takes more than this workflow's five-minute PyPI polling window, the MCP publish fails even though the package would publish successfully shortly afterward; the MCP publish should run after the PyPI publish step/job rather than racing it from an independent workflow trigger.

Useful? React with 👍 / 👎.

workflow_dispatch:

permissions: {}

jobs:
publish-mcp:
runs-on: ubuntu-latest
permissions:
id-token: write # OIDC proof that this run comes from block/model-ledger
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Sync server.json version from pyproject.toml
run: |
VERSION=$(grep -m 1 'version =' pyproject.toml | awk -F'"' '{print $2}')
jq --arg v "$VERSION" \
'.version = $v
| .packages[0].version = $v
| .packages[0].runtimeArguments[0].value = "model-ledger[mcp,cli]==" + $v' \
server.json > server.tmp && mv server.tmp server.json
echo "Publishing version $VERSION"

- name: Wait for the version to be visible on PyPI
run: |
VERSION=$(jq -r '.version' server.json)
for i in $(seq 1 30); do
curl -sf "https://pypi.org/pypi/model-ledger/${VERSION}/json" > /dev/null && exit 0
echo "PyPI does not serve ${VERSION} yet (attempt ${i}/30)"
sleep 10
done
echo "model-ledger ${VERSION} never appeared on PyPI" >&2
exit 1

- 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 (GitHub OIDC)
run: ./mcp-publisher login github-oidc

- name: Publish to MCP Registry
run: ./mcp-publisher publish
2 changes: 1 addition & 1 deletion server.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.block/model-ledger",
"title": "Model Ledger",
"description": "Model inventory and governance: discover, query, and trace deployed models and their dependency graph as an append-only event log",
"description": "Model inventory and governance: trace deployed models and their dependencies as an append-only log",
"version": "0.7.9",
"repository": {
"url": "https://github.com/block/model-ledger",
Expand Down
Loading