#!/bin/bash
# Setup script for Cursor IDE integration
echo "π Setting up MCP Router for Cursor IDE..."
# Get absolute path to mcp_server.py
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
MCP_SERVER_PATH="$PROJECT_ROOT/src/mcp_server.py"
echo "π MCP Server Path: $MCP_SERVER_PATH"
# Detect OS and set Cursor config path
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
CURSOR_CONFIG_DIR="$HOME/Library/Application Support/Cursor/User/globalStorage"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
CURSOR_CONFIG_DIR="$HOME/.config/Cursor/User/globalStorage"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
# Windows
CURSOR_CONFIG_DIR="$APPDATA/Cursor/User/globalStorage"
else
echo "β Unsupported OS: $OSTYPE"
exit 1
fi
echo "π Cursor Config Directory: $CURSOR_CONFIG_DIR"
# Create config directory if it doesn't exist
mkdir -p "$CURSOR_CONFIG_DIR"
# Check if mcp.json exists
MCP_CONFIG_FILE="$CURSOR_CONFIG_DIR/mcp.json"
if [ -f "$MCP_CONFIG_FILE" ]; then
echo "β
Found existing mcp.json"
echo "π Please manually add the following to your mcp.json:"
else
echo "π Creating new mcp.json..."
cat > "$MCP_CONFIG_FILE" << EOF
{
"version": "1.0",
"mcpServers": {
"mcp-router": {
"command": "python3",
"args": [
"$MCP_SERVER_PATH"
],
"env": {}
}
}
}
EOF
echo "β
Created mcp.json"
fi
echo ""
echo "π Configuration:"
echo " Command: python3"
echo " Args: $MCP_SERVER_PATH"
echo ""
echo "β οΈ Make sure to:"
echo " 1. Cursor already has API keys configured - no need to set them here"
echo " 2. Restart Cursor IDE"
echo " 3. Enable MCP Router in Agent Settings:"
echo " - Open Cursor Settings (Cmd+,)"
echo " - Go to Features β Model Context Protocol"
echo " - Enable 'mcp-router' server"
echo " - Enable 'Use MCP Tools' in Agent settings"
echo " 4. The router will recommend models, Cursor will use them with its own API keys"
echo ""
echo "π See docs/AGENT_SETTINGS.md for detailed instructions"
echo ""
echo "β
Setup complete!"