From a8f60aebb3afdbbe700b3e29efc4aae4ea58176b Mon Sep 17 00:00:00 2001 From: AdityaNG Date: Tue, 1 Dec 2026 13:04:34 +0530 Subject: [PATCH] Publish copper-pilot mcp to the official MCP Registry on each release - server.json: io.github.CopperPilot/copper-pilot-cli, PyPI copper-pilot-cli, run as 'uvx copper-pilot-cli mcp' (stdio). Validated with mcp-publisher 1.8.21. - README carries the mcp-name ownership line the registry checks on PyPI. - release.yml: an mcp-registry job after the PyPI upload: pinned, cosign-verified mcp-publisher, tag version written into server.json, waits for PyPI, GitHub OIDC login (org namespace, no secret), publish with retries. - tests/test_mcp_registry.py keeps server.json, README and pyproject consistent. --- .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ README.md | 2 + docs/development.md | 15 ++++++++ server.json | 30 +++++++++++++++ tests/test_mcp_registry.py | 43 +++++++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 server.json create mode 100644 tests/test_mcp_registry.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b92f58..72ea7be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,3 +87,73 @@ jobs: dist/* release-notice.json body_path: HISTORY.md + + # List the release in the official MCP Registry (registry.modelcontextprotocol.io) as + # io.github.CopperPilot/copper-pilot-cli. GitHub OIDC proves the CopperPilot org namespace + # (no secret); the registry proves PyPI ownership through the `mcp-name:` line in README.md, + # so it runs after the PyPI upload. Versions are immutable: each tag publishes once. + mcp-registry: + needs: release + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + env: + MCP_PUBLISHER_VERSION: v1.8.21 + steps: + - uses: actions/checkout@v7 + + - name: Install cosign + uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 + + - name: Download and verify mcp-publisher + run: | + set -euo pipefail + archive="mcp-publisher_linux_amd64.tar.gz" + base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}" + curl --fail --location --silent --show-error --output "$archive" "$base_url/$archive" + curl --fail --location --silent --show-error --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json" + cosign verify-blob \ + --bundle "$archive.sigstore.json" \ + --certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \ + --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \ + "$archive" + tar xzf "$archive" mcp-publisher + rm -f "$archive" "$archive.sigstore.json" + + - name: Set the release version in server.json + run: | + set -euo pipefail + VERSION="${GITHUB_REF_NAME}" + jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.tmp + mv server.tmp server.json + ./mcp-publisher validate server.json + + - name: Wait for the release on PyPI + run: | + set -euo pipefail + for attempt in $(seq 1 30); do + if curl --fail --silent "https://pypi.org/pypi/copper-pilot-cli/${GITHUB_REF_NAME}/json" > /dev/null; then + echo "copper-pilot-cli ${GITHUB_REF_NAME} is on PyPI" + exit 0 + fi + sleep 10 + done + echo "copper-pilot-cli ${GITHUB_REF_NAME} did not appear on PyPI" >&2 + exit 1 + + - name: Authenticate to the MCP Registry + run: ./mcp-publisher login github-oidc + + - name: Publish to the MCP Registry + run: | + set -euo pipefail + # PyPI's JSON API can lag behind the upload; the ownership check reads it. + for attempt in 1 2 3 4 5; do + if ./mcp-publisher publish server.json; then + exit 0 + fi + echo "Publish attempt ${attempt} failed; retrying in 30 s" + sleep 30 + done + exit 1 diff --git a/README.md b/README.md index 9e88449..b03a36c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ + +

The AI for PCB design, in your terminal, and an MCP server for Claude Code, Cursor and Codex.

diff --git a/docs/development.md b/docs/development.md index 2a9c117..9ed08f0 100644 --- a/docs/development.md +++ b/docs/development.md @@ -128,3 +128,18 @@ make release # prompts for X.Y.Z ``` The tag must match `VERSION`. See `.github/workflows/release.yml`. + +### MCP Registry + +After the PyPI upload, the `mcp-registry` job in `release.yml` publishes +[`server.json`](../server.json) to the official MCP Registry +() as +`io.github.CopperPilot/copper-pilot-cli`, with the tag's version written into it. +It signs in with GitHub Actions OIDC (the CopperPilot org namespace; no secret). +The registry proves we own the PyPI package by finding the +`` line in `README.md`, +so keep that line. Registry versions are immutable: a tag publishes once. +Clients start the server with `uvx copper-pilot-cli mcp`. + +Check a release with +`curl -s "https://registry.modelcontextprotocol.io/v0/servers?search=copper-pilot-cli"`. diff --git a/server.json b/server.json new file mode 100644 index 0000000..fd1f396 --- /dev/null +++ b/server.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", + "name": "io.github.CopperPilot/copper-pilot-cli", + "title": "CopperPilot", + "description": "AI PCB design: 160 tools to design, edit, route and check KiCad and Altium boards", + "version": "1.0.6", + "websiteUrl": "https://copperpilot.ai/mcp", + "repository": { + "url": "https://github.com/CopperPilot/copper-pilot-cli", + "source": "github" + }, + "packages": [ + { + "registryType": "pypi", + "registryBaseUrl": "https://pypi.org", + "identifier": "copper-pilot-cli", + "version": "1.0.6", + "runtimeHint": "uvx", + "transport": { + "type": "stdio" + }, + "packageArguments": [ + { + "type": "positional", + "value": "mcp" + } + ] + } + ] +} diff --git a/tests/test_mcp_registry.py b/tests/test_mcp_registry.py new file mode 100644 index 0000000..3b741be --- /dev/null +++ b/tests/test_mcp_registry.py @@ -0,0 +1,43 @@ +"""server.json (the official MCP Registry entry) stays consistent with the package. + +The registry proves PyPI ownership by finding ``mcp-name: `` in the +README that becomes the PyPI description; the release workflow writes the tag's +version into server.json before publishing. +""" + +from __future__ import annotations + +import json +import re +import tomllib +from pathlib import Path + +ROOT = Path(__file__).parents[1] +SERVER = json.loads((ROOT / "server.json").read_text(encoding="utf-8")) + + +def test_readme_carries_the_ownership_line() -> None: + readme = (ROOT / "README.md").read_text(encoding="utf-8") + # The token must end at a boundary: whitespace, a tag or the comment close. + pattern = re.escape(f"mcp-name: {SERVER['name']}") + r"(?=\s|<|-->|$)" + assert re.search(pattern, readme), "README.md must contain the mcp-name line" + + +def test_package_points_at_this_project() -> None: + project = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))["project"] + assert SERVER["name"].startswith("io.github.CopperPilot/") + package = SERVER["packages"][0] + assert package["registryType"] == "pypi" + assert package["registryBaseUrl"] == "https://pypi.org" + assert package["identifier"] == project["name"] + assert package["runtimeHint"] == "uvx" + assert package["transport"] == {"type": "stdio"} + # `uvx copper-pilot-cli mcp` runs the copper-pilot-cli script with the mcp subcommand. + assert package["packageArguments"] == [{"type": "positional", "value": "mcp"}] + assert "copper-pilot-cli" in project["scripts"] + assert package["version"] == SERVER["version"] + + +def test_registry_limits() -> None: + assert 0 < len(SERVER["description"]) <= 100 # the registry rejects longer descriptions + assert SERVER["$schema"].startswith("https://static.modelcontextprotocol.io/schemas/")