Copilot MCP: add MCP servers to GitHub Copilot.

GitHub Copilot reads MCP servers in three places. In VS Code, add them to .vscode/mcp.json or run MCP: Add Server. In the Copilot CLI, run copilot mcp add, which saves to ~/.copilot/mcp-config.json. For the Copilot cloud agent on GitHub, paste a config in the repository settings. The formats are close but not the same, and that's where most setups break.

Book a demo

Here to connect Copilot to a database? Jump to the worked example.

Overview

Where Copilot reads MCP config.

Pick the row for the Copilot you use. Note the top-level key: VS Code wants servers, everything else wants mcpServers.

Copilot File Key Note
VS Code, one project .vscode/mcp.json servers Commit it to share servers with your team.
VS Code, all projects User profile mcp.json servers Open it with MCP: Open User Configuration.
Copilot CLI, all projects ~/.copilot/mcp-config.json mcpServers What copilot mcp add writes. VS Code lists it as a global location too.
Copilot CLI, one repo .mcp.json or .github/mcp.json mcpServers Loaded after you trust the folder. .mcp.json wins if both exist.
Copilot cloud agent Repo Settings, Copilot, MCP servers mcpServers Runs on GitHub, so it can't reach servers on your laptop.

VS Code

Add an MCP server to Copilot in VS Code.

Run MCP: Add Server from the Command Palette. It asks for the type (HTTP or a command), a server ID, and whether to save it to the workspace or your user profile. Or write the file yourself. Copilot uses MCP tools in Agent mode, and asks before it runs one.

Remote server (HTTP)

JSON
// .vscode/mcp.json
{
  "servers": {
    "context7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp"
    }
  }
}

Local server (stdio) with a secret

JSON
// .vscode/mcp.json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "perplexity-key",
      "description": "Perplexity API Key",
      "password": true
    }
  ],
  "servers": {
    "perplexity": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "server-perplexity-ask"],
      "env": {
        "PERPLEXITY_API_KEY": "${input:perplexity-key}"
      }
    }
  }
}

Keep secrets out of the file.

An inputs entry with "password": true makes VS Code prompt for the value once and store it. Reference it as ${input:id}. For stdio servers, envFile loads variables from a .env file instead.

Commands worth knowing.

MCP: List Servers starts, stops, and restarts servers and shows their logs. MCP: Reset Cached Tools helps when a server changed its tools. With chat.mcp.discovery.enabled, VS Code also picks up servers you set up in Claude Desktop, Cursor, or the Copilot CLI.

Copilot CLI

The copilot mcp commands.

The CLI's default transport is stdio, so remote servers need --transport http. The GitHub MCP server is built in, so you don't add it yourself. copilot mcp add --help lists every option.

copilot mcp add <name> -- <command> [args] Add a local stdio server. Everything after -- is the command Copilot starts.
copilot mcp add --transport http <name> <url> Add a remote server over streamable HTTP. Use --transport sse for older servers.
--env KEY=VALUE · --header "K: V" Environment variables for a stdio server, headers for a remote one. Both can be repeated.
--tools "a,b" Only expose these tools. The default is * for all, and "" exposes none.
copilot mcp list Show every server, grouped by source: user, workspace, plugin, built-in.
copilot mcp get <name> Show one server's type, URL or command, and tools. Secrets are masked.
copilot mcp disable <name> · enable <name> Turn a server off or on without deleting it.
copilot mcp remove <name> Delete a server from ~/.copilot/mcp-config.json. Repo servers are removed from their own file.
/mcp · /mcp add · /mcp show <name> Inside a Copilot session: list servers, add one with a form, see a server's status and tools.
Terminal
# stdio: Copilot starts the server as a local process
$ copilot mcp add context7 -- npx -y @upstash/context7-mcp

# remote: Copilot connects to a URL
$ copilot mcp add --transport http valv-desktop http://127.0.0.1:4319/mcp

$ copilot mcp list

What the CLI saves

JSON
// ~/.copilot/mcp-config.json
{
  "mcpServers": {
    "context7": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"],
      "tools": ["*"]
    },
    "stripe": {
      "type": "http",
      "url": "https://mcp.stripe.com",
      "headers": { "Authorization": "Bearer rk_live_xxx" },
      "tools": ["*"]
    }
  }
}

