環境変数

MCP_SDK_GENERATION

Claude CodeがMCPサーバー接続の背後にある実装をv1ランタイムからv2ランタイムへと移行する間に、このプロセスが使用するMCPクライアントランタイムのバージョンを固定します。

使い方・用途

  • 選択肢として v1 を指定すると現在のランタイムに留まり、v2 を指定すると新しいランタイムに早期移行(オプトイン)できます。
  • 本環境変数を設定しない場合のデフォルト値は v1 となり、段階的な展開によって決定されます。
  • 不正な値を設定した場合は警告がデバッグログに記録され、設定は無視されます(Claude Code v2.1.218以降で利用可能)。
英語原文(公式ドキュメントより)

Pin which MCP client runtime this process uses, the implementation behind MCP server connections, while Claude Code migrates from its v1 runtime to v2. Set v1 to stay on the current runtime or v2 to opt in early. Without the variable, a gradual rollout decides, and defaults to v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins Issuer mismatch in authorization response when it doesn't match. The v1 runtime doesn't run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later