You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/src/content/docs/reference/mcp.mdx
+53-6Lines changed: 53 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,9 +56,57 @@ mcp-servers:
56
56
57
57
**Common (both types):**
58
58
- `enabled:` - Whether this MCP server is active (default: `true`). Set to `false` to temporarily disable an entry without removing it from the front matter.
59
-
- `allowed:`- Array of tool names the agent is permitted to call (required for security)
59
+
- `allowed:`- Array of tool names the agent is permitted to call from this server (required for security). See [Two-Level Permission Model](#two-level-permission-model) for how this interacts with Copilot CLI's `--allow-tool`.
60
60
- `env:`- Environment variables for the MCP server process. Use `""` (empty string) for passthrough from the pipeline environment.
61
61
62
+
## Two-Level Permission Model
63
+
64
+
MCP security operates at **two distinct layers**, both of which must grant permission for an agent to successfully call an MCP tool:
65
+
66
+
### Layer 1: Copilot CLI Server Access (`--allow-tool <server-name>`)
67
+
68
+
The Copilot CLI controls which MCP servers the agent can *access* via `--allow-tool` flags. The compiler automatically generates these flags for:
69
+
70
+
- **Built-in extensions** — `github`, `safeoutputs`, and `azure-devops` (when configured via `tools.azure-devops`)
71
+
- **User-defined MCP servers** — any server in `mcp-servers:` with a `container:` or `url:` backing
72
+
73
+
For example, if you define an `azure-devops` server in `mcp-servers:`, the compiled pipeline includes:
74
+
75
+
```bash
76
+
copilot --allow-tool azure-devops ...
77
+
```
78
+
79
+
This grants the agent permission to *connect to the server*. Without this flag, the agent cannot communicate with the server at all, regardless of the `allowed:` list.
80
+
81
+
**When is `--allow-tool` automatic?**
82
+
- **Restricted bash mode** (explicit `bash: [...]` list) — the compiler emits individual `--allow-tool` flags for each server.
83
+
- **Wildcard bash mode** (omitted `bash:` or `bash: [":*"]`) — the compiler emits `--allow-all-tools` instead, which grants access to all servers and tools without individual flags.
The MCP Gateway (MCPG) enforces the `allowed:` list for each server. Even if the agent has `--allow-tool azure-devops` permission, it can only call tools explicitly listed in the server's `allowed:` array.
# wit_update_work_item ❌ Not in allowed list → MCPG blocks
99
+
```
100
+
101
+
If the agent attempts to call `wit_update_work_item`, MCPG rejects the request even though the agent has `--allow-tool azure-devops`.
102
+
103
+
### Why Two Layers?
104
+
105
+
- **CLI layer (`--allow-tool`)** — coarse-grained server access control; prevents agents from discovering or connecting to servers they shouldn't use.
106
+
- **MCPG layer (`allowed:`)** — fine-grained tool access control; allows servers to expose many tools while agents only get a safe subset.
107
+
108
+
This defense-in-depth model ensures agents can only call the exact tools you intended, with no accidental privilege escalation.
109
+
62
110
## Environment Variable Passthrough
63
111
64
112
MCP containers may need secrets from the pipeline (e.g., ADO tokens). The `env:` field supports passthrough:
@@ -94,8 +142,7 @@ network:
94
142
95
143
## Security Notes
96
144
97
-
1. **Allow-listing**: Only tools explicitly listed in `allowed:` are accessible to agents
98
-
2. **Containerization**: Stdio MCP servers run as isolated Docker containers (per MCPG spec §3.2.1)
99
-
3. **Environment Isolation**: MCP containers are spawned by MCPG with only the configured environment variables
100
-
4. **MCPG Gateway**: All MCP traffic flows through the MCP Gateway which enforces tool-level filtering
101
-
5. **Network Isolation**: MCP containers run within the same AWF-isolated network. Users must explicitly allow external domains via `network.allowed`
145
+
1. **Two-level allow-listing**: Both `--allow-tool <server>` (CLI layer) and `allowed:` (MCPG layer) must grant permission for a tool call to succeed. See [Two-Level Permission Model](#two-level-permission-model) for details.
146
+
2. **Containerization**: Stdio MCP servers run as isolated Docker containers (per MCPG spec §3.2.1).
147
+
3. **Environment Isolation**: MCP containers are spawned by MCPG with only the configured environment variables.
148
+
4. **Network Isolation**: MCP containers run within the same AWF-isolated network. Users must explicitly allow external domains via `network.allowed`.
0 commit comments