Skip to content

fix: scope MCP uninstall cleanup to managed targets - #2591

Draft
Aryan Singh K. (aryansk) wants to merge 1 commit into
microsoft:mainfrom
aryansk:fix/2551-scoped-mcp-uninstall-cleanup
Draft

fix: scope MCP uninstall cleanup to managed targets#2591
Aryan Singh K. (aryansk) wants to merge 1 commit into
microsoft:mainfrom
aryansk:fix/2551-scoped-mcp-uninstall-cleanup

Conversation

@aryansk

Copy link
Copy Markdown

Summary

Make uninstall MCP cleanup honor the target ownership recorded in the lockfile instead of sweeping every runtime, tolerate JSONC comments in JetBrains Copilot config, and continue cleanup across target-specific write failures before reporting an error.

Changes

  • restrict stale MCP removal to runtimes that actually own each server in mcp_target_servers
  • run target cleanup independently so one broken config does not leave unrelated managed targets orphaned
  • parse JetBrains Copilot JSONC safely without treating // inside strings as comments
  • add regressions for target scoping, JSONC URLs, and partial cleanup failure

Validation

Prepared focused regression tests:
pytest -q tests/unit/regressions/test_issue_2551_mcp_uninstall_cleanup.py

Patch structure was validated with git apply --check. Full repository tests should run in CI.

Fixes #2551

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] apm uninstall MCP cleanup ignores --target, aborts on JSONC in the JetBrains Copilot config, and orphans MCP servers

1 participant