#!/usr/bin/env bash
# ==============================================================================
# MCP Config Forge Deterministic Installer : Brave Web & Local Search MCP Server (@modelcontextprotocol/server-brave-search)
# Generated by https://neatjar.com/mcp-forge/mcp-config/brave-search
# ==============================================================================
set -euo pipefail

echo "[1/3] Writing Cursor MCP configuration (.cursor/mcp.json)..."
mkdir -p .cursor
cat << 'EOF_CURSOR' > .cursor/mcp.json
{
  "mcpServers": {
    "brave-search": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-brave-search"
      ],
      "env": {
        "BRAVE_API_KEY": "BSA_live_your_brave_search_subscription_token"
      }
    }
  }
}
EOF_CURSOR

echo "[2/3] Writing VS Code Copilot MCP configuration (.vscode/mcp.json)..."
mkdir -p .vscode
cat << 'EOF_VSCODE' > .vscode/mcp.json
{
  "servers": {
    "brave-search": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-brave-search"
      ],
      "env": {
        "BRAVE_API_KEY": "BSA_live_your_brave_search_subscription_token"
      }
    }
  }
}
EOF_VSCODE

echo "[3/3] Claude Code CLI registration command ready:"
echo "  claude mcp add brave-search -e BRAVE_API_KEY="BSA_live_your_brave_search_subscription_token" -- npx -y @modelcontextprotocol/server-brave-search"
echo "Done! Verify your server at https://neatjar.com/mcp-forge/mcp-config/brave-search"
