Skip to content

Commit fe7db9f

Browse files
ci(mcp): test the server and release via OIDC
One tag publishes to PyPI then the MCP Registry, which both trust GitHub directly, so no token is stored. The registry step retries while PyPI serves the new README.
1 parent 15f6d14 commit fe7db9f

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,21 @@ jobs:
3838
- run: uv run --group dev ruff check .
3939
- run: uv run --group dev mypy
4040
- run: uv run --group dev pytest
41+
42+
mcp:
43+
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
python: ["3.10", "3.14"]
47+
defaults:
48+
run:
49+
working-directory: mcp
50+
steps:
51+
- uses: actions/checkout@v7
52+
- uses: astral-sh/setup-uv@v10.2.0
53+
with:
54+
python-version: ${{ matrix.python }}
55+
- run: uv run --group dev ruff format --check .
56+
- run: uv run --group dev ruff check .
57+
- run: uv run --group dev mypy
58+
- run: uv run --group dev pytest

‎.github/workflows/release-mcp.yml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release MCP server
2+
3+
# Push a tag such as mcp-v0.1.0. PyPI and the MCP Registry both trust this
4+
# workflow through OIDC, so no token is stored anywhere.
5+
on:
6+
push:
7+
tags: ["mcp-v*"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: mcp
18+
steps:
19+
- uses: actions/checkout@v7
20+
- uses: astral-sh/setup-uv@v10.2.0
21+
- name: Tag, package and server.json versions agree
22+
run: |
23+
version="$(uv version --short)"
24+
test "mcp-v$version" = "$GITHUB_REF_NAME"
25+
test "$(jq -r .version server.json)" = "$version"
26+
test "$(jq -r '.packages[0].version' server.json)" = "$version"
27+
- run: uv run --group dev pytest
28+
- run: uv build
29+
- uses: actions/upload-artifact@v7
30+
with:
31+
name: mcp-dist
32+
path: mcp/dist/
33+
34+
pypi:
35+
needs: build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/project/ng-postcode-mcp/
40+
permissions:
41+
id-token: write
42+
steps:
43+
- uses: actions/download-artifact@v8
44+
with:
45+
name: mcp-dist
46+
path: dist/
47+
- uses: pypa/gh-action-pypi-publish@v1.14.2
48+
49+
registry:
50+
needs: pypi
51+
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
id-token: write
55+
defaults:
56+
run:
57+
working-directory: mcp
58+
steps:
59+
- uses: actions/checkout@v7
60+
- name: Install mcp-publisher
61+
run: |
62+
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
63+
arch="$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"
64+
curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_${os}_${arch}.tar.gz" | tar xz mcp-publisher
65+
- run: ./mcp-publisher login github-oidc
66+
# The registry reads the README from PyPI, which can lag a fresh upload.
67+
- name: Publish to the MCP Registry
68+
run: |
69+
for attempt in 1 2 3 4 5; do
70+
./mcp-publisher publish && exit 0
71+
echo "attempt $attempt failed; retrying in 30s"
72+
sleep 30
73+
done
74+
exit 1

0 commit comments

Comments
 (0)