Skip to content

Commit b0a48a1

Browse files
authored
Merge pull request #33 from j4th/fix/smithery-metadata-ci
Centralize description and add Smithery metadata to CI
2 parents 66dc370 + a18739e commit b0a48a1

5 files changed

Lines changed: 42 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,27 @@ jobs:
5151

5252
- uses: jdx/mise-action@v4
5353

54-
- name: Verify server.json version matches pyproject.toml
54+
- name: Verify server.json matches pyproject.toml
5555
run: |
56-
PKG_VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
57-
SERVER_VERSION=$(python3 -c "import json; print(json.load(open('server.json'))['version'])")
58-
PACKAGE_VERSION=$(python3 -c "import json; print(json.load(open('server.json'))['packages'][0]['version'])")
59-
echo "pyproject.toml: $PKG_VERSION"
60-
echo "server.json version: $SERVER_VERSION"
61-
echo "server.json packages[0].version: $PACKAGE_VERSION"
62-
if [ "$PKG_VERSION" != "$SERVER_VERSION" ] || [ "$PKG_VERSION" != "$PACKAGE_VERSION" ]; then
63-
echo "::error::Version mismatch! Update server.json to match pyproject.toml ($PKG_VERSION)"
64-
exit 1
65-
fi
56+
python3 -c "
57+
import json, tomllib, sys
58+
proj = tomllib.load(open('pyproject.toml', 'rb'))['project']
59+
sj = json.load(open('server.json'))
60+
errors = []
61+
# Version check
62+
for path, val in [('version', sj['version']), ('packages[0].version', sj['packages'][0]['version'])]:
63+
if val != proj['version']:
64+
errors.append(f'server.json {path} ({val}) != pyproject.toml ({proj[\"version\"]})')
65+
# Description check
66+
if sj.get('description', '') != proj['description']:
67+
errors.append(f'server.json description does not match pyproject.toml')
68+
errors.append(f' server.json: {sj.get(\"description\", \"\")}')
69+
errors.append(f' pyproject.toml: {proj[\"description\"]}')
70+
if errors:
71+
for e in errors: print(f'::error::{e}')
72+
sys.exit(1)
73+
print(f'OK: version={proj[\"version\"]}, description matches')
74+
"
6675
6776
- name: Verify smithery.yaml matches SmitheryConfig
6877
run: uv run python scripts/check_smithery_schema.py

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,8 @@ jobs:
121121
npx -y @smithery/cli mcp publish "https://mtg-mcp-server.fastmcp.app/mcp" \
122122
-n @j4th/mtg-mcp-server \
123123
--config-schema /tmp/smithery-config-schema.json
124+
125+
- name: Sync registry metadata from pyproject.toml
126+
env:
127+
SMITHERY_API_KEY: ${{ secrets.SMITHERY_API_KEY }}
128+
run: bash scripts/update_smithery_metadata.sh

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "mtg-mcp-server"
33
version = "1.2.3"
4-
description = "Unified MCP server providing Magic: The Gathering data to AI assistants"
4+
description = "Magic: The Gathering card search, combo lookup, draft analytics, and Commander tools."
55
readme = "README.md"
66
license = "MIT"
77
authors = [{ name = "Justin Forth", email = "justinforth@gmail.com" }]

scripts/update_smithery_metadata.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
#!/usr/bin/env bash
22
# Update Smithery registry metadata for mtg-mcp-server.
3+
# Reads description from pyproject.toml (single source of truth).
34
# Requires SMITHERY_API_KEY env var (get via: npx @smithery/cli auth token)
45
set -euo pipefail
56
: "${SMITHERY_API_KEY:?Set SMITHERY_API_KEY (run: npx @smithery/cli auth token)}"
67
SERVER="j4th/mtg-mcp-server"
78
API="https://api.smithery.ai/servers/${SERVER}"
89

10+
# Build JSON payload from pyproject.toml (single source of truth for PyPI, MCP Registry, Smithery)
11+
PAYLOAD=$(python3 -c "
12+
import json, tomllib
13+
proj = tomllib.load(open('pyproject.toml', 'rb'))['project']
14+
print(json.dumps({
15+
'displayName': 'MTG MCP Server',
16+
'description': proj['description'],
17+
'homepage': proj['urls']['Homepage'],
18+
}))
19+
")
20+
921
echo "Updating metadata for ${SERVER}..."
22+
echo " Payload: ${PAYLOAD}"
1023

1124
# PATCH display name, description, homepage
1225
HTTP_CODE=$(curl -sS -o /tmp/smithery_resp.json -w "%{http_code}" -X PATCH "$API" \
1326
-H "Authorization: Bearer $SMITHERY_API_KEY" \
1427
-H "Content-Type: application/json" \
15-
-d '{
16-
"displayName": "MTG MCP Server",
17-
"description": "Magic: The Gathering data for AI — cards, combos, draft analytics, and Commander tools.",
18-
"homepage": "https://github.com/j4th/mtg-mcp-server"
19-
}')
28+
-d "$PAYLOAD")
2029
if [[ "$HTTP_CODE" != 2* ]]; then
2130
echo "ERROR: PATCH metadata failed with HTTP $HTTP_CODE:" >&2
2231
cat /tmp/smithery_resp.json >&2
@@ -29,8 +38,7 @@ echo " ✓ Metadata updated"
2938
[[ -f icon.svg ]] || { echo "ERROR: icon.svg not found in $(pwd)" >&2; exit 1; }
3039
HTTP_CODE=$(curl -sS -o /tmp/smithery_resp.json -w "%{http_code}" -X PUT "$API/icon" \
3140
-H "Authorization: Bearer $SMITHERY_API_KEY" \
32-
-H "Content-Type: image/svg+xml" \
33-
--data-binary @icon.svg)
41+
-F "icon=@icon.svg;type=image/svg+xml")
3442
if [[ "$HTTP_CODE" != 2* ]]; then
3543
echo "ERROR: PUT icon failed with HTTP $HTTP_CODE:" >&2
3644
cat /tmp/smithery_resp.json >&2

server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
33
"name": "io.github.j4th/mtg-mcp-server",
44
"title": "MTG MCP Server",
5-
"description": "Magic: The Gathering data for AI — cards, combos, draft analytics, and Commander tools.",
5+
"description": "Magic: The Gathering card search, combo lookup, draft analytics, and Commander tools.",
66
"websiteUrl": "https://github.com/j4th/mtg-mcp-server",
77
"icons": [
88
{

0 commit comments

Comments
 (0)