Skip to content

SDK Client freezes when using MCP server and enabling telemetry #375

@vicp5

Description

@vicp5

I've been working on a prototype and attempted to enable Open Telemetry without success. It seems the SDK Client freezes when receiving a response. Telemetry works fine and the client never freezes if no MCP server is provided in ClaudeAgentOptions.

I'm not sure if this is an issue directly with Claude Code CLI. I've used telemetry with Claude Code in the past but not recently.

Python Version: 3.12.8
Claude Agent SDK Version: 0.1.10
Claude Code CLI Version: 2.0.55

This can be easily replicated with the mcp_calculator.py example:

  • Run a basic Open Telemetry collector:
docker run \
  -p 127.0.0.1:4317:4317 \
  -p 127.0.0.1:4318:4318 \
  -p 127.0.0.1:55679:55679 \
  otel/opentelemetry-collector-contrib:0.140.0
  • Run the mcp_calculator.py example with telemetry enabled:
CLAUDE_CODE_ENABLE_TELEMETRY=1 \
OTEL_METRICS_EXPORTER=console,otlp \
OTEL_LOGS_EXPORTER=console,otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" \
OTEL_METRIC_EXPORT_INTERVAL=10000 \
OTEL_LOGS_EXPORT_INTERVAL=5000 python mcp_calculator.py

The process will freeze on the first prompt and will never output any message.

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