MCPを使ってBrave SearchとClaude Desktopを連携する手順
![BraveSearch-MCP-claude](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/braveSearch-MCP-claude.png?resize=1280%2C720&ssl=1)
プライバシーを重視しながらも高品質な検索結果を提供できる検索エンジンとして知られるBrave Search
と、ClaudeのModel Context Protocol (MCP)を連携させることで、より高度な検索機能とAI機能の統合が実現可能になるらしい。
それにより具体的に何ができるかは、さておき、可能性が広がるばかりということで、とりあえず設定手順をまとめておきたいと思います。
![Brave Search MCP Server](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/211904_social_github_icon.png?resize=128%2C72&ssl=1)
手順を進めるにあたって前提を記載しておきます。
あらかじめ準備しておく必要があるもの
・Claude Desktop
・「Brave Search API」アカウント(無料範囲)だけど→クレジットカード
Brave Search APIにサインアップしてアカウントを準備しておきます。
🔐 Brave Search APIのキーを取得する
Brave Search APIの管理画面にログインします。
ログイン直後は、Dashboardが表示されています。最初は、サイドメニューの[Subscriptions]からプランを選択します。
今回は無料プラン(月間2,000クエリまで無料で商用利用も可能)範囲内で使い始めたいので、「Free」の[Subscribe]をクリックします。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-13.jpg?resize=1024%2C421&ssl=1)
支払い情報(クレジットカード情報)を登録して、登録が完了します。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-13-2.jpg?resize=1024%2C422&ssl=1)
サイドメニューの[API Keys]をクリックします。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-11.png?resize=1024%2C463&ssl=1)
[+ Add API key]をクリックし、新規でkeyを作成します。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-13.png?resize=1024%2C440&ssl=1)
Name(ここでは「Claude-MCP」)を入力し、[Add]をクリックします。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-14.png?resize=1024%2C721&ssl=1)
新規で「Claude-MCP」というKeyが作成されました。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-15.png?resize=1024%2C427&ssl=1)
[Copy]をクリックしておきましょう。
📝 claude_desktop_config.jsonを編集
Claude Desktop側の設定ファイルを編集します。
ナビゲーションメニューの「Claude > Settings…」で
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2024-12-05-22.20.57.png?resize=518%2C560&ssl=1)
Settingsウインドウを開き、Developerメニューから[Edit Config]をクリックします。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-16.png?resize=1024%2C724&ssl=1)
そうすると設定ファイルのFinderが開きます。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-17.png?resize=752%2C437&ssl=1)
このclaude_desktop_config.json
をエディタで開いて修正しましょう。
※ファイルのパスはあくまで私の環境の内容ですので各自の環境に置き換えてください。
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": [
"mcp-server-sqlite",
"--db-path",
"/Users/ユーザー名/test.db"
]
},
"notion": {
"command": "/Users/ユーザー名/.nodebrew/current/bin/node",
"args": [
"/Users/ユーザー名/mcp-notion-server/notion/build/index.js"
],
"env": {
"NOTION_API_TOKEN": "取得したNOTION_API_TOKEN"
}
},
"brave-search": {
"command": "/Users/ユーザー名/.nodebrew/current/bin/npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "取得したBRAVE_API_KEY"
}
}
}
}
そして、Claude Desktopを再起動します。
🚧 動作確認
Claude Desktopを起動してみると途中でメッセージが右上に表示されています。
![Could not attach to MCP server brave-search](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2024-12-05-22.37.58-1.png?resize=376%2C60&ssl=1)
「Could not attach to MCP server brave-search」というメッセージです。
調べてみると、あきらパパのXで共有されている動画の中で紹介されている手順で抜けているものがあったので実行してみます。
🧑💻 Brave SearchのMCPサーバーモジュールをインストール
Brave SearchのMCPサーバーモジュールをグローバルにインストールする。
% npm i -g @modelcontextprotocol/server-brave-search
added 15 packages in 5s
1 package is looking for funding
run `npm fund` for details
上記を実行すると、エラーが出なくなりました。
🔍️ 動かしてみる
トンカチマーク⚒️を確認してもBrave Searchが認識されていません。
うーん、、原因不明ですね。
⏪️ 設定の変更を行う(私の環境固有の問題)
対応方針を変えたいと思います。
変更のポイント:
npx
を使わず、node
コマンドで直接実行- グローバルインストールされたパッケージの実際のJSファイルパスを指定
ということで再度設定ファイルclaude_desktop_config.json
を修正します。
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": [
"mcp-server-sqlite",
"--db-path",
"/Users/ユーザー名/test.db"
]
},
"notion": {
"command": "/Users/ユーザー名/.nodebrew/current/bin/node",
"args": [
"/Users/ユーザー名/mcp-notion-server/notion/build/index.js"
],
"env": {
"NOTION_API_TOKEN": "取得したNOTION_API_TOKEN"
}
},
"brave-search": {
"command": "/Users/ユーザー名/.nodebrew/current/bin/node",
"args": [
"/Users/ユーザー名/.nodebrew/node/v21.5.0/lib/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"
],
"env": {
"BRAVE_API_KEY": "取得したBRAVE_API_KEY"
}
}
}
}
いけてないかもしれませんが、これで保存して、Claude Desktopを再起動してみると、トンカチマーク⚒️に表示されている数値が増えて、Brave Searchを認識できるようになりました。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-19.jpg?resize=914%2C1024&ssl=1)
🔍️ 再度、動かしてみる
![o_wani](https://i0.wp.com/owani.net/wp-content/uploads/2023/11/DALL%C2%B7E-2023-06-09-16.00.49-High-quality-photo-of-a-Shiba-Inu-astronaut.jpg?resize=72%2C72&ssl=1)
日本の首相を調査して
![Claude](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2024-12-05-8.24.24.png?resize=72%2C72&ssl=1)
最新の情報を検索させていただきます。
![](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/image-19.png?resize=1024%2C533&ssl=1)
[Allow for This Chat]をクリックします。
![Claude](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2024-12-05-8.24.24.png?resize=72%2C72&ssl=1)
現在の日本の首相は岸田文雄氏です。主な情報は以下の通りです:
- 2021年10月から現職(第100代・101代内閣総理大臣)
- 1957年7月29日生まれ
- 衆議院議員11期
- 広島県第1区選出
- 主な経歴:外務大臣、防衛大臣などを歴任
より詳しい情報や特定の観点からの分析が必要な場合はお申し付けください。
![o_wani](https://i0.wp.com/owani.net/wp-content/uploads/2023/11/DALL%C2%B7E-2023-06-09-16.00.49-High-quality-photo-of-a-Shiba-Inu-astronaut.jpg?resize=72%2C72&ssl=1)
現在はもっと新しい首相になっているので、BraveSearchで最新情報を教えて
![Claude](https://i0.wp.com/owani.net/wp-content/uploads/2024/12/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2024-12-05-8.24.24.png?resize=72%2C72&ssl=1)
検索結果によると、2024年10月に政権交代があり、石破茂氏が第103代内閣総理大臣に就任しました。以前の岸田文雄首相は2024年8月に総裁選不出馬を表明し退任しています。石破内閣は2024年10月1日に正式に発足し、11月には第2次石破内閣が発足しています。
現場からは、以上です。