Communityコーディング&開発github.com

Claude in Chrome MCP トラブルシューティング

Claude の Chrome MCP 拡張機能の接続問題を診断・修正します。mcp__claude-in-chrome__* ツールが失敗したり、「ブラウザ拡張が接続されていません」と表示される場合に使用します。

Claude in Chrome MCP トラブルシューティング とは?

このスキルは、Claude Code と Claude.app (Cowork) の間で発生する Chrome MCP (Model Context Protocol) 拡張機能の接続問題を解決するためのトラブルシューティングガイドです。主な問題は、両方のアプリケーションが異なるネイティブメッセージングホストとソケット形式を使用しており、設定が競合すると「ブラウザ拡張が接続されていません」というエラーが発生することです。このスキルでは、競合の診断方法、適切なネイティブメッセージング設定の有効化/無効化、動的バージョンラッパーの更新、完全なリセット手順を提供します。macOS 環境での Claude Code CLI と Claude.app ユーザー向けに設計されており、複数の Chrome プロファイルや TMPDIR 設定の欠落など、他の一般的な原因もカバーしています。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/trailofbits/skills/tree/main/plugins/claude-in-chrome-troubleshooting/skills/chrome-mcp-troubleshooting

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Claude in Chrome MCP トラブルシューティング は何をしますか?

このスキルは、Claude in Chrome MCP ツールの接続が失敗したり、信頼性が低い場合に使用します。

使用するタイミング

  • mcp__claude-in-chrome__* ツールが「ブラウザ拡張が接続されていません」というエラーで失敗する場合
  • ブラウザ自動化が断続的に動作したり、タイムアウトする場合
  • Claude Code または Claude.app を更新した後
  • Claude Code CLI と Claude.app (Cowork) を切り替える場合
  • ネイティブホストプロセスは実行中だが、MCP ツールがまだ失敗する場合

使用してはいけないタイミング

  • Linux または Windows ユーザー - このスキルは macOS 固有のパスとツール(~/Library/Application Support/、osascript)を対象としています
  • Claude 拡張機能に関係しない一般的な Chrome 自動化の問題
  • Claude.app デスクトップの問題(ブラウザ関連以外)
  • ネットワーク接続の問題
  • Chrome 拡張機能のインストールの問題(Chrome Web Store サポートを利用)

Claude.app と Claude Code の競合(主要な問題)

背景: Claude.app に Cowork サポート(デスクトップアプリからのブラウザ自動化)が追加された際、Claude Code CLI と競合するネイティブメッセージングホストが導入されました。

2つのネイティブホスト、2つのソケット形式

コンポーネントネイティブホストバイナリソケットの場所
Claude.app (Cowork)/Applications/Claude.app/Contents/Helpers/chrome-native-host/tmp/claude-mcp-browser-bridge-$USER/<PID>.sock
Claude Code CLI~/.local/share/claude/versions/<version> --chrome-native-host$TMPDIR/claude-mcp-browser-bridge-$USER (単一ファイル)

競合の原因

  1. 両方が Chrome にネイティブメッセージング設定を登録します:

    • com.anthropic.claude_browser_extension.json → Claude.app ヘルパー
    • com.anthropic.claude_code_browser_extension.json → Claude Code ラッパー
  2. Chrome 拡張機能が名前でネイティブホストを要求します

  3. 間違った設定がアクティブだと、間違ったバイナリが実行されます

  4. 間違ったバイナリが、MCP クライアントが想定しない形式/場所にソケットを作成します

  5. 結果:すべてが実行されているように見えても、「ブラウザ拡張が接続されていません」と表示されます

修正方法:Claude.app のネイティブホストを無効にする

ブラウザ自動化に Claude Code CLI を使用する場合(Cowork ではない):

# Claude.app のネイティブメッセージング設定を無効にする
mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json \
   ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json.disabled

# Claude Code の設定が存在し、ラッパーを指していることを確認する
cat ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json

ブラウザ自動化に Cowork (Claude.app) を使用する場合:

# Claude Code のネイティブメッセージング設定を無効にする
mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json \
   ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json.disabled

両方を同時に使用することはできません。 いずれかを選択し、もう一方を無効にしてください。

