VS Code
Connect GitHub Copilot's agent mode in VS Code to approvals through .vscode/mcp.json, with the key asked for once.
In VS Code, Copilot’s agent mode uses MCP tools. Connect the approvals server and the agent can ask a person before it acts, with the question landing in the same inbox as every other agent you run.
Connect the server
Create a key under Agents in your workspace first. Then:
Add this to .vscode/mcp.json. VS Code asks for the key once and keeps it out of the file.
{
"inputs": [
{
"description": "Agent key",
"id": "variantgate-key",
"password": true,
"type": "promptString"
}
],
"servers": {
"variantgate": {
"headers": {
"Authorization": "Bearer ${input:variantgate-key}"
},
"type": "http",
"url": "https://api.variantgate.com/mcp"
}
}
}The first time the server starts, VS Code asks for the key and stores it securely, so .vscode/mcp.json can be committed and shared with the team. Each person enters their own key. Start the server from the file’s inline Start action or the MCP: List Servers command.
VS Code now marks .vscode/mcp.json as deprecated, to be removed in February 2027. Its newer Copilot configuration, ~/.copilot/mcp-config.json or a .mcp.json at the workspace root, lists servers under mcpServers and cannot ask for the key. There, put the key in VARIANTGATE_KEY and write the header as Bearer ${VARIANTGATE_KEY}.
Tell the agent when to ask
Add these lines to the instructions the agent reads, such as .github/copilot-instructions.md:
Before you send, pay, publish, deploy or delete anything, call
request_approval with one sentence saying exactly what will happen.
Then call check_approval until it is no longer pending.
Act only if "allowed" is true. Otherwise stop and say why.VS Code asks you to confirm tool calls on your own screen. The approval here is different: it can be answered from a phone or by a teammate, rules can answer routine requests, and it stays on the record.
Check that it works
In agent mode, ask for something that needs approval. A request appears in the inbox; approve it and the agent carries on, deny the next and check that it stops.