`resolveDiscoveredConfig` does not read workspace `.mcp.json` — `includeWorkspaceSources` never set

Aberta Para iniciantes
#3,126 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
72/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Pouca atividade
Stack de tecnologia
javascript
Domínio
cli

Direção de pesquisa

Comece em resolveDiscoveredConfig() e rastreie sua chamada para jv(), usando a reprodução fornecida de workingDirectory e workspace .mcp.json. Verifique se a descoberta de configuração inclui fontes do workspace; em seguida, execute novamente o cenário de sessão do SDK e confirme que o time MCP server é carregado de .mcp.json.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area:configuration area:mcp

Summary

When the SDK creates a session with enableConfigDiscovery: true and a workingDirectory, the CLI's resolveDiscoveredConfig() calls the internal MCP config loader (jv()) without passing includeWorkspaceSources: true. That parameter defaults to false, so the workspace .mcp.json is never read — even though the intent of enableConfigDiscovery is clearly to discover it.

Version

@github/copilot v1.0.41-0 (commit 3f18c2c)

Steps to reproduce

  1. Place a valid .mcp.json in a working directory:
    {
      "mcpServers": {
        "time": {
          "command": "uvx",
          "args": ["mcp-server-time"]
        }
      }
    }
    
  2. Create a session via the SDK with enableConfigDiscovery: true and workingDirectory pointing to that directory.
  3. Observe that no MCP servers from .mcp.json are discovered.

Expected behaviour

The MCP servers defined in the workspace .mcp.json should be discovered and loaded into the session.

Actual behaviour

The CLI logs:

Loaded MCP config from installed plugins: 0 server(s):
No MCP config loaded from ODR (ODR unavailable or returned no usable servers)

No workspace .mcp.json is read. The flag triggers config resolution, but the resolution skips the workspace source.

Root cause

In resolveDiscoveredConfig(), the call to jv() omits includeWorkspaceSources:

async resolveDiscoveredConfig(e) {
  if (!e.enableConfigDiscovery) return {};
  let r = e.workingDirectory || process.cwd();
  // ...
  let c = await jv({
    cwd: r,
    repoRoot: l,
    settings: this.options.settings,
    installedPlugins: s
    // ← missing: includeWorkspaceSources: true
  });
}

Inside jv(), the parameter defaults to false. When false, the function skips the code path that reads .mcp.json from the working directory:

async function jv(t = {}) {
  let { includeWorkspaceSources: s = false } = t;
  // ...
  if (!s) d = { ...c };        // ← only copies global config
  else {
    // reads .mcp.json from cwd/repoRoot — this path is never taken
  }
}

Suggested fix

Pass includeWorkspaceSources: true in the jv() call within resolveDiscoveredConfig():

let c = await jv({
  cwd: r,
  repoRoot: l,
  settings: this.options.settings,
  installedPlugins: s,
  includeWorkspaceSources: true  // ← add this
});
Linguagem predominante
Shell
Estrelas
11.2k
Forks
1.9k
Merge médio
14h 16min
PRs com merge (30d)
6

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de github/copilot-cli

Todas as issues de github/copilot-cli

Issues semelhantes

Mais issues de Shell/Bash

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.