Skip to content

fix(mcp): replace stale Context7 config entries#369

Draft
LCubero wants to merge 1 commit intoGentleman-Programming:mainfrom
LCubero:fix/mcp-context7-replace-legacy-fields
Draft

fix(mcp): replace stale Context7 config entries#369
LCubero wants to merge 1 commit intoGentleman-Programming:mainfrom
LCubero:fix/mcp-context7-replace-legacy-fields

Conversation

@LCubero
Copy link
Copy Markdown
Contributor

@LCubero LCubero commented Apr 24, 2026

🔗 Linked Issue

Closes #57


🏷️ PR Type

What kind of change does this PR introduce?

  • type:bug — Bug fix (non-breaking change that fixes an issue)
  • type:feature — New feature (non-breaking change that adds functionality)
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no functional changes)
  • type:chore — Build, CI, or tooling changes
  • type:breaking-change — Breaking change (fix or feature that changes existing behavior)

📝 Summary

  • Replaces managed Context7 MCP entries atomically so stale local fields cannot survive deep merges.
  • Fixes OpenCode/KiloCode upgrade paths where legacy mcp.context7 fields like command, args, or env break strict schema validation.
  • Adds regression coverage for idempotent migration and sibling MCP entry preservation.

📂 Changes

File / Area What Changed
internal/components/mcp/context7.go Wraps managed Context7 overlay entries in __replace__, including OpenCode/KiloCode strict-schema config.
internal/components/mcp/inject_test.go Adds structured regression tests for OpenCode/KiloCode stale field replacement, idempotency, and managed Context7 entries.

🧪 Test Plan

Unit Tests

go test ./internal/components/mcp ./internal/components/filemerge ./internal/components/engram
go test ./...

E2E Tests

cd e2e && ./docker-test.sh
  • Unit tests pass (go test ./...)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • Manually tested locally

Additional local verification used Fedora Podman as a Docker-compatible shim:

docker(){ podman "$@"; }; export -f docker; cd e2e && ./docker-test.sh

Result: Ubuntu, Arch, and Fedora E2E platforms passed (PASSED 3/3).


🤖 Automated Checks

The following checks run automatically on this PR:

Check Status Description
Check Issue Reference PR body must contain Closes/Fixes/Resolves #N
Check Issue Has status:approved Linked issue must have been approved before work began
Check PR Has type:* Label Exactly one type:* label must be applied
Unit Tests go test ./... must pass
E2E Tests cd e2e && ./docker-test.sh must pass

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • Maintainer needs to add the type:bug label
  • Unit tests pass (go test ./...)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • I have updated documentation if necessary
  • My commits follow Conventional Commits format
  • My commits do not include Co-Authored-By trailers

💬 Notes for Reviewers

This keeps the existing deep-merge behavior globally and uses the repository's existing __replace__ sentinel only for managed Context7 server entries. That preserves unrelated user MCP entries while preventing stale fields from contaminating OpenCode/KiloCode's strict mcp.context7 schema.

Because this PR is opened from a fork, I cannot add labels to the upstream PR. Maintainer action needed: please add type:bug.

@LCubero LCubero closed this Apr 24, 2026
@LCubero LCubero deleted the fix/mcp-context7-replace-legacy-fields branch April 24, 2026 01:59
@LCubero LCubero restored the fix/mcp-context7-replace-legacy-fields branch April 24, 2026 02:03
@LCubero LCubero reopened this Apr 24, 2026
@LCubero
Copy link
Copy Markdown
Contributor Author

LCubero commented Apr 24, 2026

Reopened after local revision. Keeping this as draft while waiting for a maintainer to add the required type:bug label.

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.

Bug: OpenCode MCP merge injects fields rejected by OpenCode's strict schema

1 participant