From 1c4d2a5a43703665a5cd8a369094837c65f756b2 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:50:43 -1000 Subject: [PATCH 1/9] Pin nimblebrain-server-sdk 0.8, for the Server Card --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d23b27c..ee6967e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ dependencies = [ "aiohttp>=3.11.0", "fastmcp>=4.0.0", - "nimblebrain-server-sdk>=0.7,<0.8", + "nimblebrain-server-sdk>=0.8,<0.9", "pydantic>=2.0.0", "python-dotenv>=1.0.0", ] From 5afb9551c73c680b2ce04280ec31d0437446527a Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:51:05 -1000 Subject: [PATCH 2/9] Name the server in reverse-DNS form and serve its Server Card --- src/mcp_example/server.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mcp_example/server.py b/src/mcp_example/server.py index 47653a7..ec3873b 100644 --- a/src/mcp_example/server.py +++ b/src/mcp_example/server.py @@ -5,7 +5,8 @@ Getting started: 1. Rename this package from mcp_example to mcp_ -2. Update manifest.json, server.json, pyproject.toml with your service info +2. Update manifest.json, server.json, pyproject.toml with your service info, and the + server's name, TITLE and DESCRIPTION below (server.json restates them) 3. Implement your API client in api_client.py 4. Add Pydantic models in api_models.py 5. Add tools below using @mcp.tool(annotations=...) @@ -28,6 +29,7 @@ PREVIEW_CHARS, READS, add_error_contract, + add_server_card, add_skills, listing_row, ) @@ -35,6 +37,7 @@ from starlette.requests import Request from starlette.responses import JSONResponse +from mcp_example import __version__ from mcp_example.api_client import ExampleAPIError, ExampleClient # Logging setup - all logs to stderr (stdout is reserved for JSON-RPC). Diagnostics go @@ -55,9 +58,15 @@ MAX_LIMIT = 100 -# Create MCP server +# The Server Card's title and description, restated in server.json (a test holds them equal). +TITLE = "Example" +DESCRIPTION = "List and read items from the Example API." + +# The name is reverse-DNS (the Server Card and the MCP Registry require it), and the version +# is the package's own: without `version=`, FastMCP reports its own version as the server's. mcp = FastMCP( - "Example", + "com.example/example", + version=__version__, instructions=( "Before using tools, read the skill://example/SKILL.md resource " "for tool selection guidance and workflow patterns." @@ -66,6 +75,9 @@ # A ServiceError a tool raises reaches the caller as an error result with its code. add_error_contract(mcp) add_skills(mcp, [SKILLS_DIR / "example"]) +# What a host reads, at /server-card, before it connects. A connector has no +# placements; an app's server passes `placements=[...]` for its ui:// views. +add_server_card(mcp, title=TITLE, description=DESCRIPTION) # Global client instance (lazy initialization) _client: ExampleClient | None = None From 71d9b1b7e4912d455b2a4b9f618b279ec16b6c2f Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:51:22 -1000 Subject: [PATCH 3/9] Write server.json as an MCP Registry ServerDetail --- server.json | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/server.json b/server.json index 28d1a15..241bcc1 100644 --- a/server.json +++ b/server.json @@ -1,7 +1,17 @@ { - "name": "@nimblebraininc/example", + "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", + "name": "com.example/example", + "title": "Example", + "description": "List and read items from the Example API.", "version": "0.1.0", - "description": "MCP server for the Example API", - "publisher": "nimblebraininc", - "repository": "https://github.com/NimbleBrainInc/mcp-example" + "repository": { + "url": "https://github.com/NimbleBrainInc/mcp-example", + "source": "github" + }, + "remotes": [ + { + "type": "streamable-http", + "url": "https://mcp.example.com/mcp" + } + ] } From e52c9ca21d4387ab227955c59f8dfadd6e15dc38 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:51:28 -1000 Subject: [PATCH 4/9] Test that server.json agrees with the served Server Card --- tests/test_server_card.py | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test_server_card.py diff --git a/tests/test_server_card.py b/tests/test_server_card.py new file mode 100644 index 0000000..b5b3066 --- /dev/null +++ b/tests/test_server_card.py @@ -0,0 +1,43 @@ +"""The Server Card a host reads before it connects, and the server.json that restates it. + +The code is the one source of the server's metadata: the card is built from `FastMCP(...)` +and `add_server_card(...)`, and server.json, which an operator adds to a connectors catalog +and the MCP Registry lists, must say the same. +""" + +import json +from pathlib import Path + +import httpx2 +from nimblebrain_server_sdk import SERVER_CARD_MEDIA_TYPE + +from mcp_example import __version__ +from mcp_example.server import mcp + +SERVER_JSON = Path(__file__).parent.parent / "server.json" + + +async def served_card() -> dict: + """Fetch the card the way a host does, from the streamable-HTTP app, in process.""" + transport = httpx2.ASGITransport(app=mcp.http_app()) + async with httpx2.AsyncClient(transport=transport, base_url="http://127.0.0.1") as http: + response = await http.get("/mcp/server-card", headers={"accept": SERVER_CARD_MEDIA_TYPE}) + assert response.status_code == 200 + assert response.headers["content-type"] == SERVER_CARD_MEDIA_TYPE + return response.json() + + +async def test_the_card_names_the_package_version(): + """Without `version=`, FastMCP would report its own version as the server's.""" + card = await served_card() + assert card["version"] == __version__ + + +async def test_server_json_agrees_with_the_card(): + card = await served_card() + server_json = json.loads(SERVER_JSON.read_text()) + for field in ("name", "version", "title", "description"): + assert server_json[field] == card[field], field + # A connector has no placements, so neither carries a host block. + assert "_meta" not in card + assert "_meta" not in server_json From 02e4a85964c8364d5e6f4a2dfd8d1ee357cc1107 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:51:50 -1000 Subject: [PATCH 5/9] Bind make run-http to loopback by default --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4d4af7c..7a2f6a3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ # MCPB bundle configuration BUNDLE_NAME = mcp-example VERSION ?= 0.1.0 +# run-http binds loopback. On Linux, a NimbleBrain in Docker reaches the host through the +# Docker bridge: HOST=172.17.0.1, or HOST=0.0.0.0, which also exposes the server to the network. +HOST ?= 127.0.0.1 +PORT ?= 8000 .PHONY: help install dev-install format format-check lint lint-fix typecheck test test-integration test-llm test-cov clean run run-http check all bump bundle @@ -57,8 +61,8 @@ clean: ## Clean up build artifacts and cache run: ## Run the MCP server in stdio mode uv run python -m mcp_example.server -run-http: ## Run the MCP server in HTTP mode - uv run uvicorn mcp_example.server:app --host 0.0.0.0 --port 8000 +run-http: ## Run the MCP server over HTTP at http://$(HOST):$(PORT)/mcp (HOST defaults to 127.0.0.1) + uv run uvicorn mcp_example.server:app --host $(HOST) --port $(PORT) check: format-check lint typecheck test ## Run all checks From 10fa1bf1e7e7f6ccb1129f383c2f88652c5c0f62 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:52:23 -1000 Subject: [PATCH 6/9] Document the Server Card, server.json and the loopback run-http --- CLAUDE.md | 23 ++++++++++++++++++++++- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 9a983dd..a2f4d5b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,11 +23,13 @@ Use it instead of writing these by hand: - **Errors**: a tool reports a failure by raising `ServiceError(ErrorCode.X, "...")` from `nimblebrain_server_sdk.errors`. `add_error_contract(mcp)`, called once where the server is built, returns it to the caller as an error result with its code. Never return a dict that describes an error (a host and a model score it as a success), and never raise `ValueError` for a caller's mistake. Classify an API failure with `ServiceError.from_upstream(status, detail=...)`; the API's own text goes in `detail` (logged), never in the message. ([Errors](https://docs.nimblebrain.ai/server-sdk/errors/)) - **Skills**: a skill is a directory under `skills/` whose name equals the `name` in its `SKILL.md` frontmatter, registered in the one `add_skills(mcp, [...])` call. Do not serve a `skill://` resource by hand. ([Skills](https://docs.nimblebrain.ai/server-sdk/skills/)) - **Listings**: a listing tool builds each row with `listing_row`, with a `uri` and a preview in place of any unbounded text field. The `uri` must resolve: a resource template (`example://items/{item_id}`) returns the whole record. +- **Server Card**: `add_server_card(mcp, title=..., description=...)` serves the card a host reads before it connects, at `/server-card`. `name` and `version` come from `FastMCP("com.example/example", version=__version__)`: the name is reverse-DNS with one slash, and `version=` is required (without it FastMCP reports its own version). A connector passes no `placements`; an app's server passes them for its `ui://` views. ([Server Card](https://docs.nimblebrain.ai/server-sdk/server-card/)) - **Tests**: run each test that crosses the wire on both protocol versions (`Client(mcp, mode="auto")` and `mode="legacy"`), annotate the parametrized `mode` with `Mode` from `nimblebrain_server_sdk.testing`, check skills with `served_skills` and listing rows with `assert_bounded_rows`. ([Testing](https://docs.nimblebrain.ai/server-sdk/testing/)) ## Critical -- Package name: `@nimblebraininc/example` (npm-style scope, matches GitHub org) +- Bundle name: `@nimblebraininc/example` in `manifest.json` (npm-style scope, matches GitHub org) +- Server name: `com.example/example` (reverse-DNS), the same in `FastMCP(...)` and `server.json` - Manifest uses module execution: `python -m mcp_example.server` - Server needs both entrypoints: ```python @@ -38,6 +40,18 @@ Use it instead of writing these by hand: - All logs to stderr (stdout is reserved for JSON-RPC) - A failure the caller must see is a raised `ServiceError`; never log to the client with `ctx.info`/`ctx.error` (MCP's logging capability is deprecated as of 2026-07-28, SEP-2577) +## server.json + +`server.json` is an MCP Registry `ServerDetail` (`$schema` names the 2025-12-11 +`server.schema.json`): what an operator adds to a deployed NimbleBrain's connectors catalog +and what `mcp-publisher` lists on the official MCP Registry. It restates the Server Card's +`name`, `title`, `description` and `version`, and adds `remotes`, the deployed +streamable-HTTP URL (a placeholder until the server is deployed). `tests/test_server_card.py` +holds it equal to the served card. + +- A connector carries no `_meta`. An app adds `_meta["ai.nimblebrain/host"]` with the card's placements. +- Add `packages` only once the server is published to PyPI; the bundle release does not publish one. + ## user_config API key configured via manifest `user_config`, not hardcoded: @@ -74,8 +88,13 @@ uv run ruff check src/ tests/ # Lint uv run ty check src/ # Type check uv run pytest tests/ -v # Test make check # All of the above +make run-http # Serve at http://127.0.0.1:8000/mcp (card at /mcp/server-card) ``` +`make run-http` binds loopback. On Linux, a NimbleBrain running in Docker reaches the host +through the Docker bridge: `make run-http HOST=172.17.0.1`, or `HOST=0.0.0.0`, which also +exposes the server to the network. + ## Version Management Version lives in four files that MUST stay in sync: @@ -102,6 +121,8 @@ GitHub Actions builds and uploads MCPB bundles automatically on release. ## Adding New Tools +Design the tool first with the `mcp-server` skill (`npx skills add nimblebraininc/skills --skill mcp-server --agent claude-code -y`), then: + 1. Add response model to `api_models.py` 2. Add client method to `api_client.py` 3. Add `@mcp.tool(annotations=...)` function to `server.py` diff --git a/README.md b/README.md index 07a981b..9b56cad 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ An MCP (Model Context Protocol) server that provides access to the Example API, - List and retrieve items from the Example API - Async HTTP client with error handling - Typed responses with Pydantic models -- Built on the [NimbleBrain server SDK](#built-on-the-nimblebrain-server-sdk): annotated tools, classified errors, and a skill served to the host +- Built on the [NimbleBrain server SDK](#built-on-the-nimblebrain-server-sdk): annotated tools, classified errors, a skill served to the host, and a Server Card ## Installation @@ -83,6 +83,7 @@ for what every server on NimbleBrain shares. Start with the | Declares what each tool can change | `READS`, `ADDS`, `CHANGES` | [Quickstart](https://docs.nimblebrain.ai/server-sdk/quickstart/) | | Returns a failure with a code the caller can act on | `add_error_contract`, `ServiceError`, `ErrorCode` | [Errors](https://docs.nimblebrain.ai/server-sdk/errors/) | | Serves the skill in `src/mcp_example/skills/` | `add_skills` | [Skills](https://docs.nimblebrain.ai/server-sdk/skills/) | +| Names and describes itself to a host before it connects | `add_server_card` | [Server Card](https://docs.nimblebrain.ai/server-sdk/server-card/) | | Tests what a host sees, on both protocol versions | `Mode`, `served_skills`, `assert_bounded_rows` | [Testing](https://docs.nimblebrain.ai/server-sdk/testing/) | ### A tool @@ -98,7 +99,7 @@ from fastmcp import FastMCP from nimblebrain_server_sdk import ADDS, add_error_contract from nimblebrain_server_sdk.errors import ErrorCode, ServiceError -mcp = FastMCP("Example") +mcp = FastMCP("com.example/example", version="0.1.0") add_error_contract(mcp) ITEMS: dict[str, str] = {} @@ -129,7 +130,7 @@ from pathlib import Path from fastmcp import FastMCP from nimblebrain_server_sdk import add_skills -mcp = FastMCP("Example") +mcp = FastMCP("com.example/example", version="0.1.0") add_skills(mcp, [Path("src/mcp_example/skills/example")]) ``` @@ -164,6 +165,37 @@ async def test_an_empty_item_id_is_bad_input(mode: Mode) -> None: `tests/test_server.py` holds the full set. +### A Server Card + +A host that has only the server's URL reads its Server Card, at `/server-card`, +to name and describe it before it connects. `name` and `version` come from the `FastMCP` +constructor, so the server is named in reverse-DNS form and given its own version (without +`version=`, FastMCP reports its own). `title` and `description` are 1 to 100 characters: + +```python +from fastmcp import FastMCP +from nimblebrain_server_sdk import add_server_card + +from mcp_example import __version__ + +mcp = FastMCP("com.example/example", version=__version__) +add_server_card(mcp, title="Example", description="List and read items from the Example API.") +``` + +The card is served over streamable HTTP only: `make run-http`, then +`curl -s http://127.0.0.1:8000/mcp/server-card`. This server is a connector, so the card has +no `placements`; an app's server passes them for its `ui://` views. + +## Deploying: server.json + +`server.json` is an [MCP Registry `ServerDetail`](https://github.com/modelcontextprotocol/registry/blob/main/docs/reference/server-json/generic-server-json.md): +what an operator adds to a deployed NimbleBrain's +[connectors catalog](https://docs.nimblebrain.ai/config/connectors-catalog/), and what +`mcp-publisher` lists on the official MCP Registry. It restates the card's `name`, `title`, +`description` and `version`, and adds `remotes`, the URL the server is deployed at. Replace +the placeholder `https://mcp.example.com/mcp` with yours. `tests/test_server_card.py` fails +when `server.json` and the served card disagree, and `make bump` moves both versions together. + ## Development ```bash @@ -184,8 +216,15 @@ uv run ty check src/ # Run all checks make check + +# Serve over HTTP at http://127.0.0.1:8000/mcp +make run-http ``` +`make run-http` binds loopback. On Linux, a NimbleBrain running in Docker reaches the host +through the Docker bridge: `make run-http HOST=172.17.0.1`, or `HOST=0.0.0.0`, which also +exposes the server to the network. + ## License MIT From 42ddf3498784dbe51d7a1b3cdb1a471777b8a965 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:52:31 -1000 Subject: [PATCH 7/9] Point CONTRIBUTING at the mcp-server skill and the gates CI runs --- CONTRIBUTING.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6af92ac..3084ccf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,28 +26,34 @@ make check ### Recommended Claude Code Skill -The `mcpb` skill builds a server from this template end to end: +The `mcp-server` skill builds a server from this template end to end: it designs the tools +before code, implements them with `nimblebrain-server-sdk`, tests them, serves the server over +HTTP with its Server Card, and writes `server.json`. It also reviews an existing server's tools. ```bash -npx skills add nimblebraininc/skills --skill mcpb --agent claude-code -y +npx skills add nimblebraininc/skills --skill mcp-server --agent claude-code -y ``` ## Development Workflow ### Adding a New Tool +Design the tool before writing it, the way the `mcp-server` skill does: a name and a +description that say when to call it, a `description` on every parameter, bounded results, +and one annotation. Then: + 1. **Add response models** to `src/mcp_example/api_models.py` 2. **Add client methods** to `src/mcp_example/api_client.py` 3. **Add the tool** to `src/mcp_example/server.py` using `@mcp.tool(annotations=...)` 4. **Describe the tool** in `src/mcp_example/skills/example/SKILL.md` -5. **Add tests** to `tests/`, run on both protocol versions +5. **Add tests** to `tests/`, run on both protocol versions: the success path and each failure, checking the error code 6. **Run checks**: `make check` ### Tool Design Guidelines - One tool per API operation (`list_items`, `get_item`, `create_item`) - Clear docstrings with Args/Returns sections -- Annotate every tool with `READS`, `ADDS` or `CHANGES` from `nimblebrain_server_sdk` +- Annotate every tool with `READS` (reads and changes nothing), `ADDS` (writes without losing anything) or `CHANGES` (overwrites, removes, sends) from `nimblebrain_server_sdk`. A tool with no annotation reads to a host as a destructive write - Report a failure the caller must see by raising `ServiceError(ErrorCode.X, "...")` (from `nimblebrain_server_sdk.errors`) with a message safe to show; `add_error_contract(mcp)` returns it to the caller as an error result. Never return an error as a plain dict: a host and a model score it as a success. Log diagnostics to stderr with the `logging` module. See the [errors guide](https://docs.nimblebrain.ai/server-sdk/errors/). Do not send logs to the client (`ctx.info`, `ctx.error`): MCP's logging capability is deprecated as of the 2026-07-28 protocol (SEP-2577) - Return Pydantic models, not raw dicts @@ -70,7 +76,7 @@ Or simply: `make check` 2. Make your changes 3. Run `make check` and fix any issues 4. Push and create a PR -5. CI must pass (lint, typecheck, test, bundle) +5. CI must pass: the CI workflow (format, lint, typecheck, test, bundle) and the Security Scan workflow (`mpak-scanner` on the built bundle, failing on any critical or high finding) ### PR Checklist @@ -83,11 +89,11 @@ Or simply: `make check` ## Definition of Done ### For MCP Servers -- 5+ tools implemented -- manifest.json valid (v0.4) -- 5+ tests passing -- CI/CD workflow passing -- MTF scanner passes (no critical/high findings) +- Tools designed with the `mcp-server` skill, each annotated and failing through the error contract +- Tests for each tool's success and failure paths, on both protocol versions +- `server.json` names the deployed URL and agrees with the Server Card (`tests/test_server_card.py`) +- The CI workflow passes: format, lint, typecheck, test, and `mcpb pack` (which validates `manifest.json`) +- The Security Scan workflow passes: no critical or high `mpak-scanner` findings ### For Companion Skills - A directory under `src/mcp_example/skills/` named after the skill, holding a `SKILL.md` whose frontmatter has that `name` and a `description`, registered with `add_skills` From f357d67ef8d48fd9ac34827f413df3134cd35bf9 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:52:31 -1000 Subject: [PATCH 8/9] Point the new-server issue at the mcp-server skill and the Python template --- .github/ISSUE_TEMPLATE/new-server.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/new-server.md b/.github/ISSUE_TEMPLATE/new-server.md index ca690e8..c77fd2b 100644 --- a/.github/ISSUE_TEMPLATE/new-server.md +++ b/.github/ISSUE_TEMPLATE/new-server.md @@ -31,23 +31,24 @@ assignees: '' ```bash # 1. Install the build skill -npx skills add nimblebraininc/skills --skill mcpb --agent claude-code -y +npx skills add nimblebraininc/skills --skill mcp-server --agent claude-code -y -# 2. Create repo from template -gh repo create NimbleBrainInc/mcp- --template NimbleBrainInc/mcp-server-template --public --clone +# 2. Create the repo from the template +gh repo create NimbleBrainInc/mcp- --template NimbleBrainInc/mcp-server-template-python --public --clone -# 3. Run /mcpb — scaffolds the server, implements tools, validates the -# bundle (MTF scan), and authors companion skills, end to end +# 3. Ask your agent to build the server with the mcp-server skill: it proposes +# the tools, implements and tests them, serves the server with its Server +# Card, and writes server.json # 4. Iterate with `make check` as you build ``` ## Definition of Done -- [ ] 5+ tools implemented -- [ ] manifest.json valid (v0.4) -- [ ] 5+ tests passing -- [ ] CI passing -- [ ] MTF scanner passes -- [ ] 2+ companion skills validated +- [ ] Tools designed with the `mcp-server` skill, each annotated and failing through the error contract +- [ ] Tests for each tool's success and failure paths, on both protocol versions +- [ ] `server.json` names the deployed URL and agrees with the Server Card +- [ ] CI workflow passing (format, lint, typecheck, test, bundle) +- [ ] Security Scan workflow passing (no critical or high findings) +- [ ] Companion skills served with `add_skills` - [ ] PR submitted and reviewed From 63e4cd8aa7ad33a2a7d4c3f9f61b144e435fb8f2 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:58:15 -1000 Subject: [PATCH 9/9] Fail the release when the tag differs from __version__, which the Server Card reports --- .github/workflows/build-bundle.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-bundle.yml b/.github/workflows/build-bundle.yml index d8eeceb..ebb0dc6 100644 --- a/.github/workflows/build-bundle.yml +++ b/.github/workflows/build-bundle.yml @@ -30,6 +30,12 @@ jobs: run: | VERSION="${{ github.event.release.tag_name }}" VERSION="${VERSION#v}" + # The Server Card reports __version__, which only `make bump` moves. + PKG_VERSION=$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' src/mcp_example/__init__.py) + if [ "$VERSION" != "$PKG_VERSION" ]; then + echo "::error::Tag version $VERSION differs from __version__ $PKG_VERSION; run make bump before tagging." + exit 1 + fi jq --arg v "$VERSION" '.version = $v' manifest.json > manifest.tmp.json mv manifest.tmp.json manifest.json if [ -f server.json ]; then