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
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
</a>
</div>

<!-- mcp-name: io.github.CopperPilot/copper-pilot-cli -->

<div align="center">
<h3>The AI for PCB design, in your terminal, and an MCP server for Claude Code, Cursor and Codex.</h3>
</div>
Expand Down
15 changes: 15 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
(<https://registry.modelcontextprotocol.io>) 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
`<!-- mcp-name: io.github.CopperPilot/copper-pilot-cli -->` 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"`.
30 changes: 30 additions & 0 deletions server.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
43 changes: 43 additions & 0 deletions tests/test_mcp_registry.py
Original file line number Diff line number Diff line change
@@ -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: <server 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/")
Loading