Skip to content

Client setup

Copilot CLI mcp-config.json: add a remote fetch server

Add a remote fetch MCP server to GitHub Copilot CLI with copilot mcp add or mcp-config.json, see which config file wins, and check it with /mcp show.

By Lucian Dyer, FetchMCP team · Published

This article was drafted with AI assistance from the sources listed below and edited and published by the FetchMCP team. Disclosure: the FetchMCP API, which this article mentions, is this site's own product.

A remote fetch server in Copilot CLI
  1. 1Add itcopilot mcp add --transport http with --header, or an mcpServers entry in ~/.copilot/mcp-config.json.
  2. 2Set the fieldstype http, url and tools are required; headers and timeout are optional.
  3. 3Mind the filesProject .mcp.json and .github/mcp.json win over the user file; .vscode/mcp.json is not read.
  4. 4Check it/mcp show fetchmcp lists the server's status and its tools.

GitHub Copilot CLI has its own MCP config file, and it is not the one VS Code uses. A .vscode/mcp.json that works in the editor does nothing in the terminal. This post adds a remote fetch server to the CLI, by command and by hand, and shows how to confirm that its tools loaded.

Checked against GitHub's Copilot CLI MCP how-to and the CLI command reference on 2026-11-25.

Add the server with one command

copilot mcp add --transport http registers a remote server. Pass the key with --header:

copilot mcp add --transport http \
  --header "Authorization: Bearer YOUR_KEY" \
  fetchmcp https://fetchmcp.net/mcp

The server goes into your user configuration at ~/.copilot/mcp-config.json. The flags come before the server name and the URL, as in GitHub's own example.

--transport takes stdio, http or sse, and the default is stdio. Leave it out and the CLI expects a command to launch, not a URL.

--header "HEADER: VALUE" can be repeated. --tools limits the tool set: "*" for all (the default), a comma-separated list, or "" for none. --timeout sets a limit in milliseconds for tool discovery and tool calls.

The same entry in mcp-config.json

The user file wraps servers in an mcpServers object. A remote entry looks like this:

{
  "mcpServers": {
    "fetchmcp": {
      "type": "http",
      "url": "https://fetchmcp.net/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_KEY"
      },
      "tools": ["*"]
    }
  }
}
  1. type is http for Streamable HTTP. The reference also accepts "streamable-http" and turns it into "http".
  2. url is the server address. It is required.
  3. tools is required as well. ["*"] enables every tool; a list of names enables only those.
  4. headers is optional. The reference says it "Supports variable expansion".
  5. timeout is optional, in milliseconds, with a default of 30000.

Variables in headers

headers is where the key goes. The reference says the field "Supports variable expansion" but does not spell out the syntax for headers. For the env field it lists $VAR, ${VAR} and ${VAR:-default}.

If you want a variable in the header instead of the key itself, try it and call a tool once before you rely on it. If the server rejects the key, the header did not carry the value. The authentication guide covers what a rejected bearer key looks like from the client side.

Which file wins

Copilot CLI reads more than one file. Know the order before you debug a server that "ignores" your edit.

  1. ~/.copilot/mcp-config.json is the user file, the one copilot mcp add writes.
  2. .mcp.json and .github/mcp.json are project files. The CLI reads them from the working directory up to the Git root.
  3. If both project files sit in the same directory, .mcp.json wins.
  4. When two files define the same server name, the file closer to your working directory wins, and project files win over the user file.
  5. --additional-mcp-config adds a server for one session, as a JSON string or a file path prefixed with @. It ranks above workspace files.

Project files accept the mcpServers wrapper or bare server entries at the top level.

/mcp edit fetchmcp refuses a server that comes from a repository's .mcp.json. Saving would create a user entry with the same name that the workspace entry still hides. The error names the file to edit instead.

Project servers need a trusted folder

Project-level servers load only after you confirm folder trust on first launch. In an untrusted directory they are skipped. If a teammate's shared fetch server is missing, check trust before the URL.

In prompt mode (copilot -p), project servers load automatically in trusted directories. Setting GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP to true loads them in untrusted ones too.

Why .vscode/mcp.json is ignored

.vscode/mcp.json is not read by Copilot CLI. It uses the top-level key servers, which the CLI does not support. The command reference gives a one-line migration for POSIX shells, which needs jq:

jq '{mcpServers: .servers}' .vscode/mcp.json > .mcp.json

The result is a project file the CLI accepts. The command only moves the entries under a new top-level key, so read each header value in the new file before you rely on it.

Check that it connected

  1. copilot mcp list lists servers from the user, workspace and plugin sources.
  2. copilot mcp get fetchmcp shows the stored configuration and whether the server is enabled.
  3. /mcp show fetchmcp inside a session shows the server's status and the tools it provides.
  4. /mcp list prints a plain-text list with connection status.

copilot mcp disable fetchmcp turns a server off without deleting it, and the change persists to the user configuration. --disable-mcp-server=fetchmcp disables a specific server from the command line.

For the other clients, see the remote MCP server setup guide.

Try it with a real server

FetchMCP API runs a Streamable HTTP server that takes Authorization: Bearer <key>, so the http entry above is all Copilot CLI needs. The MCP server registers 2 tools: get_page_contents reads one public URL per call, and get_account_status shows credits left, plan and rate limit. Failed fetches cost 0 credits.

Copy the current URL from the MCP docs and request a key.

Frequently asked questions

Where does GitHub Copilot CLI store MCP servers?

User-level servers go in ~/.copilot/mcp-config.json, which is where copilot mcp add writes them. Project-level servers come from .mcp.json and .github/mcp.json, read from the working directory up to the Git root, and load only in a trusted folder.

Does Copilot CLI read .vscode/mcp.json?

No. GitHub's docs say Copilot CLI does not read the VS Code file, because it uses the top-level key servers, which the CLI does not support. Copy its contents under mcpServers in a .mcp.json file instead.

Which fields does a remote server need in mcp-config.json?

type set to http (or sse), url and tools. headers and timeout are optional. The timeout covers tool discovery and tool calls and defaults to 30000 milliseconds.

How do I check that Copilot CLI connected to the server?

Type /mcp show followed by the server name inside a session. It shows the server's status and the tools it provides. copilot mcp list lists servers from the user, workspace and plugin sources.

Sources

  1. Adding MCP servers for GitHub Copilot CLI (Documentation)
  2. GitHub Copilot CLI command reference (Documentation)