Skip to content

Session-scope MCP configuration #51

Closed
Closed

Description

@mark-undoio

Describe the feature or problem you'd like to solve

Make it possible to extend / override MCP configuration for a single session without destructive edits to user config

Proposed solution

My proposed solution would be something like Claude Code's or Amp's --mcp-config (which takes an MCP config file directly) or Codex CLI's --config (which can override any configuration parameter).

The user would invoke Copilot CLI with their transient config:

copilot --mcp-config my_temporary_config.json

This could be useful:

  • When integrating Copilot CLI with an external tool that can export its functionality over HTTP on a dynamic port (this is my specific use case).
  • To easily switch between different MCP configurations during development, without having to make permanent edits to project- or user-wide config.
  • For automated testing, in which instances MCP servers may be started dynamically (in parallel) on a number of ports.

Example prompts or workflows

My target use case:

  1. My tool (which has its own, user-facing interface) wants to invoke the services of Copilot CLI as an agentic backend.
  2. My tool starts an MCP server to expose its functionality on a dynamically-allocated HTTP port.
  3. My tool invokes Copilot CLI, which takes on its usual configuration for the user / project but also applies the settings passed by --mcp-config so that it can find my tool's MCP server instance and provide user assistance.
  4. Copilot CLI accomplishes agentic work with my tool.
  5. Copilot CLI exits and my tool shuts down its MCP server instance.

Additional context

No response

Activity

  1. SteveSandersonMS commented on Sep 26, 2025

    @SteveSandersonMS
    Contributor

    Good suggestion, thanks. In general we want to expand the flexibility of the config system considerably, including the ability to have per-project config and config files passed in from the command line. As per your suggestion we should include the MCP configuration files in that.

  2. ellismg commented on Nov 4, 2025

    @ellismg
    Contributor

    We did something like this, with a few small tweaks from what you describe in the issue:

    1. We used --additional-mcp-config as the flag instead of just --mcp-config. This flag may be specificed multiple times.
    2. It takes JSON as an arugment by default, but you can use @ as a prefix to point it at a file.

    So in your example it would be:

    copilot --additional-mcp-config @my_temporary_config.json
    

    (this assumes my_temporary_config.json is located in your CWD).

    This aguments, the configuration you have in the tool via /mcp (which lives in ~/.copilot/`).

    Note you can use this to change the configuration of a server you have configured. If the same server name appears in the system configuration and in a JSON blob provided via --additional-mcp-config, we use the configuration from the one that came from --additional-mcp-config.

    Hope this helps, @mark-undoio and you build cool stuff with it!

  3. mark-undoio commented on Nov 6, 2025

    @mark-undoio
    Author

    Thank you @ellismg - this will be very useful.

    I'll update our implementation to use this (we'd been setting alternate XDG directories to make Copilot find our updated config in another place - this will be much cleaner and more robust).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions