npm install -g @anthropic-ai/claude-code
バージョンを確認する
claude --version
1.0.3 (Claude Code)
claude
// ( Do you trust the files in this folder? ) と聞かれるので Yes を選択して Enter
/cost
(ProプランやMaxプラン以外方はAPIでの使用になります)
(2025/06/05 からProプラン内でも 定額課金内で使えるようになりました)
/logout
claude
(プラン選択から Claude account with subscription を選択するとProやMaxプラン内の定額課金内で使用できます。)
❯ 1. Claude account with subscription
Starting at $20/mo for Pro, $100/mo for Max - Best value, predictable pricing
2. Anthropic Console account
API usage billing
claude
起動したら、次のコマンドでインストールします
/install-github-app
GitHub CLI が、インストールされていない場合は、次のメッセージが出ます
│ ⚠ Setup Warnings │
│ We found some potential issues, but you can continue anyway │
│ │
│ GitHub CLI not found │
│ GitHub CLI (gh) does not appear to be installed or accessible. │
│ │
│ • Install GitHub CLI from https://cli.github.com/ │
│ • macOS: brew install gh │
│ • Windows: winget install --id GitHub.cli │
│ • Linux: See installation instructions at https://github.com/cli/cli#installation │
│ │
│ GitHub CLI not authenticated │
│ GitHub CLI does not appear to be authenticated. │
│ │
│ • Run: gh auth login │
│ • Follow the prompts to authenticate with GitHub │
│ • Or set up authentication using environment variables or other methods
brew install gh
gh version
gh version 2.73.0 (2025-05-19)
which npx
cd ~/Library/Application\ Support/Claude/
code claude_desktop_config.json
以下のように入力
{
"mcpServers": {
"brave-search": {
"command": "/PATH/TO/YOUR/NPX/npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "YOUR_API_KEY"
}
}
}
}
/PATH/TO/YOUR/NPX/npx と YOUR_API_KEY は適宜書き換えます。
設定の確認方法
Claudeアプリを起動し「Claude」→「Settings」→「Developer」を選択します。 以下のように表示されていれば成功です。
次の2つの検索が使えるようになります。
brave_web_search: ウェブ上の一般的な情報を検索
brave_local_search: 実店舗やビジネスなどの地域情報を検索
「could not connect MCP brave server」のようなエラーになる場合はパスがうまく通ってないかもしれないので確認しましょう。
試しに以下のようなプロンプトを実行して検証します。
ネットで生成AIの最新ニュースを検索して5件面白いトピックを教えて
web検索してくれてます。
アクセス可能なフォルダ作成して指定します。
"filesystem": {
"command": "/PATH/TO/YOUR/NPX/npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/YOUR-USER-NAME/mcp_folder"
]
},
"mcp_server_mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASS": "",
"MYSQL_DB": "db_name"
}
}
playwright-mcp
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
Claudeの設定ファイルを編集する
cd ~/Library/Application\ Support/Claude/
code claude_desktop_config.json
"claude_code": {
"command": "/PATH/TO/YOUR/FOLDER/claude",
"args": ["mcp", "serve"],
"env": {}
}
which claude
で取得できるパスを入力します。
例えば、次のようなプロンプトを入力するとClaude Codeから実行して調べてくれます
このMacのdiskの残り容量を調べて欲しい
claude code でエラーが出る場合は最新バージョンにアップグレードしましょう
npm install -g @anthropic-ai/claude-code
このあたりにあります
https://github.com/modelcontextprotocol/servers/blob/main/src/brave-search/index.ts#L182
各API にそれぞれ「こんにちは」のメッセージを投げた時の戻り値です
{
"candidates": [
{
"content": {
"parts": [
{
"text": "こんにちは! 何かお手伝いできることはありますか? \n"
}
],
"role": "model"
},
"finishReason": "STOP",
"index": 0,
"safetyRatings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
}
],
"usageMetadata": {
"promptTokenCount": 2,
"candidatesTokenCount": 11,
"totalTokenCount": 13
},
"modelVersion": "gemini-1.5-flash-001"
}
{
"id": "chatcmpl-ATdccrP607V8JZQgryBdx72k0FD85",
"object": "chat.completion",
"created": 1731627182,
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "こんにちは!今日はどんなことをお話ししましょうか?",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 14,
"total_tokens": 22,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"system_fingerprint": "fp_0ba0d124f1"
}
{
"id": "msg_01BfFT8n2WeqqB47em3zig7x",
"type": "message",
"role": "assistant",
"model": "claude-3-haiku-20240307",
"content": [
{
"type": "text",
"text": "はい、こんにちは。どのようなことでお手伝いできますでしょうか?"
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 12,
"output_tokens": 31
}
}