Permissions for MCP tools.

The CLI asks before a tool runs. To skip that for a server you trust, start it with copilot --allow-tool 'valv-desktop', or allow a single tool with --allow-tool 'valv-desktop(query)'. --deny-tool takes the same patterns and always wins, even over --allow-all-tools. Non-interactive runs with copilot -p need --allow-all-tools, so add deny rules for anything you want blocked.

Cloud agent

MCP for the Copilot cloud agent.

The agent you assign issues to on GitHub has its own config. In the repository, open Settings, then Copilot, and add JSON in the MCP configuration section. GitHub validates it when you save.

  • tools is required. List tools by name, or use ["*"]. GitHub recommends allowing only read-only tools, because the agent uses them without asking.
  • Secrets need a prefix. Add them to the repo's copilot environment with names starting COPILOT_MCP_, then reference them as $COPILOT_MCP_NAME.
  • No OAuth servers yet. Remote servers that log in with OAuth don't work here. Token-based ones do.
  • It runs on GitHub. A server on your own machine, like Valv's, isn't reachable from it.

Repository settings, MCP configuration

JSON
{
  "mcpServers": {
    "sentry": {
      "type": "http",
      "url": "https://mcp.sentry.io",
      "headers": { "Authorization": "Bearer $COPILOT_MCP_SENTRY_TOKEN" },
      "tools": ["get_issue_details", "get_issue_summary"]
    }
  }
}

When an MCP server doesn't work in Copilot.

In VS Code, start with MCP: List Servers. In the CLI, start with copilot mcp list, then /mcp show <name> in a session.

VS Code: the server's tools don't show up in chat Switch the chat to Agent mode. MCP tools only run there. Then open the tools picker and check the server's tools are ticked.
VS Code: the server is stopped or keeps failing Run MCP: List Servers, pick the server, and choose Show Output for its log. Restart it from the same menu after you change the config.
VS Code ignores a config copied from another client VS Code's mcp.json uses a top-level "servers" key. Configs written for Claude Desktop, Cursor, or the Copilot CLI use "mcpServers".
CLI: a repo's .mcp.json isn't loaded Copilot only reads project MCP files after you trust the folder. copilot mcp list shows which sources it loaded.
CLI: Copilot keeps asking before each tool call Approve the server once with --allow-tool 'name' or a single tool with --allow-tool 'name(tool)'. Deny rules always win over allow rules.
Cloud agent: config rejected or tools missing Every server needs a tools array, and secrets must be named COPILOT_MCP_*. Remote servers that need OAuth don't work there yet.
Valv: connection refused on 127.0.0.1:4319 Valv Desktop isn't open, or it picked another port because 4319 was taken. Copy the URL from Settings, MCP Server again.
Valv: Copilot sees the wrong data, or none Copilot works against the workspace that is active in Valv. Switch to the workspace that holds your database. With no workspace open, the server answers 503.

Worked example

Connect Copilot to a database through Valv's MCP server.

Valv Desktop runs a local streamable HTTP server while the app is open. It holds the database connection, so Copilot only gets a URL and read-only tools, never the password.

  1. 1

    Add your database in Valv.

    Connect Postgres, MySQL, SQLite, ClickHouse, or MongoDB. Hide any table or column Copilot shouldn't see in the AI access tab.

  2. 2

    Copilot CLI: copy the command.

    Open Settings, MCP Server, and expand GitHub Copilot. Port 4319 is the default. If it's taken, Valv uses another port, so copy what the app shows.

    copilot mcp add --transport http valv-desktop http://127.0.0.1:4319/mcp
  3. 3

    VS Code: add the same URL.

    Valv's settings show the JSON with mcpServers, which suits most clients. For VS Code, put it under servers. No token is needed.

    // .vscode/mcp.json
    {
      "servers": {
        "valv-desktop": {
          "type": "http",
          "url": "http://127.0.0.1:4319/mcp"
        }
      }
    }
  4. 4

    Ask Copilot.

    Keep Valv open. In VS Code, use Agent mode. Copilot works against whichever workspace is active in Valv, and reads Valv's server instructions on how to use the tools.

