How to Connect GitHub Copilot to an MCP Server
GitHub Copilot in VS Code supports MCP (Model Context Protocol). That means Copilot Chat can read external tools and data sources through a small config file VS Code already understands.
What you need
- VS Code with GitHub Copilot (Copilot Chat, with agent mode available)
- An MCP server URL from the service you want to connect (for example,
https://hjarni.com/mcp)
Copilot reads MCP servers from an mcp.json file. You can scope it to one repo or to your whole machine.
Option 1: Workspace config (one repo)
Create .vscode/mcp.json in the root of your repo. Every contributor who opens the repo gets the same server:
{
"servers": {
"hjarni": {
"type": "http",
"url": "https://hjarni.com/mcp"
}
}
}
Save the file. VS Code picks up the server the next time you open Copilot Chat in agent mode.
Option 2: User config (every repo)
To make the server available across all your projects, open the command palette and run MCP: Open User Configuration. VS Code opens your user-level mcp.json. Add the same server entry there:
{
"servers": {
"hjarni": {
"type": "http",
"url": "https://hjarni.com/mcp"
}
}
}
A user-level server follows you into every repo you open. A workspace server only loads inside the repo where the file lives.
Get the root key right
VS Code uses servers as the root key. Claude Desktop and several other clients use mcpServers. If you copy a config from a Claude guide, the wrong key is the most common reason Copilot does not see the server.
For a remote server, set "type": "http" and point url at the server endpoint. Then open Copilot Chat in agent mode. VS Code opens a browser tab for the OAuth sign-in. You sign in once.
Verifying the connection
In Copilot Chat agent mode, open the tool list and confirm the server's tools are listed. Then ask Copilot to use one. For example, if you connected Hjarni:
"Search Hjarni for our deploy runbook and summarize the rollback steps."
If you see a tool call in the response, the connection is working.
Troubleshooting
Copilot does not list the tools
Check the root key is servers, not mcpServers, and that the file is valid JSON. The full walkthrough is in VS Code with Copilot: wrong root key in mcp.json.
The OAuth tab never finishes
Make sure you started from agent mode, not ask mode. Reload the window after editing mcp.json so VS Code re-reads the file.
Tools appear but return nothing
Confirm you approved the connection during sign-in and that the account you signed in with has notes to read.
Try it with Hjarni
Hjarni is a knowledge base with a built-in MCP server. Connect it to Copilot and agent mode can read your architecture notes, conventions, and runbooks before it writes. Stop pasting the same context into every chat.
The MCP server URL is https://hjarni.com/mcp. Two minutes to set up. The same notes are also read by Claude and ChatGPT, so the context follows you across clients.