Metagit MCP Gating Skill
Use this skill whenever you need to control whether Metagit MCP tools/resources are exposed.
Purpose
Ensure high-risk tooling and multi-repo context are only available when a valid .metagit.yml exists at the resolved workspace root.
Bundled scripts (optional)
Hermes skill_manage installs SKILL.md only. Resolve scripts from the package or a full
metagit skills install:
SKILL_ROOT="$(python3 -c "import metagit, pathlib; print(pathlib.Path(metagit.__file__).parent / 'data/skills/metagit-gating')")"
"$SKILL_ROOT/scripts/gate-status.sh" [root_path]
Expected output (single line, tab-delimited):
state=<value>\troot=<path|none>\ttools=<count>
Inline CLI fallback (no scripts)
metagit mcp serve --status-once --root .
metagit config validate -c .metagit.yml
Parse mcp_state= from --status-once output (missing, invalid, or active).
Activation Workflow
- Resolve workspace root:
METAGIT_WORKSPACE_ROOT- CLI
--root - upward directory walk
- Check for
.metagit.ymlin resolved root. - Validate config through existing Metagit config models.
- Derive activation state: missing, invalid, or active.
- Register tool surface based on state.
Tool Exposure Contract
Inactive (missing or invalid config)
Expose only:
metagit_workspace_statusmetagit_bootstrap_config_plan_only
Active (valid config)
Expose full set:
metagit_workspace_statusmetagit_workspace_indexmetagit_workspace_searchmetagit_upstream_hintsmetagit_repo_inspectmetagit_repo_syncmetagit_bootstrap_config
Error Handling
- Return explicit, machine-readable state and reason.
- Avoid stack traces in user-facing outputs.
- Log parser/validation errors with enough detail for debugging.
Safety Rules
- Never expose mutation-capable tools in inactive state.
- Never operate outside validated workspace boundaries.
- Keep defaults read-only unless user/agent explicitly opts in.