Skip to content

MCP credentials are exposed in Claude child process argv via --mcp-config #1211

Description

@rickyxsosa

Description

CloudCLI loads user-scoped MCP server definitions from ~/.claude.json and passes the resulting object to the Claude Agent SDK as sdkOptions.mcpServers.

The SDK serializes that object into a --mcp-config <json> child-process argument. If an MCP server configuration contains credentials in its env or headers, those credentials become visible in ps and in /proc/<pid>/cmdline to other local users.

No credential values are included in this report.

Observed versions

  • CloudCLI: 1.37.2
  • @anthropic-ai/claude-agent-sdk: 0.3.241
  • Linux

Relevant code path

claude-runtime.provider.js calls loadMcpConfig(options.cwd) and assigns the result to sdkOptions.mcpServers. The same SDK options already set settingSources to ['project', 'user', 'local'], so the Claude process can load user/project MCP configuration from its normal configuration sources without receiving a JSON literal on argv.

The installed SDK's process transport converts a non-empty mcpServers option into --mcp-config followed by serialized JSON.

Expected behavior

Secrets used by MCP servers should not appear in process arguments. CloudCLI should either:

  1. Let Claude load MCP configuration from the enabled settings sources without populating sdkOptions.mcpServers, or
  2. Use a supported secure file/IPC mechanism if explicit SDK MCP injection is required.

An opt-out setting for explicit MCP injection would also provide a safe migration path.

Security impact

Any local account able to inspect the child process command line can read MCP credentials, even when the source configuration file is mode 0600. Process listings can also be copied into support logs or issue reports accidentally.

Suggested verification

Start a Claude chat with an MCP server whose configuration contains a sentinel environment variable. Confirm that the Claude child process has no inline --mcp-config JSON while the MCP tools remain available through normal settings-source discovery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions