-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add --no-mcp-auto-discover flag to disable automatic .mcp.json discovery #3419
Copy link
Copy link
Open
Labels
area:configurationConfig files, instruction files, settings, and environment variablesConfig files, instruction files, settings, and environment variablesarea:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registryMCP server configuration, discovery, connectivity, OAuth, policy, and registryarea:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automationNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation
Metadata
Metadata
Assignees
Labels
area:configurationConfig files, instruction files, settings, and environment variablesConfig files, instruction files, settings, and environment variablesarea:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registryMCP server configuration, discovery, connectivity, OAuth, policy, and registryarea:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automationNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation
Type
Fields
Give feedbackNo fields configured for Feature.
When running Copilot CLI in headless/automated scenarios (e.g., as a bot backend, CI pipeline, or background service), the CLI auto-discovers
.mcp.jsonfrom the workspace root and loads all MCP servers defined there. Some MCP servers (e.g., GenevaMonitoring) require interactive browser authentication and will hang or fail in headless environments. There's currently no way to prevent auto-discovery — you can only add more servers via--additional-mcp-config, not exclude the auto-discovered ones.Proposed solution
Add a flag like --no-mcp-auto-discover (or --mcp-config-only) that disables automatic loading of .mcp.json from the workspace root. When used with --additional-mcp-config, it gives full control over exactly which MCP servers are loaded — essential for headless automation.
Only load the explicitly specified MCP config, skip .mcp.json auto-discovery
copilot --no-mcp-auto-discover --additional-mcp-config "@.copilot-mcp-enrichment.json" -p "..."
Example prompts or workflows
Additional context