Skip to content

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

Closed
hwesterb wants to merge 4 commits intochore/0.2.1-post-release-cleanupfrom
fix/mcp-pull-and-mint-defaults
Closed

fix(mcp): wire sema_pull + flip sema_mint to opt-out (0.2.2)#33
hwesterb wants to merge 4 commits intochore/0.2.1-post-release-cleanupfrom
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 — sema_mint was still behind SEMA_ALLOW_MINT=true, and there was no sema_pull implementation at all. This PR lands the code that matches the claims.

What changed

  • _sema_pull MCP tool — thin wrapper over 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, plus dry_run / error when applicable) so callers act on outcomes programmatically instead of parsing the human log. Exposed by default; hide with SEMA_DISABLE_PULL=true.
  • _sema_mint flipped to opt-out. Exposed by default; hide with SEMA_DISABLE_MINT=true. The old SEMA_ALLOW_MINT=true gate is gone — no legacy honour.
  • update_db() now returns a dict instead of a bare bool. CLI callers read result["success"]; MCP serializes the whole thing.
  • src/sema/mcp/tests/ is now in pytest testpaths. The 6 tests for pull / mint registration and structured output now run in the default suite.
  • Cleanup of stale "legacy SEMA_ALLOW_MINT" references in SKILL.md and test_mint_tool.py.

Test plan

  • pytest — 237/237 pass (was 6 failures before this PR)
  • ruff + ruff-format clean
  • changelog-gate passes (CHANGELOG updated alongside version bump)
  • After merge + release, confirm sema_pull appears in MCP tool listings in a fresh client session

Notes

🤖 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 deleted the branch chore/0.2.1-post-release-cleanup April 18, 2026 14:20
@hwesterb hwesterb closed this Apr 18, 2026
@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