Skip to content

fix(install): copilot-cli MCP config key (servers → mcpServers) and Copilot instructions path (#616)#714

Open
LNTisNotaTree wants to merge 1 commit into
tirth8205:mainfrom
LNTisNotaTree:fix/copilot-cli-mcp-key-and-instructions-path
Open

fix(install): copilot-cli MCP config key (servers → mcpServers) and Copilot instructions path (#616)#714
LNTisNotaTree wants to merge 1 commit into
tirth8205:mainfrom
LNTisNotaTree:fix/copilot-cli-mcp-key-and-instructions-path

Conversation

@LNTisNotaTree

@LNTisNotaTree LNTisNotaTree commented Jul 22, 2026

Copy link
Copy Markdown

Fixes #616.

Bug 1: MCP server written under the wrong JSON key

Copilot CLI reads MCP server definitions from "mcpServers" in ~/.copilot/mcp-config.json, but the installer wrote "servers" — the entry was silently never parsed.

  • The copilot-cli platform now uses "key": "mcpServers".
  • Installs also migrate a stale code-review-graph entry that an older release left under "servers" (other servers under that key are untouched; the key itself is dropped once emptied), so upgrading users self-heal on the next install instead of ending up with a duplicate/stale blob.
  • uninstall now also checks legacy keys, so it can clean configs written by older releases.

The VS Code copilot platform keeps "servers" — that is correct for .vscode/mcp.json.

Bug 2: instructions file at a path Copilot never loads

Copilot only auto-loads instruction files matching .github/instructions/**/*.instructions.md; the installer wrote .github/code-review-graph.instruction.md (flat directory + singular suffix), which is never read.

  • Instructions now go to .github/instructions/code-review-graph.instructions.md for both copilot and copilot-cli.
  • On install, our injected section is stripped from the legacy path (the file is deleted when nothing else remains; user-authored content or unrecognized sections are left alone).
  • uninstall also removes the section from the legacy path for installs created by older releases.

Verification

End-to-end repro from the issue (isolated HOME, pre-existing azure-style server under mcpServers, stale code-review-graph under servers):

{
  "servers": { "azure-mcp-server": { "command": "azmcp" } },
  "mcpServers": {
    "code-review-graph": { "command": "...", "args": ["...", "serve"], "type": "stdio" }
  }
}

…and .github/instructions/code-review-graph.instructions.md is created while a generated legacy .github/code-review-graph.instruction.md is removed.

New tests cover: the corrected key, legacy-key migration (including dropping the emptied servers object), legacy instruction-file removal, preservation of user content sharing the legacy file, and leaving user-authored files without our marker untouched. tests/test_skills.py, tests/test_uninstall.py, tests/test_cli_install.py all pass (225 tests); the full suite shows no new failures relative to main in my environment.

…h8205#616)

GitHub Copilot CLI reads MCP servers from the "mcpServers" key in
~/.copilot/mcp-config.json, but the installer wrote "servers", so the
server was silently never loaded. Likewise, Copilot only auto-loads
instruction files matching .github/instructions/**/*.instructions.md,
but the installer wrote .github/code-review-graph.instruction.md
(flat directory, singular suffix), which was never read.

- Write the copilot-cli entry under "mcpServers"; on install, migrate a
  stale entry that an older release left under "servers" (removing the
  legacy key once emptied) so upgrades self-heal.
- Write instructions to .github/instructions/code-review-graph.instructions.md
  for both copilot and copilot-cli; on install, strip our section from
  the superseded legacy path (deleting the file when nothing else
  remains, leaving user content and unrecognized sections alone).
- Teach uninstall to also remove entries under legacy platform keys and
  sections in legacy instruction paths written by older releases.

Fixes tirth8205#616
@LNTisNotaTree
LNTisNotaTree force-pushed the fix/copilot-cli-mcp-key-and-instructions-path branch from 6870f12 to 5bf448f Compare July 22, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: copilot-cli install writes wrong MCP config key (servers vs mcpServers) and wrong instructions path

1 participant