Tools Copilot gets from Valv

list_datasources

Databases and remote MCP servers in the active workspace.

list_resources · describe_resource

Tables and their columns, minus anything hidden in AI access.

query

A structured, read-only query that Valv validates before it runs.

run_code

Several read queries chained in one step.

remember

Proposes a fact for workspace memory. You confirm it in Valv.

read_file · write_file · edit_file

Dashboards and other files in the workspace folder.

run_flow · set_flow_enabled · notify

Test and turn on scheduled checks, send a notification.

With more than one datasource, data tools get a prefix such as app__query. Remote MCP servers connected in Valv, like PostHog, come through with their own prefix.

copilot
> Which features did last week's new signups use first?

tool  valv-desktop / list_datasources
tool  valv-desktop / describe_resource   events
tool  valv-desktop / query               feature, user_id, created_at

Top first-used features as a table, with
the query object in each tool call.

> Save that as a dashboard I can open in Valv.

An illustration of the flow, not a recorded session. Tool names and columns depend on your schema. The second prompt has Copilot write a dashboard file into the Valv workspace.

Only want answers, no files?

The file tools write dashboards into the Valv workspace, not to the database. In the CLI, block them with --deny-tool 'valv-desktop(write_file)' and the same for edit_file. In VS Code, untick them in the tools picker.

You can also skip the setup and pick GitHub Copilot as the agent inside Valv, with tables and charts next to the chat. Valv runs it through the Copilot CLI you're already signed in to.

Which MCP server to add for what.

Valv is one option for data. It isn't the right pick for everything.

GitHub itself

Issues, pull requests, and Actions. The CLI ships the GitHub MCP server built in. In VS Code, add it like any other remote server.

Raw SQL and tuning

If Copilot should run EXPLAIN, suggest indexes, or write migrations, a standalone database server fits better. Valv doesn't run raw SQL. The Postgres MCP guide compares the options.

Read-only data answers

Valv, when Copilot should answer questions from Postgres, MySQL, SQLite, ClickHouse, or MongoDB without write access or your password. The database MCP guide has the setup for other clients.

Using another agent too? See the Claude Code MCP guide and the Codex MCP guide.

Copilot MCP, answered

How do I add an MCP server to GitHub Copilot?

In VS Code, run MCP: Add Server from the Command Palette, or add the server to .vscode/mcp.json under "servers". In the Copilot CLI, run copilot mcp add <name> -- <command> for a local server, or copilot mcp add --transport http <name> <url> for a remote one. For the Copilot cloud agent, paste a JSON config in the repository's Settings under Copilot, MCP servers.

Where is the MCP config file for Copilot?

VS Code reads .vscode/mcp.json in the workspace and an mcp.json in your user profile. The Copilot CLI stores servers in ~/.copilot/mcp-config.json, and also reads .mcp.json or .github/mcp.json in a trusted repo. The cloud agent's config lives in the repository settings on GitHub.

What's the difference between "servers" and "mcpServers"?

VS Code's mcp.json uses a top-level "servers" object. The Copilot CLI, the cloud agent, and most other clients use "mcpServers". The entries inside look alike (type, url, command, args, env, headers), so you can usually move a server by changing the outer key. The CLI and cloud agent also expect a tools array.

Does Copilot support remote MCP servers?

Yes. VS Code and the Copilot CLI connect to remote servers over streamable HTTP, with SSE for older servers. The Copilot cloud agent supports remote servers too, but not ones that need OAuth to log in.

Can the Copilot cloud agent use a local MCP server?

It can run stdio servers it starts itself, but it runs on GitHub's infrastructure, so it can't reach a server on your own machine, such as one on 127.0.0.1. Use VS Code or the Copilot CLI for local servers.

Can GitHub Copilot query my database over MCP?

Yes. With Valv Desktop open, run copilot mcp add --transport http valv-desktop http://127.0.0.1:4319/mcp, or add the same URL to .vscode/mcp.json. Copilot can then list, describe, and query the tables in Valv's active workspace with read-only tools, and it never receives your database password.

Give Copilot your database over MCP.

Free for personal use, every feature included. Commercial use needs a seat at beta pricing. See pricing.

All downloads Other platforms and builds