トグルスクリプト

以下を ~/.zshrc に追加するか、直接実行します:

chrome-mcp-toggle() {
    local CONFIG_DIR=~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts
    local CLAUDE_APP="$CONFIG_DIR/com.anthropic.claude_browser_extension.json"
    local CLAUDE_CODE="$CONFIG_DIR/com.anthropic.claude_code_browser_extension.json"

    if [[ -f "$CLAUDE_APP" && ! -f "$CLAUDE_APP.disabled" ]]; then
        # 現在 Claude.app を使用中、Claude Code に切り替え
        mv "$CLAUDE_APP" "$CLAUDE_APP.disabled"
        [[ -f "$CLAUDE_CODE.disabled" ]] && mv "$CLAUDE_CODE.disabled" "$CLAUDE_CODE"
        echo "Claude Code CLI に切り替えました"
        echo "適用するには Chrome と Claude Code を再起動してください"
    elif [[ -f "$CLAUDE_CODE" && ! -f "$CLAUDE_CODE.disabled" ]]; then
        # 現在 Claude Code を使用中、Claude.app に切り替え
        mv "$CLAUDE_CODE" "$CLAUDE_CODE.disabled"
        [[ -f "$CLAUDE_APP.disabled" ]] && mv "$CLAUDE_APP.disabled" "$CLAUDE_APP"
        echo "Claude.app (Cowork) に切り替えました"
        echo "適用するには Chrome を再起動してください"
    else
        echo "現在の状態が不明です。設定を確認してください:"
        ls -la "$CONFIG_DIR"/com.anthropic*.json* 2>/dev/null
    fi
}

使用方法:chrome-mcp-toggle を実行後、Chrome(および CLI に切り替える場合は Claude Code)を再起動します。

クイック診断

# 1. どのネイティブホストバイナリが実行中か?
ps aux | grep chrome-native-host | grep -v grep
# Claude.app: /Applications/Claude.app/Contents/Helpers/chrome-native-host
# Claude Code: ~/.local/share/claude/versions/X.X.X --chrome-native-host

# 2. ソケットはどこにあるか?
# Claude Code の場合(TMPDIR 内の単一ファイル):
ls -la "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER" 2>&1

# Claude.app の場合(PID ファイルのあるディレクトリ):
ls -la /tmp/claude-mcp-browser-bridge-$USER/ 2>&1

# 3. ネイティブホストは何に接続されているか?
lsof -U 2>&1 | grep claude-mcp-browser-bridge

# 4. どの設定がアクティブか?
ls ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic*.json

重要な洞察

MCP は起動時に接続します。 Claude Code が起動した時点でブラウザブリッジの準備ができていなかった場合、セッション全体で接続は失敗します。修正方法は通常、正しい設定で Chrome + 拡張機能が実行されていることを確認し、その後 Claude Code を再起動することです。

完全リセット手順(Claude Code CLI)

# 1. 正しい設定がアクティブであることを確認する
mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json \
   ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json.disabled 2>/dev/null

# 2. 最新の Claude Code バージョンを使用するようにラッパーを更新する
cat > ~/.claude/chrome/chrome-native-host << 'EOF'
#!/bin/bash
LATEST=$(ls -t ~/.local/share/claude/versions/ 2>/dev/null | head -1)
exec "$HOME/.local/share/claude/versions/$LATEST" --chrome-native-host
EOF
chmod +x ~/.claude/chrome/chrome-native-host

# 3. 既存のネイティブホストを強制終了し、ソケットをクリーンアップする
pkill -f chrome-native-host
rm -rf /tmp/claude-mcp-browser-bridge-$USER/
rm -f "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER"

# 4. Chrome を再起動する
osascript -e 'quit app "Google Chrome"' && sleep 2 && open -a "Google Chrome"

# 5. Chrome が起動するのを待ち、Claude 拡張機能のアイコンをクリックする

# 6. 正しいネイティブホストが実行中であることを確認する
ps aux | grep chrome-native-host | grep -v grep
# 表示されるべき内容: ~/.local/share/claude/versions/X.X.X --chrome-native-host

# 7. ソケットが存在することを確認する
ls -la "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER"

# 8. Claude Code を再起動する

