Skip to content

[FEATURE] Support ${input:...} variable resolution for self-defined MCP server headers and env #342

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Is your feature request related to a problem? Please describe.

For registry-backed MCP servers, the VS Code adapter auto-generates ${input:...} variable definitions (promptString + password: true) from registry metadata. Users get prompted at runtime for secrets automatically.

For self-defined servers (registry: false), users can write ${input:...} references in headers or env, but APM does not generate the matching inputs entries in .vscode/mcp.json. VS Code cannot resolve them.

Example apm.yml:

dependencies:
  mcp:
    - name: my-server
      registry: false
      transport: http
      url: https://my-server.example.com/mcp/
      headers:
        Authorization: "Bearer ${input:my-server-token}"
        X-Project: "${input:my-server-project}"

Expected: APM detects ${input:<id>} patterns in headers and env values, then generates matching input variable definitions — same as registry-backed servers.

Actual: Strings are written verbatim. No inputs entries are created.

Describe the solution you'd like

During adapter config formatting, scan string values in headers and env for ${input:<id>} patterns. For each match:

  1. Extract the variable id (e.g., my-server-token).
  2. Generate an input variable definition:
    { "type": "promptString", "id": "my-server-token", "description": "my-server-token for MCP server my-server", "password": true }
  3. Append to the adapter's inputs array (dedup by id).

Scope

  • VS Code adapter — primary target (already has the inputs mechanism).
  • Copilot / Codex adapters — emit a warning that ${input:...} variables won't be resolved at runtime, since those runtimes don't support input prompts.

Affected Code

  • src/apm_cli/adapters/client/vscode.pyconfigure_mcp_server()
  • src/apm_cli/integration/mcp_integrator.py_build_self_defined_info()

Describe alternatives you've considered

Users can manually add inputs entries to .vscode/mcp.json after apm compile, but this is fragile since APM overwrites the file on each compile.

Another option is requiring users to set environment variables instead of using ${input:...}, but this removes the convenience of VS Code runtime prompts.

Additional context

The VS Code adapter already has the inputs generation mechanism for registry-backed servers (see vscode.py line ~276). This feature extends the same pattern to self-defined servers for parity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageNew issue, not yet reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions