Skip to content

Support migrating MCP inputs and ${...} variables to portable .mcp.json / Copilot mcp-config.json #340161

Closed

Description

Related: #337311, #332782

Problem

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 with MCP_ 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, …).

  • env entry: a local server declares each variable in its env, 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 env entry (or the environment Copilot starts in) Only the environment VS Code starts in, not the server's env entry, so ${NAME} stays as literal text unless it's set there
    Other env values ("KEY": "${API_KEY}") Only the environment Copilot starts in, not the sibling env entry Only the environment VS Code starts in
    URL, headers (remote) The environment Copilot starts in The environment VS Code starts in

    An env entry that only referenced the input ("MODE": "${input:mode}") is replaced by the value itself, so it works in both.

  • inputs block: a declaration is removed once nothing left in the file references it (other servers, root sandbox, …). Unreferenced declarations that were already there are kept.

  • Saved values are not migrated (D2).

  • Revalidated before writing: if an input's type, password flag or options change after planning, the server fails with SourceChanged. 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 $VAR is not expanded in VS Code (unlike the Copilot runtime), so a hand-written $VAR copied from .vscode/mcp.json keeps 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 id in 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).
  • inputs block: remove an input once no remaining server references it.
  • Exceptions: Copilot doesn't substitute variables in an env name (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 ✅ ⚠️ A stdio server VS Code passes is skipped unless its working directory is the primary folder, so every stdio server from a non-primary folder is skipped. Claude's own .mcp.json loading doesn't document cwd ✅
  • VS Code forwards its MCP servers to all three harnesses by writing them into the .mcp.json of 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 flagged unsupported.
    • Forwarding drops sandbox, oauth client config and dev mode. It passes envFile and cwd through but flags them; envFile is 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 as ANTHROPIC_API_KEY, NPM_TOKEN and HTTPS_PROXY as empty in a remote server's url and headers, 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 ⚠️ or ❌.

Legend: ✅ migrated · ⚠️ migrated, but with a problem · ❌ not migrated (the server stays in .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.

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 stdio command, args and env values 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 in cwd;
    • 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 with unsupportedVariable, 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: in env for 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 with SourceChanged. The Migrations view warns that later changes to the setting won't apply.
  • B4 ${workspaceFolder}
    Recommended: relative path, or omit cwd. Today the migrator writes every ${workspaceFolder} as an absolute path.
    Open: Copilot's cwd defaults to the session directory. Confirm that relative args resolve correctly.
  • B5 ${workspaceFolderBasename}
    Recommended: literal at migration time.
  • B6 ${userHome}
    Recommended: ${HOME}, or ~ in cwd.
    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 from args to env.
  • C3 env value
    Recommended: ${VAR}.
  • C4 env key
    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 its cwd isn't the primary workspace folder, and Claude's own .mcp.json loading doesn't document cwd (see E9).
  • C6 envFile
    Recommended: expand into explicit env entries 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 for Authorization, 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.clientId is written as oauthClientId; 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 reads oauthClientId from .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 sandbox strings
    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 example MCP_) so they can't clash with PATH, HOME or GITHUB_TOKEN? A prefix also avoids the credential names Claude reads as empty in remote url/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 get MCP_. 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 any inputs that 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.json and the user mcp-config.json get ${NAME} references only, with no values.
    Done (Migrate MCP servers that use inputs to environment variables #341224): both scopes. Local servers also get env entries holding the input's default (or empty), not a saved value.

E. Cross-cutting and dependencies

  • E1 Telemetry: count variable kinds, input types (including password count), positions and scope in _replaceVariablesInLaunch, with no values. Add a migrator event with skipped-server counts and reasons.
  • E2 Expand variables in .mcp.json and the Copilot user config in VS Code's local harness.
    Status: workspace .mcp.json done 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's env_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 $VAR isn't expanded;
    • cwd isn't expanded (the migrator skips servers that set it);
    • command and args are resolved against the host environment, not the server's own env block, matching how ${env:} behaved before migration;
    • runtime-only handling isn't ported: the blocked-variable filter, GITHUB_TOKEN and GIT_CONFIG_* injection, OIDC tokens, ${secret:}.
  • 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 an env entry per variable. The variables aren't listed yet.
  • E8 Codex sessions: expand ${VAR} / ${VAR:-default} in .mcp.json servers before passing them to Codex. toCodexMcpServerJson currently passes them through unexpanded, and Codex's source (openai/codex) uses env and 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_vars for a variable passed through, bearer_token_env_var / env_http_headers for headers). That can't express substrings (--region=${REGION}, URLs) or defaults.
  • E9 Claude sessions: the servers VS Code forwards (from .vscode/mcp.json and user mcp.json) and .mcp.json servers from non-primary folders are passed via Options.mcpServers (the CLI's --mcp-config) without expanding variables (toClaudeMcpServers). Claude documents ${VAR} expansion only for .mcp.json and ~/.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.json itself.
    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.json servers, which Claude loads itself.
    Open: should the agent host support a cwd other 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 user mcp.json servers 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.json sent to the agent host.
  • E11 Forwarding URL encoding: projectMcpServerConfiguration builds url from launch.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: _replaceVariablesInLaunch in src/vs/workbench/contrib/mcp/common/mcpRegistry.ts
  • No variableReplacement set for portable files: workspaceDotMcpDiscovery.ts, nativeMcpDiscoveryAdapters.ts
  • Existing ${VAR} → ${env:VAR} rewrite for plugins: convertBareEnvVarsToVsCodeSyntax in src/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 in src/vs/workbench/contrib/mcp/common/mcpEnvironmentVariableExpansion.ts; requested by McpRegistry.resolveConnection through the $expandEnvironmentVariables RPC
  • Codex session MCP servers: _buildSessionMcpServers in src/vs/platform/agentHost/node/codex/codexAgent.ts; .mcp.json read by src/vs/platform/agentHost/node/shared/sessionMcpDiscovery.ts; converted by toCodexMcpServerJson in codexMcpServers.ts
  • Forwarding VS Code MCP servers to harnesses: resolveMcpServerForAgentHostDelivery / resolveMcpConfigurationForSync in src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.ts; projectMcpServerConfiguration (same file); collectNonPluginMcpServers in agentHostLocalCustomizations.ts; generated plugin .mcp.json in syncedCustomizationBundler.ts
  • User-level migration target (mcp-config.json) is only used for Copilot sessions: agentHostMcpServerMigrationProvider.ts
  • Claude session MCP servers: _buildExternalMcpServers in src/vs/platform/agentHost/node/claude/claudeAgentSession.ts (primary-folder .mcp.json left to the SDK via settingSources: ['user', 'project', 'local'] in claudeSdkOptions.ts; the rest converted by toClaudeMcpServers, which skips a cwd that isn't the primary folder)

Copilot runtime behavior (from source)

  • An unset ${VAR} with no default stays literal, with no warning.
  • :-default applies only when the variable is unset, not when it's empty.
  • Strings longer than 1000 characters skip expansion.
  • No inputs, no envFile, no header-name substitution.

Telemetry today

  • Only mcp/serverInstall.hasInputs (gallery installs) mentions inputs. agents/customizationsDefined counts 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)

Standards

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.json servers 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

  1. added
    plan-item
    and removed
    plan-item
    on Oct 6, 2026
  2. 7 remaining items

  3. added this to the 1.144.0 milestone on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions