Skip to content

v1.0.24 broke GitHub MCP for users that provide their own --mcp-config in claude_args #745

@awittzb

Description

@awittzb

Describe the bug

When using v1.0.24 with the Agent SDK path (now the default per #738), multiple --mcp-config flags in claude_args are not properly merged. Only the last --mcp-config value is kept, causing the action's built-in MCP servers (like github_comment) to be lost when a user provides any MCP servers themselves with --mcp-config.

This results in errors like:

Error: No such tool available: mcp__github_comment__update_claude_comment

Root Cause

In base-action/src/parse-sdk-options.ts, the parseClaudeArgsToExtraArgs function overwrites previous --mcp-config values instead of merging them:

// Line 37-42 in parse-sdk-options.ts
if (nextArg && !nextArg.startsWith("--")) {
  // For accumulating flags, join multiple values with commas
  if (ACCUMULATING_FLAGS.has(flag) && result[flag]) {
    result[flag] = `${result[flag]},${nextArg}`;
  } else {
    result[flag] = nextArg;  // <-- BUG: Overwrites previous mcp-config!
  }
}

The ACCUMULATING_FLAGS set only contains allowedTools and disallowedTools (added in PR #719), but not mcp-config.

To Reproduce

  1. Use [email protected] (or any version where Agent SDK is default)
  2. Configure a workflow with user-provided --mcp-config in claude_args:
    claude_args: |
      --mcp-config /tmp/my-mcp-config.json
  3. The action internally prepends its own --mcp-config with github_comment, github_ci, etc.
  4. The SDK path parses claude_args and only keeps the last --mcp-config
  5. Claude tries to use mcp__github_comment__update_claude_comment but the MCP server was never registered
  6. Error: No such tool available: mcp__github_comment__update_claude_comment

Expected behavior

Multiple --mcp-config flags should be merged by combining their mcpServers objects, similar to how --allowedTools flags are accumulated. The CLI path handles this correctly by passing all flags through to the claude CLI.

Evidence from Job Logs

INPUT_CLAUDE_ARGS contains TWO --mcp-config flags:

--mcp-config '{"mcpServers": {"github_comment": {...}}}' ... --mcp-config /tmp/claude-mcp-config.json

But SDK options only shows ONE:

"extraArgs": {
  "mcp-config": "/tmp/claude-mcp-config.json"
}

The action's github_comment MCP server config is lost.

Workaround

1️⃣ Don't use agent SDK

Set USE_AGENT_SDK=false to force the CLI path:

- name: Run Claude Code
  uses: anthropics/claude-code-action@v1
  env:
    USE_AGENT_SDK: "false"
  with:
    # ... inputs

or

2️⃣ Pin the action to v1.0.23:

- name: Run Claude Code
  uses: anthropics/[email protected]
  with:
    # ... inputs

Any workflow using custom MCP servers via claude_args with --mcp-config is affected.

API Provider

  • Anthropic First-Party API (default)
  • AWS Bedrock (likely affected)
  • GCP Vertex (likely affected)

Additional context

Proposed Fix

Merge multiple --mcp-config values by combining their mcpServers objects:

// Add special handling for mcp-config in parseClaudeArgsToExtraArgs or parseSdkOptions
function mergeMcpConfigs(configs: string[]): string {
  const merged = { mcpServers: {} };
  for (const config of configs) {
    const parsed = JSON.parse(config);
    Object.assign(merged.mcpServers, parsed.mcpServers || {});
  }
  return JSON.stringify(merged);
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmcpp1Showstopper bug preventing substantial subset of users from using the product, or incorrect docs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions