copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

copilot cli fails to read config from working directory which isn't a repo root

Open johnmreynolds opened this issue 2 months ago • 8 comments

Describe the bug

I've got a project which is not a monorepo, but instead has several repos in a workspace directory which itself isn't a git repo.

The copilot cli harness in this case fails to read .mcp.json or hook files (and probably other config I've not tested) which is in the project directory.

Creating an empty git repo at the root fixes this, but this shouldn't be necessary.

For reference to similar harnesses, Claude CLI reads workspace level files.

Affected version

No response

Steps to reproduce the behavior

Create a directory containing a simple .mcp.json.

Within this create a git repo.

Launch copilot cli from the directory.

Expected behavior

Copilot reads config files such as .mcp.json and files in .github.

Additional context

Windows

johnmreynolds avatar Sep 08 '26 08:09 johnmreynolds

Note that the behaviour doesn't quite match what the docs say:

https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers

This says: "When you start Copilot CLI inside a Git repository, the CLI walks from your current working directory up to the repository root, loading MCP configuration files along the way."

Though it doesn't say exactly what happens if you are not in a repo, this does sort of imply that it should be reading the files from the working directory.

johnmreynolds avatar Sep 08 '26 08:09 johnmreynolds

Hello! Can you give it a try with the newly released 1.0.85 version of the Copilot CLI? It includes some fixes that address .mcp.json loading behavior. The workspace must be trusted through for it to work (either tmp in a session opened by the CLI or permanently to use CLI commands without launching the interactive TUI).

Let me know what you find!

marcherschel avatar Sep 16 '26 08:09 marcherschel

Hello! Can you give it a try with the newly released 1.0.85 version of the Copilot CLI? It includes some fixes that address .mcp.json loading behavior. The workspace must be trusted through for it to work (either tmp in a session opened by the CLI or permanently to use CLI commands without launching the interactive TUI).

Let me know what you find!

From a quick test, it looks like it does work. Thanks!

johnmreynolds avatar Sep 18 '26 11:09 johnmreynolds

Feel free to close the issue to mark this as being done!

marcherschel avatar Sep 18 '26 11:09 marcherschel

This does seem to be fixed now (thanks all), so will close.

johnmreynolds avatar Sep 19 '26 16:09 johnmreynolds

مننون

frshyddsjady-dev avatar Sep 19 '26 18:09 frshyddsjady-dev

Describe the bug

I've got a project which is not a monorepo, but instead has several repos in a workspace directory which itself isn't a git repo.

The copilot cli harness in this case fails to read .mcp.json or hook files (and probably other config I've not tested) which is in the project directory.

Creating an empty git repo at the root fixes this, but this shouldn't be necessary.

For reference to similar harnesses, Claude CLI reads workspace level files.

Affected version

No response

Steps to reproduce the behavior

Create a directory containing a simple .mcp.json.

Within this create a git repo.

Launch copilot cli from the directory.

Expected behavior

Copilot reads config files such as .mcp.json and files in .github.

Additional context

Windows

frshyddsjady-dev avatar Sep 19 '26 18:09 frshyddsjady-dev

Describe the bug

I've got a project which is not a monorepo, but instead has several repos in a workspace directory which itself isn't a git repo.

The copilot cli harness in this case fails to read .mcp.json or hook files (and probably other config I've not tested) which is in the project directory.

Creating an empty git repo at the root fixes this, but this shouldn't be necessary.

For reference to similar harnesses, Claude CLI reads workspace level files.

Affected version

No response

Steps to reproduce the behavior

Create a directory containing a simple .mcp.json.

Within this create a git repo.

Launch copilot cli from the directory.

Expected behavior

Copilot reads config files such as .mcp.json and files in .github.

Additional context

Windows

frshyddsjady-dev avatar Sep 19 '26 18:09 frshyddsjady-dev