Skip to content

fix(mcp): wire sema_pull + flip sema_mint to opt-out (0.2.2)#34

Merged
hwesterb merged 4 commits intomainfrom
fix/mcp-pull-and-mint-defaults
Apr 18, 2026
Merged

fix(mcp): wire sema_pull + flip sema_mint to opt-out (0.2.2)#34
hwesterb merged 4 commits intomainfrom
fix/mcp-pull-and-mint-defaults

Conversation

@hwesterb
Copy link
Copy Markdown
Member

Summary

0.2.0's CHANGELOG, SKILL, and test file all claimed sema_pull was exposed as an MCP tool and sema_mint was on by default, but the server module had neither. This PR lands the code that matches the claims, plus the release-surface sync infrastructure so we never ship doc-vs-code drift like that again.

Replaces #33 (closed when its base branch chore/0.2.1-post-release-cleanup was deleted after #32 merged).

What changed

MCP behaviour (e5a1c8c):

  • sema_pull MCP tool — wraps cli.main.update_db. Returns structured JSON (success, added, updated, skipped, cascaded_user, superseded_removed, superseded_kept_orphan, upstream_removed, vocabulary_root_before, vocabulary_root_after, dry_run / error when applicable).
  • sema_mint flipped to opt-out. Exposed by default; hide with SEMA_DISABLE_MINT=true. Old SEMA_ALLOW_MINT gate removed — clean break.
  • SEMA_DISABLE_PULL=true matching opt-out for sema_pull.
  • update_db() now returns a dict; CLI callers read result["success"].
  • src/sema/mcp/tests/ added to pytest testpaths.

CHANGELOG format (4d84dfb):

  • Converted to Keep a Changelog 1.1.0 with standard ### Added / ### Changed / ### Removed subsections and ISO 8601 dates. Stale [Unreleased] — 0.2.0 header fixed.

Release-surface sync (3629ebc):

  • scripts/sync_release_metadata.py keeps .claude-plugin/plugin.json and server.json in sync with pyproject.toml (version) and data/taxonomy.db (pattern count). Idempotent, --check mode for CI.
  • Wired into .pre-commit-config.yaml so drift is auto-fixed on any commit touching the relevant files.

Release script (c268415):

  • scripts/release.sh — single command that pre-flights, tags, pushes, creates GH release (→ PyPI via trusted publish), and pushes server.json to the MCP Registry. --dry-run / --yes supported.
  • CONTRIBUTING.md gains a "Cutting a release" section.

Test plan

  • pytest — 237/237 green (was 6 failures pre-PR)
  • ruff + ruff-format clean
  • sync-release-metadata --check — no drift
  • scripts/release.sh --dry-run from main — runs through all phases as expected
  • After merge: scripts/release.sh cuts the 0.2.2 release end-to-end

🤖 Generated with Claude Code

hwesterb and others added 4 commits April 18, 2026 15:58
0.2.0's CHANGELOG, SKILL, and tests all claimed `sema_pull` was an MCP tool
and `sema_mint` was exposed by default, but the server module still only
registered `sema_mint` behind `SEMA_ALLOW_MINT=true` and had no `sema_pull`
at all. This release lands the code that matches the claims.

- Add `_sema_pull` MCP tool (wrapper over `cli.main.update_db`), exposed by
  default. Hide with `SEMA_DISABLE_PULL=true`.
- Flip `_sema_mint` registration: exposed by default. Hide with
  `SEMA_DISABLE_MINT=true`. The old `SEMA_ALLOW_MINT` gate is removed
  entirely (no legacy honour).
- Refactor `update_db()` to return a structured dict instead of a bare
  bool. CLI callers read `result["success"]` for the exit code; the MCP
  tool serializes the whole dict. Stats include `added`, `updated`,
  `skipped`, `cascaded_user`, `superseded_removed`,
  `superseded_kept_orphan`, `upstream_removed`, `vocabulary_root_before`,
  `vocabulary_root_after`, and `dry_run`/`error` when applicable.
- Register `src/sema/mcp/tests/` in `pytest` testpaths so the 6 tests for
  pull / mint registration + structured output now run in the default
  suite (all passing).
- Drop the stale "legacy SEMA_ALLOW_MINT" mention from SKILL and the old
  conditional-registration test class that asserted the opt-in behaviour.

237/237 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add header referencing Keep a Changelog and SemVer specs.
- Add `[Unreleased]` section at the top (per-spec accumulator for the
  next release).
- Use standard `### Added / ### Changed / ### Removed` subsections in the
  0.2.1 and 0.2.2 entries.
- Normalize release headers to `## [X.Y.Z] - YYYY-MM-DD` (ISO 8601 date,
  hyphen separator). Fix the stale `[Unreleased] — 0.2.0 — …` header on
  the 0.2.0 section — it shipped, it's no longer unreleased.

The 0.2.0 body is left as-is (already shipped); only its header was
touched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tomatically

Release-surface files drift silently: the MCP Registry entry in server.json
was still on 0.1.4 even though PyPI had shipped 0.2.0, and the description
claimed 453 patterns when the DB had 452. We've been catching these by
hand, one file at a time, every release — easy to forget one.

- `scripts/sync_release_metadata.py` — single source of truth is
  `pyproject.toml` (version) and `data/taxonomy.db` (pattern count).
  Fixes drift in `.claude-plugin/plugin.json` and `server.json` in place.
  Idempotent. `--check` mode exits 1 on drift for CI.
- Wired into `.pre-commit-config.yaml` as the `sync-release-metadata`
  hook. Fires when `pyproject.toml`, `data/taxonomy.db`,
  `.claude-plugin/plugin.json`, or `server.json` is staged, auto-fixes
  drift, and re-stages the corrected files so the commit goes through
  clean. Now we literally can't forget.
- Ran it once as part of this commit: `server.json` 0.1.4 → 0.2.2,
  pattern count 453 → 452 in the description.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Runs from main, single command, gated by pre-flight checks and
confirmation prompts. Wraps the four manual steps we've been doing by
hand after each version-bump merge:

  1. git tag vX.Y.Z + push
  2. gh release create (triggers publish.yml → PyPI via trusted publish)
  3. mcp-publisher publish server.json (MCP Registry)
  4. print verification URLs

Version comes from pyproject.toml (single source of truth). Release notes
body is auto-extracted from the matching CHANGELOG.md section. Supports
--dry-run for a preview and --yes for non-interactive use.

CONTRIBUTING.md gets a new "Cutting a release" section so the flow is
discoverable without reading the script.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hwesterb hwesterb merged commit ef7b971 into main Apr 18, 2026
5 checks passed
@hwesterb hwesterb deleted the fix/mcp-pull-and-mint-defaults branch April 18, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant