Adding MCP servers to GitHub Copilot
How do I connect MCP servers to GitHub Copilot in VS Code and to Copilot cloud agent on GitHub?
In VS Code, define servers under a top-level servers key in .vscode/mcp.json for a workspace, or in your user profile mcp.json via the MCP: Open User Configuration command. Use an inputs array to prompt for secrets instead of hardcoding them. For Copilot cloud agent on GitHub, paste a JSON config with an mcpServers key into the repository Settings under Copilot, then MCP servers.
Compare: add an MCP server in every AI coding agent →
Where VS Code reads MCP config
- Workspace: .vscode/mcp.json, with servers in a top-level servers object.
- Workspace, portable format: .mcp.json at the workspace root, with servers in an mcpServers object. VS Code recommends this file for configurations you share with your team.
- User profile: run MCP: Open User Configuration to open the mcp.json file in your profile.
- Run MCP: Add Server from the Command Palette for a guided setup, and MCP: List Servers to see and manage configured servers.
- For MCP servers from sources other than the workspace, VS Code shows a trust dialog when a server first starts or its configuration changes. MCP: Reset Trust clears those decisions.
Server types and fields
Each entry under servers has a type of stdio, http, or sse. A stdio server needs a command and can add args, cwd, env, and envFile. An http or sse server needs a url and can add headers.
.vscode/mcp.json
{
"servers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp"
},
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@microsoft/mcp-server-playwright"]
}
}
}Keep secrets out of the file with inputs
Declare an inputs array with a promptString entry and set password to true. Reference it as ${input:ID} in env or headers, and VS Code asks for the value when the server starts instead of storing it in the file.
.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}"
}
}
}
}MCP for Copilot cloud agent on GitHub
In the repository, open Settings, then Copilot under Code, planning, and automation, then MCP servers, and paste a JSON config. It uses an mcpServers key, each server needs a tools array (use ["*"] to allow all tools), and type can be local, stdio, http, or sse.
Repository Settings, Copilot, MCP servers
{
"mcpServers": {
"my-server": {
"type": "local",
"command": "npx",
"args": ["-y", "your-mcp-server-package"],
"tools": ["*"],
"env": {
"API_KEY": "$COPILOT_MCP_API_KEY"
}
}
}
}- Only Agents secrets and variables whose names start with COPILOT_MCP_ are available to the MCP configuration.
- The GitHub and Playwright MCP servers are enabled by default alongside your own servers.
- Copilot cloud agent only supports MCP tools, not resources or prompts.
- Remote MCP servers that use OAuth for authentication are not currently supported for the cloud agent.
Sources
More GitHub Copilot guides
- GitHub Copilot custom instructions
- copilot-setup-steps.yml: set up the GitHub Copilot cloud (coding) agent environment
- GitHub Copilot CLI permissions: --allow-tool, --deny-tool, --allow-all-tools and trusted directories
- GitHub Copilot custom agents: .github/agents/*.agent.md profiles, tools and frontmatter
- GitHub Copilot code review settings: automatic PR reviews, rulesets, effort level and approvals
- GitHub Copilot hooks: .github/hooks/*.json for Copilot CLI and the cloud agent
- Run GitHub Copilot CLI with copilot -p in scripts and CI (2026)
- GitHub Copilot prompt files in VS Code: .github/prompts/*.prompt.md slash commands
Reviewed Oct 18, 2026. Settings change often; the linked vendor docs are the source of truth.
Built an MCP server? Get it listed everywhere →
Shipping an Android app? Google Play needs 12 testers for 14 days first. Get them with Tester Exchange →