Publish to agentregistry workflow (rohitg00/kubectl-mcp-server)
The Publish to agentregistry workflow from rohitg00/kubectl-mcp-server, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Publish to agentregistry workflow from the rohitg00/kubectl-mcp-server repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Publish to agentregistry
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.11.0)'
required: true
type: string
jobs:
publish:
name: Publish to agentregistry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Get version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=$(python setup.py --version)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"
- name: Publish to agentregistry
env:
AGENTREGISTRY_URL: ${{ vars.AGENTREGISTRY_URL || 'https://aregistry.ai' }}
run: |
VERSION="${{ steps.version.outputs.version }}"
cat > server.json << EOF
{
"\$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
"name": "io.github.rohitg00/kubectl-mcp-server",
"title": "kubectl-mcp-server",
"description": "A Model Context Protocol (MCP) server for Kubernetes with 140+ tools, 8 resources, and 8 prompts",
"version": "$VERSION",
"repository": {
"url": "https://github.com/rohitg00/kubectl-mcp-server",
"source": "github"
},
"packages": [
{
"registryType": "oci",
"identifier": "docker.io/rohitghumare64/kubectl-mcp-server:$VERSION",
"version": "$VERSION",
"transport": {
"type": "stdio"
}
},
{
"registryType": "pypi",
"identifier": "kubectl-mcp-server",
"version": "$VERSION",
"runtimeHint": "uvx",
"transport": {
"type": "stdio"
}
},
{
"registryType": "npm",
"identifier": "kubectl-mcp-server",
"version": "$VERSION",
"runtimeHint": "npx",
"transport": {
"type": "stdio"
}
}
]
}
EOF
echo "Server payload:"
cat server.json
echo "Creating server in agentregistry..."
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "${AGENTREGISTRY_URL}/admin/v0/servers" \
-H "Content-Type: application/json" \
-d @server.json)
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')
echo "Response: $BODY"
echo "HTTP Code: $HTTP_CODE"
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
echo "Server created/updated successfully"
echo "Publishing server..."
PUBLISH_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
"${AGENTREGISTRY_URL}/admin/v0/servers/io.github.rohitg00%2Fkubectl-mcp-server/versions/${VERSION}/publish")
PUB_HTTP_CODE=$(echo "$PUBLISH_RESPONSE" | tail -n1)
PUB_BODY=$(echo "$PUBLISH_RESPONSE" | sed '$d')
echo "Publish response: $PUB_BODY"
echo "Publish HTTP Code: $PUB_HTTP_CODE"
if [ "$PUB_HTTP_CODE" -ge 200 ] && [ "$PUB_HTTP_CODE" -lt 300 ]; then
echo "Server published successfully to agentregistry!"
else
echo "Warning: Failed to publish server (may already be published)"
fi
else
echo "Warning: Failed to create server in agentregistry"
echo "This may be expected if the registry requires authentication"
fi
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Publish to agentregistry on: release: types: [published] workflow_dispatch: inputs: version: description: 'Version to publish (e.g., 1.11.0)' required: true type: string jobs: publish: timeout-minutes: 30 name: Publish to agentregistry runs-on: latchkey-small steps: - uses: actions/checkout@v4 with: ref: ${{ github.ref }} - name: Get version id: version run: | if [ -n "${{ github.event.inputs.version }}" ]; then VERSION="${{ github.event.inputs.version }}" else VERSION=$(python setup.py --version) fi echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Publishing version: $VERSION" - name: Publish to agentregistry env: AGENTREGISTRY_URL: ${{ vars.AGENTREGISTRY_URL || 'https://aregistry.ai' }} run: | VERSION="${{ steps.version.outputs.version }}" cat > server.json << EOF { "\$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json", "name": "io.github.rohitg00/kubectl-mcp-server", "title": "kubectl-mcp-server", "description": "A Model Context Protocol (MCP) server for Kubernetes with 140+ tools, 8 resources, and 8 prompts", "version": "$VERSION", "repository": { "url": "https://github.com/rohitg00/kubectl-mcp-server", "source": "github" }, "packages": [ { "registryType": "oci", "identifier": "docker.io/rohitghumare64/kubectl-mcp-server:$VERSION", "version": "$VERSION", "transport": { "type": "stdio" } }, { "registryType": "pypi", "identifier": "kubectl-mcp-server", "version": "$VERSION", "runtimeHint": "uvx", "transport": { "type": "stdio" } }, { "registryType": "npm", "identifier": "kubectl-mcp-server", "version": "$VERSION", "runtimeHint": "npx", "transport": { "type": "stdio" } } ] } EOF echo "Server payload:" cat server.json echo "Creating server in agentregistry..." RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "${AGENTREGISTRY_URL}/admin/v0/servers" \ -H "Content-Type: application/json" \ -d @server.json) HTTP_CODE=$(echo "$RESPONSE" | tail -n1) BODY=$(echo "$RESPONSE" | sed '$d') echo "Response: $BODY" echo "HTTP Code: $HTTP_CODE" if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then echo "Server created/updated successfully" echo "Publishing server..." PUBLISH_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \ "${AGENTREGISTRY_URL}/admin/v0/servers/io.github.rohitg00%2Fkubectl-mcp-server/versions/${VERSION}/publish") PUB_HTTP_CODE=$(echo "$PUBLISH_RESPONSE" | tail -n1) PUB_BODY=$(echo "$PUBLISH_RESPONSE" | sed '$d') echo "Publish response: $PUB_BODY" echo "Publish HTTP Code: $PUB_HTTP_CODE" if [ "$PUB_HTTP_CODE" -ge 200 ] && [ "$PUB_HTTP_CODE" -lt 300 ]; then echo "Server published successfully to agentregistry!" else echo "Warning: Failed to publish server (may already be published)" fi else echo "Warning: Failed to create server in agentregistry" echo "This may be expected if the registry requires authentication" fi
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.