Skip to content

fix: make sample/template MCP scanning opt-in so it stops reading as drift#50

Merged
Conalh merged 1 commit into
mainfrom
fix/mcp-sample-configs-opt-in
Jun 3, 2026
Merged

fix: make sample/template MCP scanning opt-in so it stops reading as drift#50
Conalh merged 1 commit into
mainfrom
fix/mcp-sample-configs-opt-in

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented Jun 3, 2026

Why

Post-merge feedback on #49 (the permission-drift blind-spot work):

the .mcp.json.template never loads into agent context, only the live .mcp.json does. surfacing them the same flags noise as drift.

ScopeTrail is a drift detector — it reports changes to what an agent can actually do. A .mcp.json.template / .sample / .disabled / example config never loads into any agent runtime, so a change to one cannot alter an agent's capabilities. Reporting it as drift is noise — even at the low severity these already carried.

What

Rather than delete the sample/template scanner (it's a useful copy-paste-hygiene check for teams that ship example configs), gate it behind an explicit opt-in. Default reports no longer surface sample/template configs at all.

  • detectMcpDrift(old, new, { includeSamples }) — default false. The sample loop is extracted into detectMcpSampleDrift and only runs when opted in.
  • materializeGitSnapshot(..., { includeSamples }) — skips the full git ls-tree -r sample-discovery walk unless opted in (the detector would ignore the files anyway; also saves a tree walk on every PR).
  • CLI: new --include-samples flag (off by default), shown in --help.
  • Action: new include-samples input (default: 'false').
  • Benchmark: runs with --include-samples so the labeled mcp-sample fixtures stay exercised — RESULTS.md is byte-identical (100% detection / 85.2% at the high gate, unchanged).
  • Docs: README / TRUST / PILOT reframed — sample review is opt-in, with the rationale.

Tests

  • New: default run produces zero sample findings, at both the detector and CLI/git-snapshot level; --include-samples re-enables them.
  • Existing sample tests now opt in explicitly.
  • Full suite: 79/79 pass. Benchmark RESULTS.md unchanged.

Follow-up to #49.

🤖 Generated with Claude Code

…drift

A `.mcp.json.template` / `.sample` / `.disabled` / example config never loads
into an agent runtime — only the live `.mcp.json` (and the editor configs) do.
A change to one therefore cannot alter what an agent is allowed to do, so
surfacing it in a *drift* report is noise, not drift.

Gate the sample/template detector behind an explicit opt-in rather than
removing it, so teams who want copy-paste hygiene on shipped examples can still
ask for it:

- detectMcpDrift takes { includeSamples } (default false); the sample-scan loop
  is extracted into detectMcpSampleDrift and only runs when opted in.
- git-snapshot skips the full `git ls-tree -r` sample-discovery walk unless
  includeSamples is set — the detector would ignore the files anyway.
- CLI: new `--include-samples` flag, off by default, documented in --help.
- Action: new `include-samples` input (default 'false').
- Benchmark passes --include-samples so the labeled mcp-sample fixtures stay
  exercised; RESULTS.md is unchanged.
- Docs (README / TRUST / PILOT) reframed: sample review is opt-in, and why.
- Tests: default run yields no sample findings (CLI + detector level); the
  existing sample tests now opt in explicitly.

Follow-up to #49.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Conalh Conalh merged commit 222c814 into main Jun 3, 2026
6 checks passed
@Conalh Conalh deleted the fix/mcp-sample-configs-opt-in branch June 3, 2026 14:34
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