Repository navigation
Description
Problem
- The migrator from
.vscode/mcp.json/<userdata>/mcp.jsonto.mcp.json(workspace) and~/.copilot/mcp-config.json(user) now migrates${env:}(mcp: migrate ${env:NAME} servers as ${NAME} references #340381) and non-secretpromptString/pickStringinputs (Migrate MCP servers that use inputs to environment variables #341224) and${config:}(chat: Migrate MCP servers that use settings to environment variables #341349) as environment variables. It still skips every server that usesenvFile,cwd, enterprise-managed OAuth or a stored OAuth client secret, password or command inputs, or another variable (${command:},${userHome}, …). See All cases for what's migrated today. ${workspaceFolder}is written into the committed.mcp.jsonas an absolute path, which breaks for teammates (B4).- The portable format (used by the Copilot CLI and agent runtime, and similar to Claude) supports only
$VAR,${VAR},${VAR:-default}and${secret:id}. It has noinputs, prompts, picks or commands.
Status
All merged:
| PR | What it changes |
|---|---|
| #340369 | VS Code's local harness expands ${VAR} and ${VAR:-default} in workspace .mcp.json servers, with the Copilot runtime's rules (E2) |
| #340381 | The migrator rewrites ${env:NAME} to ${NAME} instead of skipping the server (B1). The local harness also expands the Copilot user config mcp-config.json (E2) |
| #340379 | A .mcp.json URL is expanded only if it parses as written, matching the servers Copilot rejects (C7) |
| #340034 | VS Code's local harness reads migrated type: "local" servers from workspace .mcp.json (#339955) |
| #340181 | ~/.copilot/mcp-config.json is read by default in VS Code's local harness, and not forwarded to other agents or machines (#339955) |
| #341352 | The migrator migrates OAuth servers, writing oauthClientId, except enterprise-managed ones and ones with a stored client secret (C10) |
| #341349 | The migrator rewrites ${config:} to an environment variable set to the setting's current value (B3) |
| #341224 | The migrator rewrites non-secret promptString and pickString inputs to environment variables instead of skipping the server (A1, A2, A4, A5, D1, D3, D4). See "Inputs after #341224" below |
Inputs after #341224
The regular Migrate moves servers that use inputs like any other server. Each input becomes an environment variable:
| Input | Local (stdio) server | Remote (HTTP) server |
|---|---|---|
log-level, no default |
${LOG_LEVEL} + "env": { "LOG_LEVEL": "" } |
${LOG_LEVEL} |
region, default us-east-1 |
${REGION} + "env": { "REGION": "us-east-1" } |
${REGION:-us-east-1} |
pickString mode, default safe |
${MODE} + "env": { "MODE": "safe" } (the option's value) |
${MODE:-safe} |
path, 1st |
MCP_PATH, MCP_1ST |
same |
-
Name: the input id in uppercase, other characters replaced by
_. Prefixed withMCP_when it starts with a digit or is reserved: set by the OS or shell (PATH,HOME,GITHUB_TOKEN, …), filtered by the Copilot runtime (NODE_ENV,COPILOT_*,OTEL_*, …), or read as empty by Claude (ANTHROPIC_*,NPM_TOKEN, …). -
enventry: a local server declares each variable in itsenv, set to the input's default, or empty if it has none. The migration page warns: "Inputs will become environment variables. Configure them in the MCP server details after migrating." Where${NAME}is read from:Reference Copilot VS Code's own chat command,args(stdio)The server's enventry (or the environment Copilot starts in)Only the environment VS Code starts in, not the server's enventry, so${NAME}stays as literal text unless it's set thereOther envvalues ("KEY": "${API_KEY}")Only the environment Copilot starts in, not the sibling enventryOnly the environment VS Code starts in URL, headers (remote) The environment Copilot starts in The environment VS Code starts in An
enventry that only referenced the input ("MODE": "${input:mode}") is replaced by the value itself, so it works in both. -
inputsblock: a declaration is removed once nothing left in the file references it (other servers, rootsandbox, …). Unreferenced declarations that were already there are kept. -
Saved values are not migrated (D2).
-
Revalidated before writing: if an input's type,
passwordflag or options change after planning, the server fails withSourceChanged. Rollback restores removed declarations.
Still not migrated (listed for manual review with a reason):
| Case | Reason |
|---|---|
password: true (A3), command inputs (A6, A7), undeclared or undescribed inputs |
unsupportedInputType |
| Empty input id | invalidInputName |
Two inputs, or an input and an ${env:} in the same file, that map to the same name; an existing env entry with that name |
variableNameCollision |
| A default VS Code never uses (pick default not an option, boolean), or one that can't be written | unsupportedInputDefault |
${command:}, ${userHome} and other unsupported variables |
unsupportedVariable |
An input in an env or header name (C4, C9) |
environmentVariableInName |
| An input in the URL | unrepresentableConfiguration until E11 |
What VS Code's local harness expands in .mcp.json and mcp-config.json:
| Expanded | Never expanded | |
|---|---|---|
| Local (stdio) | command, each of args, env values |
env names, cwd |
| Remote (HTTP) | URL (host, path, query), header values | header names |
- Syntax:
${VAR}and${VAR:-default}. Bare$VARis not expanded in VS Code (unlike the Copilot runtime), so a hand-written$VARcopied from.vscode/mcp.jsonkeeps its old meaning. The migrator must always write the braced form. - Unset with no default: left as written. Set but empty: the empty value is used, not the default.
- Where values come from: the extension host that runs or connects to the server (local or remote). The web extension host has no environment and leaves them unchanged.
- Trust: still computed from the unexpanded config, so changing an environment variable doesn't re-prompt.
Decision: every input becomes an environment variable
Every ${input:<id>} is rewritten to a ${<NAME>} environment variable reference. No inputs are written in as literals, and none are kept as prompts.
| Input | Rewritten to | Example |
|---|---|---|
promptString with default |
${NAME:-<default>} |
${REGION:-us-east-1} |
promptString without default |
${NAME} |
${TENANT} |
promptString with password: true |
${NAME} (never a default) |
${API_KEY} |
pickString |
${NAME:-<default>} (uses value, not label) |
${STAGE:-dev} |
command |
${NAME} |
${PYTHON_PATH} |
- Name: the input
idin uppercase, with every character that isn't a letter or digit replaced by_(api-key→API_KEY). - Syntax:
${NAME}, because Copilot doesn't understand${env:NAME}today (see E6). VS Code's local harness expands${NAME}and${NAME:-default}the same way (see Status), so a migrated server keeps working in VS Code's own chat. Always write the braced form: VS Code doesn't expand bare$NAME. - Values aren't migrated. Saved answers and stored secrets stay in VS Code. The user sets the variables, and the migrator lists what to set (E7).
inputsblock: remove an input once no remaining server references it.- Exceptions: Copilot doesn't substitute variables in an
envname (C4), a header name (C9), or strings longer than 1000 characters. It also rejects the server when a URL's port or whole URL is a variable, or the host uses${VAR:-default}, because it validates the URL before substituting (C7). Servers that use an input there can't follow this rule.
Context
VS Code mcp.json |
Copilot .mcp.json / mcp-config.json |
|
|---|---|---|
| Inputs | promptString (with password), pickString, command |
None |
| Variables | ${input:}, ${command:}, ${env:}, ${config:}, ${workspaceFolder}, ${userHome}, ${/}, ${cwd}, ${execPath}, … |
$VAR, ${VAR}, ${VAR:-default}, ${secret:id} |
| Positions | command, args, env keys and values, cwd, envFile, url, header names and values, oauth.clientId, sandbox |
command, args, cwd, env values, url, header values |
| Unset variable | ${input:} prompts; unset ${env:} becomes empty |
Stays literal, with no warning |
| Secrets | Encrypted SecretStorage | ${secret:} (no host API to write it), OAuth |
Harness compatibility (VS Code agent host)
Only Copilot, Claude and Codex running in VS Code's agent host are in scope.
| Copilot | Claude | Codex | |
|---|---|---|---|
.vscode/mcp.json / user mcp.json servers |
✅ Via a generated plugin (below) | ✅ Via a generated plugin | ✅ Via a generated plugin |
Workspace .mcp.json |
✅ The runtime reads it | ✅ Primary folder: Claude reads it itself. Other folders: VS Code passes them | ✅ VS Code reads it and passes it |
| User-level config | ✅ ~/.copilot/mcp-config.json |
✅ Claude's own ~/.claude.json |
✅ Codex's own ~/.codex/config.toml |
| Servers added with MCP: Add Server for a session | ✅ | ❌ | ✅ |
${NAME} / ${NAME:-default} expanded |
✅ | ✅ Primary-folder .mcp.json, by Claude's own rules. ❓ Servers VS Code passes (E9) |
❌ Passed through unexpanded (E8) |
cwd |
✅ | .mcp.json loading doesn't document cwd |
✅ |
- VS Code forwards its MCP servers to all three harnesses by writing them into the
.mcp.jsonof a generated Open Plugin that it syncs to the session (collectNonPluginMcpServers→SyncedCustomizationBundler). This is where inputs break today:.vscode/mcp.json: variables that don't need the user (${env:},${workspaceFolder},${userHome},${config:}, …) are resolved before forwarding. Servers that use${input:}or${command:}are not forwarded at all (RequiresUserInteraction).- User
mcp.json: servers are forwarded without resolving any variables, so a${input:}reaches the harness as literal text. The server is still flaggedunsupported. - Forwarding drops sandbox,
oauthclient config and dev mode. It passesenvFileandcwdthrough but flags them;envFileis then ignored by all three harnesses. - URL bug: forwarding rebuilds the URL with
URI.toString(), which percent-encodes it. Query separators get encoded (?a=1&b=two→?a%3D1%26b%3Dtwo), and a${input:}inside a URL is encoded before the check runs, so it isn't detected and the server is forwarded with a broken URL instead of being skipped (E11).
- Copilot needs no changes for the Decision, except URL ports and defaulted URL hosts (C7). Every other rewrite lands in a field it already substitutes.
- Claude (primary-folder
.mcp.json) reads credential variable names such asANTHROPIC_API_KEY,NPM_TOKENandHTTPS_PROXYas empty in a remote server'surlandheaders, even when they're set, and ignores their default. This affects naming (D1).
All cases
Checked by running the repo's code at main 3fd165bbb0d (2026-10-13), one server per case. Becomes is what the migrator writes to .mcp.json or mcp-config.json. Problem is why a case is
Legend: ✅ migrated · .vscode/mcp.json or mcp.json)
| ID | Case | Status | Becomes | Problem |
|---|---|---|---|---|
| A1 | promptString, non-secret, default accepted |
Local server: ${REGION}, plus "REGION": "us-east-1" in its env. Remote server: ${REGION:-us-east-1} |
Local servers in VS Code's own chat: ${REGION} in command or args stays as literal text, because VS Code doesn't read the env value. Copilot fills it in |
|
| A2 | promptString, non-secret, per-user (no default) |
Like A1, with "LOG_LEVEL": "". Remote server: ${LOG_LEVEL} |
Same as A1. The user has to fill in the empty value | |
| A3 | promptString with password: true |
❌ | Not migrated | Passwords aren't migrated (unsupportedInputType) |
| A4 | pickString with string options |
Like A1, with the default option | Same as A1. A default that isn't one of the options isn't migrated (unsupportedInputDefault) |
|
| A5 | pickString with {label, value} options |
Like A4, with the option's value |
Same as A1 | |
| A6 | command input (computed value) |
❌ | Not migrated | Command inputs aren't migrated (unsupportedInputType) |
| A7 | command input that returns a token |
❌ | Not migrated | Same as A6 |
| B1 | ${env:FOO} |
✅ | ${FOO} |
In a URL: see C7 |
| B2 | ${command:id} |
❌ | Not migrated | unsupportedVariable |
| B3 | ${config:x} |
Local server: ${MCP_COMMAND}, plus "MCP_COMMAND": "<current value>" in its env. Remote server: ${MCP_COMMAND:-<current value>} (#341349) |
The value is fixed at migration time. Workspace servers get an empty value if it only comes from user settings. Same command/args limitation as A1 |
|
| B4 | ${workspaceFolder} |
The folder's absolute path, such as /Users/me/project/server.js |
Breaks on teammates' machines. In user mcp.json: not migrated (unsupportedVariable) |
|
| B5 | ${workspaceFolderBasename} |
✅ | The folder name | In user mcp.json: not migrated (unsupportedVariable) |
| B6 | ${userHome} |
❌ | Not migrated | unsupportedVariable |
| B7 | ${pathSeparator} / ${/} |
The separator of the OS that migrates: /, or \ on Windows |
A \ breaks on macOS and Linux. In user mcp.json: not migrated unless the server also uses an input (unrepresentableConfiguration) |
|
| B8 | ${cwd} |
The folder's absolute path, like B4 | Same as B4 | |
| B9 | ${execPath}, ${extensionInstallFolder:}, editor-file vars (${file}, …) |
❌ | Not migrated | unsupportedVariable |
| C1 | stdio command |
✅ | ${env:FOO} → ${FOO} |
Inputs: see A1 |
| C2 | args (whole value or substring) |
✅ | Like C1 | Inputs: see A1 |
| C3 | env value |
✅ | Like C1 | |
| C4 | env key (dynamic name) |
❌ | Not migrated | Names can't contain variables (environmentVariableInName) |
| C5 | cwd |
❌ | Not migrated | Any server with cwd (unrepresentableConfiguration) |
| C6 | envFile |
❌ | Not migrated | unrepresentableConfiguration |
| C7 | url host, port, path or query |
The URL, unchanged | Only plain URLs migrate. A query string (?key=abc), an uppercase host or a variable keeps the server in VS Code until E11. A variable in the port never migrates |
|
| C8 | Header value | ✅ | ${FOO}, or ${NAME:-default} for an input with a default |
|
| C9 | Header name | ❌ | Not migrated | Names can't contain variables (environmentVariableInName) |
| C10 | oauth.clientId |
"oauthClientId": "<id>" (#341352) |
The user may need to sign in again. Not migrated: enterpriseManaged: true (enterpriseManagedOAuth), or a client secret stored with Set Client Secret (oauthClientSecret) |
|
| C11 | Root sandbox strings |
❌ | Not migrated | The root sandbox stays behind. sandboxEnabled is dropped from migrated servers, with a warning |
| D1 | Same input id shared by several servers | ✅ | One variable for all of them | Two ids that make the same name (api-key, api_key) aren't migrated (variableNameCollision) |
| D2 | Cached answers and stored secrets | ✅ | Nothing: saved values are never copied | |
| D3 | Mixed file (some servers migratable, some not) | ✅ | The migratable servers move. Input declarations nothing uses anymore are removed | |
| D4 | Scope: workspace vs user file | ✅ | .mcp.json for workspace, mcp-config.json for user |
The user file is only offered from a Copilot session |
How it was checked: a probe test sends each server through the agent-host projection (assessMcpServersForCopilotAgentHost) and the migrator (McpServerCustomizationMigrator), then loads the result the way VS Code's own chat does (expandEnvironmentVariablesInLaunch). Copilot's side is from its source, not run. The probe ran on macOS, so the Windows \ in B7 comes from the resolver code.
Tasks
A. Input types
All of these follow the Decision rule. What each case loses is listed so it can go into the migration message and docs.
- A1 default-accepted
promptString
Recommended:${NAME:-<default>}. Behavior stays the same when the variable is unset.
Done (Migrate MCP servers that use inputs to environment variables #341224): local servers get${NAME}plus anenventry set to the default; remote servers get${NAME:-<default>}. - A2 per-user
promptString(no default)
Recommended:${NAME}. The user sets the variable instead of answering a prompt.
Done (Migrate MCP servers that use inputs to environment variables #341224):${NAME}, plus an emptyenventry on local servers. - A3
passwordprompt
Recommended:${NAME}, never with a default. The stored secret isn't exported.
Options: if the server supports OAuth, suggest removing the header instead. Later,${secret:id}once a write API exists (E4).
Migrate MCP servers that use inputs to environment variables #341224: not migrated (unsupportedInputType); the server stays in VS Code. - A4
pickStringwith string options
Recommended:${NAME:-<default>}. The picker is lost, so the migration message lists the allowed values.
Done (Migrate MCP servers that use inputs to environment variables #341224): same as A1. A default that isn't one of the options is excluded (unsupportedInputDefault), since VS Code never uses it. The allowed values aren't listed yet. - A5
pickStringwith{label, value}options
Recommended: same as A4, usingvalue. Labels are lost.
Done (Migrate MCP servers that use inputs to environment variables #341224): same as A4, usingvalue. - A6
commandinput (computed value)
Recommended:${NAME}. The command no longer runs, so the user must supply the value it used to compute. The migration message names the original command so the user knows where the value came from. - A7
commandinput that returns a token
Recommended:${NAME}, the same as A6.
Options: if the server supports it, suggest OAuth or the server's own auth (gh auth,az login) instead.
Migrate MCP servers that use inputs to environment variables #341224: A6 and A7 are not migrated (unsupportedInputType); the server stays in VS Code.
B. Inline variables
- B1
${env:FOO}(done: mcp: migrate ${env:NAME} servers as ${NAME} references #340381)
Implemented: rewritten to${FOO}, never the variable's current value, in stdiocommand,argsandenvvalues and in URL and header values. Copilot expands it, and so does VS Code's local harness (E2).
Still excluded (the server stays in VS Code, with a reason):${env:}in an env or header name (C4, C9);- a name that isn't
[A-Za-z_][A-Za-z0-9_]*, such as${env:ProgramFiles(x86)}or${env:my-var}; - a rewritten value over 1000 characters;
- a URL that no longer parses after the rewrite: a variable port, scheme or whole URL (C7);
${env:}mixed with a non-portable variable (${input:},${config:},${userHome}, …), or incwd;- a variable whose value itself contains
${...}.
Behavior change: VS Code resolves an unset${env:FOO}to"", but the migrated${FOO}stays as literal text (E3).
Blocked: servers with${env:}in the URL stay excluded in practice until E11 is fixed. Header values aren't affected.
- B2
${command:id}
Recommended: keep in VS Code (same as A6).
Migrate MCP servers that use inputs to environment variables #341224: excluded withunsupportedVariable, also when the server uses inputs. - B3
${config:x}
Done (chat: Migrate MCP servers that use settings to environment variables #341349): migrated to an environment variable named after the setting key (mcp.command→MCP_COMMAND), set to the setting's current value: inenvfor local servers, as${NAME:-value}for remote servers. For workspace servers, only values from workspace or folder settings are written; values from user settings (possibly private) and unset, structured or boolean settings become an empty variable. A changed value between planning and writing fails withSourceChanged. The Migrations view warns that later changes to the setting won't apply. - B4
${workspaceFolder}
Recommended: relative path, or omitcwd. Today the migrator writes every${workspaceFolder}as an absolute path.
Open: Copilot'scwddefaults to the session directory. Confirm that relativeargsresolve correctly. - B5
${workspaceFolderBasename}
Recommended: literal at migration time. - B6
${userHome}
Recommended:${HOME}, or~incwd.
Options:${USERPROFILE}on Windows, or an absolute literal in the user config only. - B7
${pathSeparator}/${/}
Recommended:/. - B8
${cwd}
Recommended: drop it or use a literal.
Open: is it used in practice? (E1) - B9
${execPath},${extensionInstallFolder:}, editor-file vars
Recommended: keep in VS Code. These values don't make sense outside VS Code.
C. Positions
- C1 stdio
command
Recommended:${VAR}works, but prefer a literal. - C2
args
Recommended:${VAR}. Suggest moving secrets fromargstoenv. - C3
envvalue
Recommended:${VAR}. - C4
envkey
Exception to the Decision: Copilot doesn't substitute variables in env names.
Recommended: keep the server in VS Code.
Options: write the saved answer in as a literal, if there is one. - C5
cwd
Recommended: relative path,${VAR}or~.
Note: in Claude sessions, a server VS Code passes is skipped when itscwdisn't the primary workspace folder, and Claude's own.mcp.jsonloading doesn't documentcwd(see E9). - C6
envFile
Recommended: expand into explicitenventries that reference${VAR}.
Options:npx dotenv -e .env --wrapper, or keep in VS Code. - C7
url
Recommended:${VAR}only in the host (no default), path or query. Copilot validates the raw URL before expanding variables and rejects the server if the port is a variable (http://localhost:${PORT}/mcp), the whole URL is one (${BASE}/mcp), or the host uses a default (https://${HOST:-x}/mcp).
Options: for a port or defaulted host, keep the server in VS Code or write the saved answer as a literal.
Local harness: mcp: don't expand .mcp.json URLs that the Copilot runtime rejects #340379 makes VS Code leave these URLs unexpanded too, instead of expanding a URL Copilot would reject. The migrator excludes them (B1). - C8 header value
Recommended: OAuth forAuthorization, else${VAR}. - C9 header name
Exception to the Decision: Copilot doesn't substitute variables in header names.
Recommended: keep the server in VS Code.
Options: write the saved answer in as a literal, if there is one. - C10
oauth.clientId
Done (Migrate MCP servers that use OAuth #341352):oauth.clientIdis written asoauthClientId; sign-in tokens aren't migrated (VS Code's chat and Copilot sessions in VS Code share VS Code's authentication providers; the standalone Copilot CLI signs in once). VS Code's own chat now readsoauthClientIdfrom.mcp.json/mcp-config.json. The Migrations view warns that the user may need to sign in again.
Still excluded:enterpriseManaged: true(relies on a VS Code setting Copilot doesn't have), and servers with a client secret stored in VS Code (Copilot can't read VS Code's secret storage and its config has no secret field).
Follow-up option: have VS Code supply its stored secret when Copilot asks it to sign in (agentHostAuth.ts), so those servers can migrate too. - C11 root
sandboxstrings
Recommended: literal; handle together with the sandbox migration.
D. Behaviors
- D1 shared input id
Recommended: the same id gives the same variable name, so sharing works as before. Detect collisions when two ids map to the same name.
Open: should names get a prefix (for exampleMCP_) so they can't clash withPATH,HOMEorGITHUB_TOKEN? A prefix also avoids the credential names Claude reads as empty in remoteurl/headers.
Done (Migrate MCP servers that use inputs to environment variables #341224): shared ids share a variable. Only reserved names and names starting with a digit getMCP_. Two ids that map to the same name in a file, or an input whose name matches an${env:}in the file, are excluded (variableNameCollision). - D2 cached answers and stored secrets
Recommended: don't migrate any values. Secrets are never exported, and the user sets each variable (E7).
Done (Migrate MCP servers that use inputs to environment variables #341224): no values are migrated. - D3 mixed file
Recommended: migrate eligible servers and keep anyinputsthat are still referenced (current behavior).
Done (Migrate MCP servers that use inputs to environment variables #341224): declarations still referenced anywhere in the file are kept; others used only by migrated servers are removed. - D4 scope
Recommended: both the workspace.mcp.jsonand the usermcp-config.jsonget${NAME}references only, with no values.
Done (Migrate MCP servers that use inputs to environment variables #341224): both scopes. Local servers also getenventries holding the input's default (or empty), not a saved value.
E. Cross-cutting and dependencies
- E1 Telemetry: count variable kinds, input types (including
passwordcount), positions and scope in_replaceVariablesInLaunch, with no values. Add a migrator event with skipped-server counts and reasons. - E2 Expand variables in
.mcp.jsonand the Copilot user config in VS Code's local harness.
Status: workspace.mcp.jsondone in mcp: expand ${VAR} in workspace .mcp.json servers in the local harness #340369 (merged); Copilot user config in mcp: migrate ${env:NAME} servers as ${NAME} references #340381. The resolver is a port of the runtime'senv_var_resolution.rs, with its tests, and runs in the extension host that starts or connects to the server.
Differs from the Copilot runtime:- bare
$VARisn't expanded; cwdisn't expanded (the migrator skips servers that set it);commandandargsare resolved against the host environment, not the server's ownenvblock, matching how${env:}behaved before migration;- runtime-only handling isn't ported: the blocked-variable filter,
GITHUB_TOKENandGIT_CONFIG_*injection, OIDC tokens,${secret:}.
- bare
- E3 Add a diagnostic for unset variables at server start.
- E4 Runtime dependency: an API to write
${secret:}values (Copilot runtime). Today the only writer is the catalog install flow, which stores header secrets for remote servers picked from the catalog; it can't be used for arbitrary migrated servers. - E5 Confirm scope rules for
${secret:}in workspace.mcp.json(Copilot runtime). - E6 Track SEP-2633 (
${env:VAR}, pipe fallbacks,${input:}). The migrator writes${NAME}for now and should switch if Copilot adopts the SEP syntax. - E7 After migrating, show the variables the user needs to set: name, which servers use it, whether it's a secret, its default, and its allowed values (for picks) or original command.
Partly (Migrate MCP servers that use inputs to environment variables #341224): the migration page warns that inputs become environment variables to configure after migrating, and local servers get anenventry per variable. The variables aren't listed yet. - E8 Codex sessions: expand
${VAR}/${VAR:-default}in.mcp.jsonservers before passing them to Codex.toCodexMcpServerJsoncurrently passes them through unexpanded, and Codex's source (openai/codex) usesenvand header values literally. Not yet run against the Codex version VS Code bundles.
Recommended: expand in the agent host, which has the environment, so every field behaves as it does in Copilot.
Options: map to Codex's own fields (env_varsfor a variable passed through,bearer_token_env_var/env_http_headersfor headers). That can't express substrings (--region=${REGION}, URLs) or defaults. - E9 Claude sessions: the servers VS Code forwards (from
.vscode/mcp.jsonand usermcp.json) and.mcp.jsonservers from non-primary folders are passed viaOptions.mcpServers(the CLI's--mcp-config) without expanding variables (toClaudeMcpServers). Claude documents${VAR}expansion only for.mcp.jsonand~/.claude.json, so it isn't known whether it expands these. Stdio servers among them are skipped unless their working directory is the primary folder. Third-party plugins aren't affected; Claude loads their.mcp.jsonitself.
Recommended: check whether Claude expands them. If it doesn't, expand in the agent host, the same as E8. Don't touch primary-folder.mcp.jsonservers, which Claude loads itself.
Open: should the agent host support acwdother than the primary folder (for example with a wrapper), or report these servers as skipped? - E10 Forwarding path (generated plugin): make input handling consistent and decide whether forwarding can keep inputs working without a migration.
Recommended: stop forwarding usermcp.jsonservers that still contain unresolved variables, or resolve their variables first, so they match.vscode/mcp.json.
Options: resolve${input:}from VS Code's saved answers (prompting if needed) at forward time. Inputs would then keep working in all three harnesses without rewriting the user's config. Secrets would pass through the plugin.mcp.jsonsent to the agent host. - E11 Forwarding URL encoding:
projectMcpServerConfigurationbuildsurlfromlaunch.uri.toString(), which encodes query separators and hides${input:}in URLs from the check.
Recommended: forward the URL string as written in the config and run the variable check on that.
Also blocks B1: because the forwarded URL is percent-encoded, a URL with${env:}never matches the source, so mcp: migrate ${env:NAME} servers as ${NAME} references #340381 excludes it.
Details for investigation
Code pointers
- Migrator:
src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.ts - Variable resolution:
_replaceVariablesInLaunchinsrc/vs/workbench/contrib/mcp/common/mcpRegistry.ts - No
variableReplacementset for portable files:workspaceDotMcpDiscovery.ts,nativeMcpDiscoveryAdapters.ts - Existing
${VAR}→${env:VAR}rewrite for plugins:convertBareEnvVarsToVsCodeSyntaxinsrc/vs/platform/agentPlugins/common/pluginParsers.ts - Local harness expansion (mcp: expand ${VAR} in workspace .mcp.json servers in the local harness #340369): resolver in
src/vs/platform/mcp/common/envVarResolution.ts; field mapping insrc/vs/workbench/contrib/mcp/common/mcpEnvironmentVariableExpansion.ts; requested byMcpRegistry.resolveConnectionthrough the$expandEnvironmentVariablesRPC - Codex session MCP servers:
_buildSessionMcpServersinsrc/vs/platform/agentHost/node/codex/codexAgent.ts;.mcp.jsonread bysrc/vs/platform/agentHost/node/shared/sessionMcpDiscovery.ts; converted bytoCodexMcpServerJsonincodexMcpServers.ts - Forwarding VS Code MCP servers to harnesses:
resolveMcpServerForAgentHostDelivery/resolveMcpConfigurationForSyncinsrc/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.ts;projectMcpServerConfiguration(same file);collectNonPluginMcpServersinagentHostLocalCustomizations.ts; generated plugin.mcp.jsoninsyncedCustomizationBundler.ts - User-level migration target (
mcp-config.json) is only used for Copilot sessions:agentHostMcpServerMigrationProvider.ts - Claude session MCP servers:
_buildExternalMcpServersinsrc/vs/platform/agentHost/node/claude/claudeAgentSession.ts(primary-folder.mcp.jsonleft to the SDK viasettingSources: ['user', 'project', 'local']inclaudeSdkOptions.ts; the rest converted bytoClaudeMcpServers, which skips acwdthat isn't the primary folder)
Copilot runtime behavior (from source)
- An unset
${VAR}with no default stays literal, with no warning. :-defaultapplies only when the variable is unset, not when it's empty.- Strings longer than 1000 characters skip expansion.
- No
inputs, noenvFile, no header-name substitution.
Telemetry today
- Only
mcp/serverInstall.hasInputs(gallery installs) mentions inputs.agents/customizationsDefinedcounts MCP servers per session by source, without variable or input details. - The migrator emits nothing when it skips a server.
Claude and Codex docs (retrieved 2026-10-06)
- Claude's own
.mcp.jsonrules, which apply to the primary folder in Claude sessions: https://code.claude.com/docs/en/mcp (variable expansion, unset variables, credential variables that read as empty) - Codex config fields, for E8's alternative: https://developers.openai.com/codex/config-reference (
env_vars,env_http_headers,bearer_token_env_var)
Standards
- MCP SEP-2633 (SEP-2633: Standard Client-Side Configuration Format - mcp.json modelcontextprotocol/modelcontextprotocol#2633) is an open draft. It proposes
${env:VAR},${value:x},${input:name}and${op://...}with pipe fallbacks, nestedoauth, and nocwd/envFile. Its syntax differs from Copilot's and Claude's${VAR}.
Verification (2026-10-06)
Checked against source: microsoft/vscode 3dabe9b5512, Copilot runtime 202e777b6c, copilot-sdk 0d5cc56c, openai/codex main. The Copilot URL rules were confirmed by running the runtime's url crate (2.5.8). The forwarding URL encoding was confirmed by running VS Code's compiled URI and resolver.
Not verifiable here (no Claude or Codex binary available, nothing run end to end):
- Whether Claude expands
${VAR}in servers passed via--mcp-config(E9). - Whether Claude starts primary-folder
.mcp.jsonservers in SDK sessions without an approval step. - Codex behavior in the version VS Code bundles (checked against upstream source only), and Codex merging with
~/.codex/config.toml(from a code comment). - Claude's credential names that read as empty (documentation only).
- End-to-end delivery of forwarded servers in all three harnesses (code trace only).
Test fixture: a local fixture covering every case above exists but isn't public yet.
Activity
mcp: never forward Copilot-home MCP servers to other agents or hosts
mcp: expand ${VAR} in workspace .mcp.json servers in the local harness
mcp: expand ${VAR} in workspace .mcp.json servers in the local harness (
mcp: address review feedback on ${env:} migration
mcp: migrate ${env:NAME} servers as ${NAME} references (#340381)
mcp: migrate ${env:NAME} servers as ${NAME} references
mcp: don't expand .mcp.json URLs that the Copilot runtime rejects (#3…
mcp: don't expand .mcp.json URLs that the Copilot runtime rejects
mcp: leave workspace .mcp.json "local" parsing to #340034
mcp: discover Copilot CLI user MCP config by default without forwardi…
7 remaining items
Use a single warning for MCP servers that use configs
mcp: Use neutral placeholders for environment variables in the server…
chat: Migrate MCP servers that use settings to environment variables (#…
Migrate MCP servers that use settings to environment variables
Migrate settings without a usable value to empty environment variables
Call settings "configs" in the MCP migration warning
Write remote MCP setting values as is
Migrate unnamed MCP setting references to an empty variable
Keep user MCP server projections independent of setting resolution
Only write workspace setting values into a workspace's MCP configuration
Migrate MCP servers that use OAuth (#340161)
Migrate MCP servers that use OAuth (#341352)