Skip to content

Bug: MCPIntegrator.update_lockfile uses Path.cwd() at --global scope, writing MCP audit entries to the wrong lockfile #794

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Summary

MCPIntegrator.update_lockfile() defaults lock_path to get_lockfile_path(Path.cwd()) when the caller does not pass an explicit path. At --global scope (apm install -g), the lockfile should be written to ~/.apm/apm.lock.yaml, but callers in install.py do not pass the scope-resolved lockfile path to update_lockfile. This causes MCP server audit entries to be written to the project-local lockfile instead of the user-scope lockfile.

Reproduction

  1. cd /tmp/some-project && apm init
  2. apm install -g some-org/some-mcp-package
  3. Observe that ./apm.lock.yaml (project) gets MCP entries instead of ~/.apm/apm.lock.yaml.

Expected Behavior

At --global scope, update_lockfile should persist MCP server entries in the user-scope lockfile (~/.apm/apm.lock.yaml).

Relevant Code

  • src/apm_cli/integration/mcp_integrator.py, update_lockfile() method (lines ~639-673)
  • src/apm_cli/commands/install.py or src/apm_cli/install/ callers

Context

Discovered during review of #638 (apm install --global MCP scope filtering). The scope-filtering fix in #638 correctly routes MCP installation to global-capable runtimes, but the lockfile path was out of scope for that PR.

Labels

bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCLI command surface, flags, help text (cross-cutting).area/lockfileLockfile schema, per-file provenance, integrity hashes, drift detection.bugDeprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.priority/highShips in current or next milestonestatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/governanceGoverned by policy. apm-policy, audit, enforcement, enterprise rollout.type/bugSomething does not work as documented.

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions