#!/usr/bin/env bash
# ==============================================================================
# MCP Config Forge Deterministic Installer : Exa Neural Search & Web Extraction MCP Server (exa-mcp-server)
# Generated by https://neatjar.com/mcp-forge/mcp-config/exa
# ==============================================================================
set -euo pipefail

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

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

echo "[3/3] Claude Code CLI registration command ready:"
echo "  claude mcp add exa -e EXA_API_KEY="exa_live_9988776655_your_api_key" -- npx -y exa-mcp-server"
echo "Done! Verify your server at https://neatjar.com/mcp-forge/mcp-config/exa"
