Skip to content

fix(server.json): fix MCP Registry validation errors #47

fix(server.json): fix MCP Registry validation errors

fix(server.json): fix MCP Registry validation errors #47

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches: [main]
tags:
- "*"
paths:
- .github/**
- src/**
- tests/**
- pyproject.toml
pull_request:
branches: [main]
paths:
- .github/**
- src/**
- tests/**
- pyproject.toml
permissions:
contents: write # Required for GitHub Release creation
id-token: write # Required for Trusted Publishing (only used in publish job)
jobs:
lint-check:
name: Code style check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Run check
run: |
uvx ruff format --check .
uvx ruff check .
type-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
run: uv sync --group type
- name: Run mypy
run: uv run mypy
test:
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
needs: [lint-check, type-check]
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Run tests
run: |
uv sync --group test
uv run pytest --cov=src/u2mcp --cov-branch --cov-report=term-missing --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
slug: tanbro/uiautomator2-mcp-server
# Deploy jobs - only run on valid version tags
validate-tag:
name: Validate Tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check tag format (PEP 440)
id: check
run: |
python3 -m pip install --disable-pip-version-check packaging
python3 .github/scripts/validate_version.py
env:
GITHUB_REF: ${{ github.ref }}
build:
name: Build Distribution
runs-on: ubuntu-latest
needs: [test, validate-tag]
if: needs.validate-tag.outputs.version != ''
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Build package
run: uv build
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ needs.validate-tag.outputs.version }}
- name: Store the distribution packages
uses: actions/upload-artifact@v6
with:
name: python-package-distributions
path: dist/
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [validate-tag, build]
if: needs.validate-tag.outputs.version != ''
environment:
name: pypi
url: https://pypi.org/p/uiautomator2-mcp-server
steps:
- name: Download distribution packages
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [validate-tag, build]
if: needs.validate-tag.outputs.version != ''
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download distribution packages
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Generate release notes from CHANGELOG
id: release_notes
run: |
VERSION="${{ needs.validate-tag.outputs.version }}"
awk -v version="$VERSION" '
/^##[[:space:]]*$version/ { in_release=1; next }
in_release && /^##[[:space:]]/ { exit }
in_release { print }
' CHANGELOG.md > release_notes.md
{
echo "notes<<EOF"
cat release_notes.md
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
name: v${{ needs.validate-tag.outputs.version }}
body: ${{ steps.release_notes.outputs.notes }}
files: dist/*
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish to Official MCP Registry
# Must run after PyPI publish because registry validates package ownership via PyPI
mcp-registry-publish:
name: Publish to MCP Registry
runs-on: ubuntu-latest
needs: [validate-tag, build, publish]
if: needs.validate-tag.outputs.version != ''
permissions:
id-token: write # Required for GitHub OIDC authentication
steps:
- uses: actions/checkout@v6
- name: Download distribution packages
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Update server.json version
run: |
VERSION="${{ needs.validate-tag.outputs.version }}"
# Update version in server.json to match tag
jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.json.tmp
mv server.json.tmp server.json
- name: Install MCP Publisher CLI
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher
chmod +x mcp-publisher
- name: Login to MCP Registry (GitHub OIDC)
run: ./mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: ./mcp-publisher publish