Repository navigation
fix(install): keep local-bundle MCP servers as recorded baseline - #3972
Closed
Daniel Meppiel (danielmeppiel) wants to merge 2 commits into
Closed
Daniel Meppiel (danielmeppiel) wants to merge 2 commits into
Daniel Meppiel (danielmeppiel) wants to merge 2 commits into
Conversation
apm install <bundle> records its MCP servers with bundle:<owner> provenance, but CurrentMcpConfigView only derived servers from apm.yml and locked dependencies. audit --ci and install --frozen then reported them as lock-only, and the next unrelated install or uninstall removed them while keeping the bundle's files. The view now keeps bundle-owned lock servers that no current declaration supersedes in its configs and provenance (bundle_owned), install and uninstall keep them, and a package cannot claim the bundle: owner namespace. The declaration-scope architecture rule guards the owner. Closes #3955 apm-spec-waiver: local-bundle MCP ownership bookkeeping only; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 19, 2026 18:37
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active issues can delete a bundle’s native MCP server during runtime changes and cause frozen installs to reject valid escaped-owner servers on a cold cache.
2 open issues
What changed in this PR
This PR addresses #3955 by treating local-bundle MCP servers as recorded baseline configuration, so audit, frozen installs, and unrelated package operations recognize them.
Changes:
- Retains bundle-owned servers in the MCP configuration view and install/uninstall reconciliation.
- Centralizes bundle ownership tokens and prevents dependency names from claiming that namespace.
- Adds regression coverage, architecture checks, and user-facing documentation.
| File | Description |
|---|---|
tests/unit/integration/test_mcp_config_view.py |
Tests bundle baselines, declaration precedence, and owner-token escaping. |
tests/integration/test_local_bundle_mcp_lifecycle.py |
Tests audit, frozen installs, and unrelated package operations. |
src/apm_cli/integration/mcp_config_view.py |
Adds bundle baseline recognition and canonical ownership tokens. |
src/apm_cli/install/mcp/integration.py |
Retains bundle server names during install reconciliation. |
src/apm_cli/commands/uninstall/engine.py |
Includes bundle-owned servers in the retained server set. |
scripts/architecture_linter/checks/mutation_mcp_target_and_scope.py |
Guards baseline derivation and token ownership. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Documents bundle MCP persistence. |
docs/src/content/docs/consumer/deploy-a-bundle.md |
Explains audit and frozen-install acceptance. |
CHANGELOG.md |
Records the user-visible fix. |
Review effort: Balanced
| raise | ||
| conflict = exc | ||
| new_mcp_servers = MCPIntegrator.get_server_names(mcp_deps) | ||
| new_mcp_servers = MCPIntegrator.get_server_names(mcp_deps) | bundle_owned |
| """ | ||
| return next((name for name in names if name), package_dir.name) | ||
| owner = next((name for name in names if name), package_dir.name) | ||
| return f"package:{owner}" if owner.startswith(BUNDLE_MCP_OWNER_PREFIX) else owner |
7 of 9 tasks
Collaborator
Author
Takeshi Masukawa (takeaship)
pushed a commit
to takeaship/apm
that referenced
this pull request
Nov 20, 2026
…rosoft#3955) Harvested from microsoft#3972. Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
apm install <bundle>records a bundle's MCP servers withbundle:<owner>lock provenance, butCurrentMcpConfigViewderived servers only fromapm.ymland locked dependencies. Right after the install,apm audit --ci(config-consistency) andapm install --frozenfailed with the server reported lock-only, and the next unrelatedapm install(orapm uninstall) removed the server while keeping the bundle's files.The view now owns this case:
CurrentMcpConfigView.derivekeeps bundle-owned lock servers that no current declaration supersedes inconfigs/provenanceand exposes them asbundle_owned.run_mcp_integrationand the uninstall MCP cleanup keepbundle_ownedservers instead of treating them as stale.mcp_package_ownermaps a package namedbundle:*topackage:bundle:*, so a dependency cannot forge bundle ownership to make its server sticky.bundle_mcp_owner_tokenis the single token writer, used byrun_owned_mcp_integration; themutation_writes.mcp_declaration_scoperule now fails ifderivestops reading the baseline or another module spells thebundle:MCP token (LSP keeps its own namespace).Issue and approved scope
Issue: Fixes #3955
Human scope-approval comment: #3955 (comment)
Completes the issue. Bundle format and bundle uninstall are out of scope.
Type of change
Testing
Validation evidence:
APM_BINARY_PATH=.venv/bin/apm APM_E2E_TESTS=1 pytest tests/integration/test_local_bundle_mcp_lifecycle.py-- failed on main atapm audit --ci(bundle-server: in lockfile but not in manifest (declared by bundle:mcppkg)); passes with this change (install, audit --ci, --frozen, unrelated install, plain install, unrelated uninstall).pytest tests/unit/integration/test_mcp_config_view.py-- 83 passed.pytest tests/unit -n 8-- 28347 passed; 51 failures all intest_unix_installer_checksums.py,test_unix_install_ownership.py,test_windows_unit_diagnostics.py(subprocess timeouts on a loaded host; reproduce identically on unmodified main).bash scripts/lint-architecture-boundaries.sh-- clean; mutatingderiveor reintroducingf"bundle:{owner}"ininstall/mcp/integration.pyeach fail the rule.uvx [email protected] check/format --check(CI paths) -- clean; pylint R0801 -- 10.00/10;scripts/lint-auth-signals.sh-- clean.Changelog
## [Unreleased]inCHANGELOG.md:user-visible effect first, 25 words or fewer, ending with
(#PR);breaking changes only under upgrade notes; no Highlights; see
.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regenerated