apm icon indicating copy to clipboard operation
apm copied to clipboard

[BUG] Self-defined MCP server names with a "/" are truncated to the last segment in the harness config

Open tomdaniel-ae opened this issue 4 weeks ago • 3 comments

Describe the bug When a self-defined MCP server in apm.yml has a registry-style name containing a / (e.g. com.azure.dev/mcp-remote-azure-devops), apm install writes the harness config entry under the last segment only (mcp-remote-azure-devops).

#1693 / #1699 fixed this for npm-style @scope/name, but only when the name starts with @ and has exactly one /. Reverse-DNS names as used by the official MCP registry (com.example/server, io.github.owner/server) are still truncated.

This matters because Copilot's MCP private registry enforcement matches on the config key. The truncated key is not in the registry, so the server is blocked:

1 MCP server was blocked by policy: 'mcp-remote-azure-devops'

Using the full name com.azure.dev/mcp-remote-azure-devops as the key is allowed. There is no way to get that key through APM today.

This is fully blocking us from setting up MCP servers through APM as this (the fixed MCP server name) is an organization policy.

To Reproduce

  1. Create apm.yml:
    name: repro
    version: 1.0.0
    targets: [copilot]
    dependencies:
      apm: []
      mcp:
        - name: com.azure.dev/mcp-remote-azure-devops
          registry: false
          transport: http
          url: https://mcp.dev.azure.com/my-org
    
  2. Run apm install -g <path-to-package> --target copilot
  3. Open ~/.copilot/mcp-config.json

Actual:

{
  "mcpServers": {
    "mcp-remote-azure-devops": {
      "type": "http",
      "url": "https://mcp.dev.azure.com/my-org",
      "tools": ["*"],
      "id": ""
    }
  }
}

Expected behavior The config key is the declared name, exactly as written: com.azure.dev/mcp-remote-azure-devops.

Environment (please complete the following information):

  • OS: Windows 11 Enterprise
  • Python Version: 3.14.5 (pip install) / bundled binary
  • APM Version: 0.29.0 and 0.35.0 (both reproduce)
  • Copilot CLI: 1.0.105

Logs The install output shows the full name, but the written key is truncated:

|  [>]  com.azure.dev/mcp-remote-azure-devops (self-defined, http)
  + com.azure.dev/mcp-remote-azure-devops
|  [+]  com.azure.dev/mcp-remote-azure-devops -> Copilot (configured)

Additional context

  • Cause: SafeMCPInstaller.install_servers() only passes server_name when the name starts with @ and contains exactly one /. Otherwise the adapter falls back to server_url.split("/")[-1].
  • Suggested fix (as already proposed in #1693): always pass the declared dep.name as server_name for self-defined servers.

tomdaniel-ae avatar Nov 03 '26 15:11 tomdaniel-ae

Decision: approve Area: project Scope: Use the declared name of a self-defined MCP server (registry: false) as its native configuration key in every MCP target adapter whenever the name contains a slash, including reverse-DNS names such as com.example/server, extending the declared-name fix made for @scope/name in #1693/#1699, while registry-resolved server keys stay unchanged. Done when: Tests through SafeMCPInstaller and each affected adapter show the exact declared key for a reverse-DNS self-defined name (http and stdio), two declared names sharing a final segment do not collide, @scope/name, plain names and registry-backed names keep today's keys, lockfile mcp_target_servers matches the written key so reinstall, uninstall and drift checks work, a registry lookup failure does not raise, and a previously APM-written truncated entry is replaced only when ownership records prove APM wrote it, otherwise left in place with names-only guidance; tests fail on current main. Out of scope: Registry naming semantics, MCP policy matching changes, Copilot private-registry behavior, forced deletion or migration of user-edited entries, and other MCP issues (#3404, #3498, #3499). Review contact: @danielmeppiel

danielmeppiel avatar Nov 10 '26 16:11 danielmeppiel

The apm-scope:v1 record above was approved by @danielmeppiel at Gate B on 2026-11-10 in the coordinator session of the issue-reduction program. It is the scope a fix for this issue will be reviewed against.

Review contact: @danielmeppiel.

Linked pull requests:

  • PR #3493 by @bodapatisaikrishna: addresses part of this scope; see Done when for what is still needed.

Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.

danielmeppiel avatar Nov 10 '26 16:11 danielmeppiel

Delivered by #3493.

danielmeppiel avatar Nov 11 '26 12:11 danielmeppiel