その他の一般的な原因

複数の Chrome プロファイル

複数の Chrome プロファイルに Claude 拡張機能がインストールされている場合、それぞれが独自のネイティブホストとソケットを生成します。これにより混乱が生じる可能性があります。

修正方法: 1つの Chrome プロファイルでのみ Claude 拡張機能を有効にしてください。

複数の Claude Code セッション

複数の Claude Code インスタンスを実行すると、ソケットの競合が発生する可能性があります。

修正方法: 一度に1つの Claude Code セッションのみを実行するか、他のセッションを閉じた後に /mcp を使用して再接続してください。

ラッパー内のハードコードされたバージョン

~/.claude/chrome/chrome-native-host のラッパーにハードコードされたバージョンがあると、アップデート後に古くなってしまう可能性があります。

診断方法:

cat ~/.claude/chrome/chrome-native-host
# 悪い例: exec "/Users/.../.local/share/claude/versions/2.0.76" --chrome-native-host
# 良い例: $(ls -t ...) を使用して最新バージョンを見つける

修正方法: 上記の完全リセット手順で示した動的バージョンラッパーを使用してください。

TMPDIR が設定されていない

Claude Code はソケットを見つけるために TMPDIR が設定されていることを期待します。

# 確認する
echo $TMPDIR
# 表示されるべき内容: /var/folders/XX/.../T/

# 修正方法:~/.zshrc に追加する
export TMPDIR="${TMPDIR:-$(getconf DARWIN_USER_TEMP_DIR)}"

詳細診断

echo "=== ネイティブホストバイナリ ==="
ps aux | grep chrome-native-host | grep -v grep

echo -e "\n=== ソケット(Claude Code の場所) ==="
ls -la "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER" 2>&1

echo -e "\n=== ソケット(Claude.app の場所) ==="
ls -la /tmp/claude-mcp-browser-bridge-$USER/ 2>&1

echo -e "\n=== ネイティブホストのオープンファイル ==="
pgrep -f chrome-native-host | xargs -I {} lsof -p {} 2>/dev/null | grep -E "(sock|claude-mcp)"

echo -e "\n=== アクティブなネイティブメッセージング設定 ==="
ls ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic*.json 2>/dev/null

echo -e "\n=== カスタムラッパーの内容 ==="
cat ~/.claude/chrome/chrome-native-host 2>/dev/null || echo "カスタムラッパーはありません"

echo -e "\n=== TMPDIR ==="
echo "TMPDIR=$TMPDIR"
echo "期待値: $(getconf DARWIN_USER_TEMP_DIR)"

ファイル参照

ファイル目的
~/.claude/chrome/chrome-native-hostClaude Code 用のカスタムラッパースクリプト
/Applications/Claude.app/Contents/Helpers/chrome-native-hostClaude.app (Cowork) のネイティブホスト
~/.local/share/claude/versions/<version>Claude Code バイナリ(--chrome-native-host 付きで実行)
~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.jsonClaude.app ネイティブホストの設定
~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.jsonClaude Code ネイティブホストの設定
$TMPDIR/claude-mcp-browser-bridge-$USERソケットファイル(Claude Code)
/tmp/claude-mcp-browser-bridge-$USER/<PID>.sockソケットファイル(Claude.app)

まとめ

  1. 主要な問題: Claude.app (Cowork) と Claude Code は、互換性のないソケット形式を持つ異なるネイティブホストを使用します
  2. 修正方法: 使用していない方のネイティブメッセージング設定を無効にします
  3. 修正後: Chrome と Claude Code の両方を再起動する必要があります(MCP は起動時に接続します)
  4. 1つのプロファイル: Claude 拡張機能は1つの Chrome プロファイルのみにしてください
  5. 1つのセッション: 一度に1つの Claude Code インスタンスのみを実行してください

オリジナルスキル:@jeffzwang(@ExaAILabs)作成。Claude Desktop および Claude Code の現在のバージョン向けに拡張・更新済み。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

trailofbits/address-sanitizer

AddressSanitizer detects memory errors during fuzzing. Use when fuzzing C/C++ code to find buffer overflows and use-after-free bugs.

trailofbits/aflpp

