Skip to content

[BUG] VS Code MCP install drops Docker runtimeArguments from registry manifests using v0.1 variables #1391

@fassmus

Description

@fassmus

Summary

When installing a Docker-based MCP server from an MCP registry into VS Code, APM generates an incomplete .vscode/mcp.json.

The registry manifest contains Docker runtimeArguments, including a required workspace mount argument using the MCP registry v0.1 variables shape. During install, APM drops those arguments and writes only the fallback Docker command, so the final MCP server configuration is missing required parameters.

This appears to be an APM issue in the VS Code adapter, not a registry issue.

Environment

  • APM: 0.14.0 (9d1161b)
  • VS Code: 1.120.0
  • macOS: 14.7.3 (23H417)

Reproduction

  1. Install an MCP server from a registry whose package uses:
    • runtimeHint: "docker"
    • transport.type: "stdio"
    • runtimeArguments with v0.1 variables
  2. Let APM write the VS Code workspace config.
  3. Open .vscode/mcp.json.

Example registry response

{
  "server": {
    "name": "com.example/playwright-mcp",
    "version": "1.2.3",
    "packages": [
      {
        "registryType": "oci",
        "identifier": "ghcr.io/example/playwright-mcp:1.2.3",
        "runtimeHint": "docker",
        "transport": {
          "type": "stdio"
        },
        "runtimeArguments": [
          {
            "value": "-v",
            "type": "positional"
          },
          {
            "value": "{workdir}:/workspace",
            "variables": {
              "workdir": {
                "description": "Working directory to mount into the container.",
                "isRequired": true,
                "format": "filepath",
                "placeholder": "/path/to/project"
              }
            },
            "type": "positional"
          },
          {
            "value": "-w",
            "type": "positional"
          },
          {
            "value": "/workspace",
            "type": "positional"
          }
        ]
      }
    ]
  }
}

Actual result

APM writes something like:

{
  "servers": {
    "com.example/playwright-mcp": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/example/playwright-mcp:1.2.3"
      ]
    }
  },
  "inputs": []
}

The required mount and working-directory args are missing.

Expected result

APM should preserve the runtime arguments and translate the required variable into something usable by VS Code, for example:

{
  "servers": {
    "com.example/playwright-mcp": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "${workspaceFolder}:/workspace",
        "-w",
        "/workspace",
        "ghcr.io/example/playwright-mcp:1.2.3"
      ]
    }
  }
}

Or, if prompting is preferred, generate a matching inputs entry and reference it in the args.

Why this looks like an APM bug

From the code path:

  • The registry client normalizes runtimeArguments to runtime_arguments.
  • The install path threads runtime_vars through to adapters.
  • The VS Code adapter does not appear to consume runtime_vars.
  • VSCodeClientAdapter._extract_package_args() handles:
    • package_arguments[].value
    • legacy runtime_arguments[] entries with is_required + value_hint
  • It does not handle the MCP registry v0.1 runtimeArguments[].variables shape.

As a result, Docker packages using variable-based runtime arguments fall back to:

["run", "-i", "--rm", "<image>"]

Impact

This breaks Docker-based MCP servers that require workspace mounts or other runtime parameters from the manifest. The server may start, but it is misconfigured because required arguments are omitted.

Suggested fix

Support v0.1 runtimeArguments entries that contain variables, especially for the VS Code adapter:

  1. Parse runtimeArguments[].variables
  2. Resolve well-known workspace paths to ${workspaceFolder} where appropriate
  3. Otherwise generate inputs entries and substitute ${input:...}
  4. Add a regression test for Docker packages using runtimeArguments with variables

Additional note

There are already tests covering legacy runtime_arguments handling, but this looks like a gap for the newer MCP registry v0.1 variable-bearing argument format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions