Skip to content

Bundled CLI for linux/amd64 silently fails when MCP servers are configured #449

@vinod-memfold

Description

@vinod-memfold

Description

The bundled Claude CLI in the manylinux_2_17_x86_64 wheel silently exits when MCP servers are configured via ClaudeAgentOptions.mcp_servers.

Environment

  • claude-agent-sdk: 0.1.18
  • Platform: linux/amd64 (Cloud Run, Docker)
  • Python: 3.11

Behavior

  • Agent initializes successfully, MCP server shows status: connected
  • First SystemMessage(init) received with all tools registered
  • Agent immediately exits with tool_use_count: 0, text_output: ''
  • No error messages logged

Reproduction

options = ClaudeAgentOptions(
    mcp_servers={"my-server": {...}},  # Any MCP config
    # other options...
)
async with ClaudeSDKClient(options=options) as client:
    await client.query("hello")
    async for msg in client.receive_messages():
        print(msg)  # Only receives SystemMessage(init), then exits

Workaround

Use the npm-installed CLI instead of bundled:

options = ClaudeAgentOptions(
    cli_path="/usr/local/bin/claude",  # Force global CLI
    mcp_servers={...},
)

Notes

  • Works fine on macosx_11_0_arm64 (Mac ARM)
  • Works fine on linux/amd64 when mcp_servers=None
  • Only fails on linux/amd64 + MCP servers configured

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions