← Back to all posts

MCP Portable with Next JS Guide

By AkashAman||4 min read
ReactPerformanceOptimizationJavaScript
MCP Portable with Next JS Guide

🚀 MCP Portable Setup Guide

📋 What Your Brother Needs to Copy

1. Server Files (Essential)

Copy these directories to the new laptop:

/Users/akashaman/Documents/mcp-servers/
├── sitemap-server/
│   ├── mcp-sitemap-server.js
│   ├── package.json
│   └── node_modules/ (or install dependencies)
└── linking-analyzer/
    ├── mcp_internal_linking_server.py
    ├── requirements.txt
    └── venv/ (or create new virtual environment)

2. Configuration Files

  • Cursor settings.json (will be created automatically)
  • Any custom configuration files

🔧 Setup Instructions for New Laptop

Step 1: Install Prerequisites

Python Setup

# Install Python 3.10+ (required for MCP)
brew install python@3.10

# Create virtual environment
python3.10 -m venv /path/to/linking-analyzer/venv
source /path/to/linking-analyzer/venv/bin/activate

# Install Python dependencies
pip install -r /path/to/linking-analyzer/requirements.txt

Node.js Setup

# Install Node.js (if not already installed)
brew install node

# Install Node.js dependencies
cd /path/to/sitemap-server
npm install

Step 2: Copy Server Files

Option A: Direct Copy

# Copy the entire mcp-servers directory
cp -r /Users/akashaman/Documents/mcp-servers/ /path/to/destination/

Option B: Git Repository (Recommended)

# Create a git repository for easy sharing
cd /Users/akashaman/Documents/
git init mcp-servers
cd mcp-servers
git add .
git commit -m "Initial MCP servers setup"
git remote add origin <your-git-repo-url>
git push -u origin main

# On new laptop
git clone <your-git-repo-url>
cd mcp-servers

Step 3: Configure Cursor

Create Cursor Configuration

# Create Cursor settings directory (if it doesn't exist)
mkdir -p ~/Library/Application\ Support/Cursor/User/

# Create settings.json with MCP configuration
cat > ~/Library/Application\ Support/Cursor/User/settings.json << 'EOF'
{
    "window.commandCenter": true,
    "diffEditor.maxComputationTime": 0,
    "mcp.servers": {
        "sitemap-server": {
            "command": "node",
            "args": ["/path/to/mcp-servers/sitemap-server/mcp-sitemap-server.js"],
            "env": {}
        },
        "internal-linking-analyzer": {
            "command": "/path/to/mcp-servers/linking-analyzer/venv/bin/python",
            "args": ["/path/to/mcp-servers/linking-analyzer/mcp_internal_linking_server.py"],
            "env": {
                "PYTHONUNBUFFERED": "1"
            }
        }
    }
}
EOF

Important: Replace /path/to/ with the actual paths on the new laptop.

Step 4: Test the Setup

Test Python Server

cd /path/to/mcp-servers/linking-analyzer
source venv/bin/activate
python mcp_internal_linking_server.py

Test Node.js Server

cd /path/to/mcp-servers/sitemap-server
node mcp-sitemap-server.js

Step 5: Restart Cursor

  1. Close Cursor completely
  2. Reopen Cursor
  3. Test MCP tools in chat

📦 Alternative: Automated Setup Script

Create this script for easy setup:

#!/bin/bash
# setup_mcp.sh

echo "🚀 Setting up MCP servers..."

# Install Python dependencies
echo "📦 Installing Python dependencies..."
cd linking-analyzer
python3.10 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Install Node.js dependencies
echo "📦 Installing Node.js dependencies..."
cd ../sitemap-server
npm install

# Create Cursor configuration
echo "⚙️ Creating Cursor configuration..."
mkdir -p ~/Library/Application\ Support/Cursor/User/

cat > ~/Library/Application\ Support/Cursor/User/settings.json << EOF
{
    "window.commandCenter": true,
    "diffEditor.maxComputationTime": 0,
    "mcp.servers": {
        "sitemap-server": {
            "command": "node",
            "args": ["$(pwd)/mcp-sitemap-server.js"],
            "env": {}
        },
        "internal-linking-analyzer": {
            "command": "$(pwd)/../linking-analyzer/venv/bin/python",
            "args": ["$(pwd)/../linking-analyzer/mcp_internal_linking_server.py"],
            "env": {
                "PYTHONUNBUFFERED": "1"
            }
        }
    }
}
EOF

echo "✅ MCP setup complete! Restart Cursor to activate."

🔍 Troubleshooting

Common Issues

Python Import Errors

# Make sure you're in the virtual environment
source venv/bin/activate

# Reinstall dependencies
pip install --upgrade -r requirements.txt

Node.js Module Errors

# Clear npm cache and reinstall
npm cache clean --force
rm -rf node_modules package-lock.json
npm install

Cursor Not Recognizing MCP

  1. Check settings.json syntax
  2. Verify file paths are correct
  3. Restart Cursor completely
  4. Check Cursor console for errors

Permission Issues

# Fix file permissions
chmod +x /path/to/mcp-servers/linking-analyzer/venv/bin/python
chmod +x /path/to/mcp-servers/sitemap-server/mcp-sitemap-server.js

📝 Usage Examples

Once setup is complete, your brother can use these commands in Cursor:

"Fetch the sitemap for https://example.com/sitemap.xml"
"Analyze internal linking opportunities for example.com focusing on 'software'"
"Get advanced internal linking analysis for mywebsite.com"

🎯 Quick Setup Checklist

  • [ ] Copy mcp-servers directory
  • [ ] Install Python 3.10+
  • [ ] Create virtual environment
  • [ ] Install Python dependencies
  • [ ] Install Node.js dependencies
  • [ ] Create Cursor settings.json
  • [ ] Test both servers
  • [ ] Restart Cursor
  • [ ] Test MCP tools in chat

💡 Pro Tips

  1. Use Git: Keep MCP servers in a git repository for easy updates
  2. Environment Variables: Use environment variables for paths in production
  3. Backup Configuration: Keep a backup of working configurations
  4. Version Control: Track changes to server code and configurations
  5. Documentation: Keep notes of any customizations made

That's it! Your brother should now have a fully functional MCP setup that works exactly like yours.