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: content/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp.md
+23-16Lines changed: 23 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,18 +81,27 @@ The configuration object can contain the following keys:
81
81
**Local MCP specific keys**
82
82
*`command` (`string`): Required. The command to run to start the MCP server.
83
83
*`args` (`string[]`): Required. The arguments to pass to the `command`.
84
-
*`env` (`object`): Optional. The environment variables to pass to the server. This object should map the name of the environment variable that should be exposed to your MCP server to either of the following:
85
-
*The name of a secret you have configured in your {% data variables.product.prodname_copilot_short %} environment, beginning with `COPILOT_MCP_`.
86
-
*The name of a variable you have configured in your {% data variables.product.prodname_copilot_short %} environment, beginning with `COPILOT_MCP_`.
84
+
*`env` (`object`): Optional. The environment variables to pass to the server. This object should map the name of the environment variable that should be exposed to your MCP server to one of the following:
85
+
*A substitution reference to a secret or variable in your {% data variables.product.prodname_copilot_short %} environment, such as `$COPILOT_MCP_API_KEY` or `${COPILOT_MCP_API_KEY}`. Referenced names must start with `COPILOT_MCP_`.
86
+
*A literal string value.
87
87
88
88
**Remote MCP specific keys**
89
89
*`url` (`string`): Required. The MCP server's URL.
90
-
*`headers` (`object`): Optional. The headers to attach to requests to the server. This object should map the name of header keys to either of the following:
91
-
* The name of a secret you have configured in your {% data variables.product.prodname_copilot_short %} environment, beginning with `COPILOT_MCP_` preceded by a `$`.
92
-
* The name of a variable you have configured in your {% data variables.product.prodname_copilot_short %} environment, beginning with `COPILOT_MCP_` preceded by a `$`.
93
-
* A string value.
90
+
*`headers` (`object`): Optional. The headers to attach to requests to the server. This object should map the name of header keys to one of the following:
91
+
* A substitution reference to a secret or variable in your {% data variables.product.prodname_copilot_short %} environment, such as `$COPILOT_MCP_API_KEY` or `${COPILOT_MCP_API_KEY}`. Referenced names must start with `COPILOT_MCP_`.
92
+
* A literal string value.
94
93
95
-
Note that all `string` and `string[]` fields besides `tools` & `type` support substitution with a variable or secret you have configured in your {% data variables.product.prodname_copilot_short %} environment, beginning with `COPILOT_MCP_` preceded by a `$`.
94
+
Note that all `string` and `string[]` fields besides `tools` & `type` support substitution with a variable or secret you have configured in your {% data variables.product.prodname_copilot_short %} environment.
95
+
96
+
### Variable substitution
97
+
98
+
The following syntax patterns are supported for referencing environment variables configured in your {% data variables.product.prodname_copilot_short %} environment:
Copy file name to clipboardExpand all lines: content/copilot/reference/custom-agents-configuration.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,14 +120,14 @@ For compatibility, the `stdio` type used by Claude Code and {% data variables.pr
120
120
121
121
Both the repository-level MCP JSON configuration and the {% data variables.copilot.copilot_custom_agent_short %} YAML configuration support the following syntax patterns:
122
122
123
-
*`COPILOT_MCP_ENV_VAR_VALUE` - Environment variable only (not recommended due to header differences)
124
123
*`$COPILOT_MCP_ENV_VAR_VALUE` - Environment variable and header
125
124
*`${COPILOT_MCP_ENV_VAR_VALUE}` - Environment variable and header (Claude Code syntax)
125
+
*`${COPILOT_MCP_ENV_VAR_VALUE:-default}` - Environment variable and header with default
126
126
127
127
The {% data variables.copilot.copilot_custom_agent_short %} YAML configuration supports the following additional syntax patterns:
128
128
129
129
*`{% raw %}${{ secrets.COPILOT_MCP_ENV_VAR_VALUE }}{% endraw %}` - Environment variable and header
130
-
*`{% raw %}${{ var.COPILOT_MCP_ENV_VAR_VALUE }}{% endraw %}` - Environment variable and header
130
+
*`{% raw %}${{ vars.COPILOT_MCP_ENV_VAR_VALUE }}{% endraw %}` - Environment variable and header
131
131
132
132
## Example {% data variables.copilot.agent_profile %} configurations
0 commit comments