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

Aperta Adatta ai principianti
#3,456 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bodapatisaikrishna ci sta già lavorando.

Dal 7/11/2026.

  • #3493 di @bodapatisaikrishna — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
devtools

Direzione di ricerca

Inizia da SafeMCPInstaller.install_servers() e segui come i nomi dei server definiti dall’utente vengono passati all’adattatore dell’harness; secondo l’issue, il fallback ricava la chiave dall’ultimo segmento dell’URL. Controlla la gestione esistente di @scope/name e le correzioni correlate #1693 e #1699. Il lavoro è concluso quando apm install scrive il nome dichiarato con la barra come chiave di configurazione; verificalo con la riproduzione nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type/bug

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.
Lingua principale
Python
Stelle
4.2k
Fork
412
Merge medio
23h 11m
PR unite (30g)
63

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/apm

Tutte le issue di microsoft/apm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.