# Real-Time Testing Setup Guide
## Prerequisites
1. **Chrome/Chromium Browser** with remote debugging enabled
2. **LinkedIn Account** - You need to be logged in
3. **API Key** - Generate one using the API
4. **LinkedIn li_at Cookie** - Get from browser devtools
## Step 1: Start Chrome with Remote Debugging
### Windows:
```bash
# Find Chrome installation path
# Usually: C:\Program Files\Google\Chrome\Application\chrome.exe
# Start Chrome with remote debugging on port 9222
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\temp\chrome-debug"
```
### Mac/Linux:
```bash
# Start Chrome with remote debugging
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
# OR
chromium --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
```
## Step 2: Get Your LinkedIn li_at Cookie
1. Open Chrome and navigate to https://www.linkedin.com
2. Log in to your LinkedIn account
3. Open DevTools (F12 or Right-click → Inspect)
4. Go to **Application** tab → **Cookies** → `https://www.linkedin.com`
5. Find the `li_at` cookie and copy its **Value**
## Step 3: Generate API Key
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/generate-key" \
-H "Content-Type: application/json" \
-d '{"tier": "starter"}'
```
Copy the `key` value from the response.
## Step 4: Run the Test Script
```bash
cd garbage/linkedin-lead-mcp
# Set your variables
export API_KEY="your-generated-api-key"
export CDP_URL="http://localhost:9222"
export LI_AT_COOKIE="your-li-at-cookie-value"
# Make script executable (Mac/Linux)
chmod +x test-realtime.sh
# Run the test
./test-realtime.sh
```
## Step 5: Manual Testing Commands
### 1. Connect Browser
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/browser/connect" \
-H "Content-Type: application/json" \
-d '{"cdp_url": "http://localhost:9222"}'
```
### 2. Setup LinkedIn Session
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/session/setup" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"YOUR_API_KEY\",
\"li_at_cookie\": \"YOUR_LI_AT_COOKIE\"
}"
```
### 3. Search for Leads
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/leads/search" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"YOUR_API_KEY\",
\"keywords\": \"CEO OR Founder OR CTO\",
\"location\": \"United States\",
\"limit\": 10
}"
```
### 4. Analyze a Profile
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/leads/analyze" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"YOUR_API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/profile-url\"
}"
```
### 5. Score Lead (AI)
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/leads/score" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"YOUR_API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/profile-url\"
}"
```
### 6. Generate Message (AI)
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/messages/generate" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"YOUR_API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/profile-url\",
\"value_proposition\": \"Your value proposition here\",
\"message_type\": \"connection\"
}"
```
### 7. Send Message
```bash
curl -X POST "https://linkedin-mcp-mocha.vercel.app/api/messages/send" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"YOUR_API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/profile-url\",
\"message\": \"Your personalized message here\",
\"is_connection_request\": true
}"
```
## Important Notes
⚠️ **Browser Automation on Vercel**: The current Vercel deployment is serverless and cannot run a browser directly. For production testing, you need:
1. **Local Testing**: Run Chrome with CDP locally and connect to it
2. **Browser Service**: Use a service like Browserless.io or Puppeteer Cloud
3. **Self-Hosted**: Deploy to a platform that supports persistent processes (not Vercel)
## Troubleshooting
- **Connection failed**: Make sure Chrome is running with `--remote-debugging-port=9222`
- **Session auth failed**: Verify your `li_at` cookie is valid (it expires after some time)
- **No search results**: Check your LinkedIn search filters and ensure you're logged in
- **Rate limiting**: LinkedIn may rate limit aggressive automation