#!/usr/bin/env bash
# ==============================================================================
# MCP Config Forge Deterministic Installer : GitHub Repository & Pull Request MCP Server (@modelcontextprotocol/server-github)
# Generated by https://neatjar.com/mcp-forge/mcp-config/github
# ==============================================================================
set -euo pipefail

echo "[1/3] Writing Cursor MCP configuration (.cursor/mcp.json)..."
mkdir -p .cursor
cat << 'EOF_CURSOR' > .cursor/mcp.json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_11AABBCCDDEE_your_fine_grained_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": {
    "github": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_11AABBCCDDEE_your_fine_grained_token"
      }
    }
  }
}
EOF_VSCODE

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