AFL++ is a fork of AFL with better fuzzing performance and advanced features. Use for multi-core fuzzing of C/C++ projects.

trailofbits/agentic-actions-auditor

Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI Inference. Detects attack vectors where attacker-controlled input reaches AI agents running in CI/CD pipelines, including env var intermediary patterns, direct expression injection, dangerous sandbox configurations, and wildcard user allowlists. Use when reviewing workflow files that invoke AI coding agents, auditing CI/CD pipeline security for prompt injection risks, or evaluating agentic action configurations.

trailofbits/algorand-vulnerability-scanner

Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access control issues. Use when auditing Algorand projects (TEAL/PyTeal).

trailofbits/ask-questions-if-underspecified

Clarify requirements before implementing. Use when serious doubts arise.

trailofbits/atheris

Atheris is a coverage-guided Python fuzzer based on libFuzzer. Use for fuzzing pure Python code and Python C extensions.

trailofbits/audit-augmentation

Augments Trailmark code graphs with external audit findings from SARIF static analysis results and weAudit annotation files. Maps findings to graph nodes by file and line overlap, creates severity-based subgraphs, and enables cross-referencing findings with pre-analysis data (blast radius, taint, etc.). Use when projecting SARIF results onto a code graph, overlaying weAudit annotations, cross-referencing Semgrep or CodeQL findings with call graph data, or visualizing audit findings in the context of code structure.

trailofbits/audit-context-building

Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding.

trailofbits/audit-prep-assistant

Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools, increases test coverage, removes dead code, ensures accessibility, and generates documentation (flowcharts, user stories, inline comments).

trailofbits/burpsuite-project-parser

Searches and explores Burp Suite project files (.burp) from the command line. Use when searching response headers or bodies with regex patterns, extracting security audit findings, dumping proxy history or site map data, or analyzing HTTP traffic captured in a Burp project.

trailofbits/cairo-vulnerability-scanner

Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects.

trailofbits/cargo-fuzz

cargo-fuzz is the de facto fuzzing tool for Rust projects using Cargo. Use for fuzzing Rust code with libFuzzer backend.

trailofbits/claude-in-chrome-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/code-improver

Runs an autonomous review-and-fix improvement loop over any code target — a skill, plugin, module, or directory — using a reviewer the user names: any installed skill or agent. Keeps a cross-round findings ledger, escalates when fixes stop converging, and guards scope mechanically. Use when asked to 'improve this code until review passes', 'run an improvement loop with <reviewer>', or to iterate review-and-fix with a specific reviewer. For skills prefer the skill-improver entry; for a branch prefer pr-improver.

trailofbits/code-maturity-assessor

Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing practices, access controls, complexity, decentralization, documentation, MEV risks, low-level code, and testing. Produces professional scorecard with evidence-based ratings and actionable recommendations.

trailofbits/codeql

Scans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis. Triggers on "run codeql", "codeql scan", "codeql analysis", "build codeql database", or "find vulnerabilities with codeql". Supports "run all" (security-and-quality + security-experimental suites) and "important only" (high-precision security findings) scan modes. Also handles creating data extension models and processing CodeQL SARIF output.

trailofbits/constant-time-analysis

Detects timing side-channel vulnerabilities in cryptographic code. Use when implementing or reviewing crypto code, encountering division on secrets, secret-dependent branches, or constant-time programming questions in C, C++, Go, Rust, Swift, Java, Kotlin, C#, PHP, JavaScript, TypeScript, Python, or Ruby.

trailofbits/constant-time-testing

Constant-time testing detects timing side channels in cryptographic code. Use when auditing crypto implementations for timing vulnerabilities.

trailofbits/cosmos-vulnerability-scanner

Scans Cosmos SDK blockchain modules and CosmWasm contracts for consensus-critical vulnerabilities — chain halts, fund loss, state divergence. 25 core + 16 IBC + 10 EVM + 3 CosmWasm patterns. Use when auditing custom x/ modules, reviewing IBC integrations, or assessing pre-launch chain security. Updated for SDK v0.53.x.

trailofbits/coverage-analysis

Coverage analysis measures code exercised during fuzzing. Use when assessing harness effectiveness or identifying fuzzing blockers.

関連スキル