Plugin MCP servers cannot resolve the active project directory
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Shell
- Sterne
- 11.2k
- Forks
- 1.9k
- Ø Merge
- 14 Std. 16 Min.
- Gemergte PRs (30 T.)
- 6
Beschreibung
Describe the bug
An MCP server loaded from an installed plugin is launched with its working directory set to the plugin installation root, and the child process receives no project/workspace path. A project-scoped MCP server therefore reads and writes the plugin installation instead of the repository passed to Copilot CLI.
This is observable with Copilot CLI 1.0.73 on Linux when using either --plugin-dir or an installed plugin.
Steps to reproduce
- Create a plugin manifest that points at a plugin-root MCP config:
{
"name": "cwd-probe",
"mcpServers": "./.mcp.json"
}
- Use this
.mcp.json:
{
"mcpServers": {
"probe": {
"command": "sh",
"args": [
"-c",
"pwd > /tmp/plugin-mcp-pwd.txt; env > /tmp/plugin-mcp-env.txt; exec my-mcp-server"
]
}
}
}
- Run the plugin against a different project:
copilot -C /tmp/example-project --plugin-dir /tmp/cwd-probe
- Inspect the captured files.
Actual behavior
PWDis/tmp/cwd-probe, not/tmp/example-project.- The MCP child receives
COPILOT_PLUGIN_ROOTandPLUGIN_ROOT, but it does not receiveCOPILOT_PROJECT_DIR(plugin hooks do receive that variable). - The MCP
initializerequest advertises onlysamplingandelicitation; it does not advertise MCP roots, so the server cannot request the workspace throughroots/list. - Setting
"cwd": "${workspaceFolder}"leaves the value unresolved and fails before the child starts withNo such file or directory (os error 2).
The full initialization payload captured from 1.0.73 was:
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"sampling":{},"elicitation":{"form":{},"url":{}}},"clientInfo":{"name":"github-copilot-developer","version":"1.0.73"}}}
Expected behavior
A plugin-provided MCP server needs a supported way to resolve the active project. Any one of these would unblock project-scoped servers:
- launch plugin MCP children from the active project directory;
- pass
COPILOT_PROJECT_DIRto MCP children as Copilot already does for plugin hooks; or - expose a documented project variable / MCP roots capability that plugin MCP configuration can pass to the server.
The plugin root should remain available separately through COPILOT_PLUGIN_ROOT.
Impact
Project-scoped MCP tools can silently operate on files inside the cached plugin installation. In archcore-ai/plugin#24, the MCP tools register and return success, but document writes land under the installed plugin rather than the project, which prevents a safe Copilot plugin release.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduzieren Sie das Problem mit copilot -C /tmp/example-project --plugin-dir /tmp/cwd-probe und verfolgen Sie den MCP-Startpfad des Plugins, die Auswahl des Arbeitsverzeichnisses, die Erstellung der Umgebung und die Initialisierungsfähigkeiten. Als abgeschlossen gilt die Aufgabe, wenn ein Plugin-MCP-Server das aktive Projekt auflösen kann, ohne das separate Plugin-Root zu verlieren, und dabei einen der im Issue beschriebenen unterstützten Ansätze verwendet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- shell
- Bereich
- cli, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100