FirstPromoter MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with access to the FirstPromoter affiliate management platform. Designed for remote multi-user deployment using HTTP/SSE transport.
🎯 Features
Referral Management
get_referrals- List all referrals with search, state, and promoter filtersget_referral- Get detailed information about a specific referral
Promoter Management
get_promoters- List all promoters with filterscreate_promoter- Create a new promoterget_promoter- Get detailed promoter informationupdate_promoter- Update promoter detailsadd_promoters_to_campaign- Add promoters to a campaignmove_promoters_to_campaign- Move promoters between campaignsaccept_promoters- Accept pending promotersreject_promoters- Reject pending promotersblock_promoters- Block promotersarchive_promoters- Archive promotersrestore_promoters- Restore archived promoters
Campaign Management
get_promoter_campaigns- List promoter-campaign relationshipsupdate_promoter_campaign- Update campaign settings
Commission Management
get_commissions- List all commissions with filtersapprove_commissions- Approve pending commissionsdeny_commissions- Deny commissions
Payout Management
get_payouts- List all payoutsget_payout_stats- Get payout statisticsget_due_payout_stats- Get due payout statisticsget_payouts_by_promoter- Get payouts grouped by promoter
🏗️ Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Claude Desktop │ │ Claude Code │ │ n8n │
│ (Client) │ │ (Client) │ │ (Client) │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ HTTP/SSE │ │
└───────────────────────┼───────────────────────┘
│
┌────────────▼────────────┐
│ Hetzner CPX22 Server │
│ (Dokploy/Docker) │
│ │
│ ┌───────────────────┐ │
│ │ FirstPromoter MCP │ │
│ │ Server │ │
│ │ (Port 8000) │ │
│ └─────────┬─────────┘ │
└────────────┼────────────┘
│
┌────────────▼────────────┐
│ FirstPromoter API │
│ api.firstpromoter.com │
└─────────────────────────┘
🚀 Deployment to Dokploy
Prerequisites
- Dokploy v0.26.6+ installed on your Hetzner server
- FirstPromoter API Key and Account ID
- (Optional) Domain name for HTTPS
Step 1: Create the Project in Dokploy
- Log into your Dokploy dashboard
- Click "Create Project"
- Name it
firstpromoter-mcp
Step 2: Create the Application
- Inside the project, click "Create Application"
- Select "Docker Compose" as the source type
- Choose "Git" or "Upload" based on your preference
Option A: Git Repository
- Push this code to a Git repository
- Connect the repository in Dokploy
Option B: Direct Upload
- Upload all files to Dokploy
Step 3: Configure Environment Variables
In Dokploy's application settings, add these environment variables:
| Variable | Description | Required |
|---|---|---|
FP_API_KEY | FirstPromoter API Key | ✅ Yes |
FP_ACCOUNT_ID | FirstPromoter Account ID | ✅ Yes |
MCP_AUTH_TOKEN | Token for MCP client auth | 🔐 Recommended |
MCP_PORT | Server port (default: 8000) | ❌ Optional |
Step 4: Configure Domain (HTTPS)
- In Dokploy, go to Domains
- Add your domain (e.g.,
mcp.yourdomain.com) - Enable HTTPS (Let's Encrypt)
- Set the target port to
8000
Step 5: Deploy
Click Deploy in Dokploy. The server will build and start.
🔌 Client Configuration
Claude Desktop
Add to your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"firstpromoter": {
"transport": {
"type": "sse",
"url": "https://mcp.yourdomain.com/sse"
}
}
}
}
Claude Code (CLI)
claude mcp add firstpromoter --transport sse --url "https://mcp.yourdomain.com/sse"
n8n Integration
Option 1: Using MCP Node (if available)
Configure the MCP node with:
- Transport: SSE
- URL:
https://mcp.yourdomain.com/sse
Option 2: Direct HTTP Requests
Use the HTTP Request node to call FirstPromoter API directly. The MCP server exposes the same endpoints.
🔐 Security Recommendations
1. Enable HTTPS
Always use HTTPS in production. Dokploy handles this automatically with Let's Encrypt.
2. IP Allowlisting
In Dokploy, you can configure firewall rules to only allow specific IPs:
- Your office IP
- Your colleagues' IPs
- n8n server IP
3. Authentication Token
Set MCP_AUTH_TOKEN to require clients to authenticate. Clients must include this token in their requests.
4. Rate Limiting
FirstPromoter has a rate limit of 400 requests/minute. The MCP server doesn't add additional rate limiting, but you can add a reverse proxy (like Nginx) in front if needed.
🧪 Testing
Health Check
curl https://mcp.yourdomain.com/health
List Tools
curl https://mcp.yourdomain.com/sse \
-H "Accept: text/event-stream"
Local Testing (Docker)
# Build
docker build -t firstpromoter-mcp .
# Run
docker run -d \
-e FP_API_KEY=your_key \
-e FP_ACCOUNT_ID=your_account_id \
-p 8000:8000 \
firstpromoter-mcp
# Test
curl http://localhost:8000/health
📝 Example Usage
Once connected, you can ask Claude:
Promoter Management:
- "Show me all pending promoters"
- "Create a new promoter with email john@example.com"
- "Accept promoter ID 12345"
- "Move promoters 100, 101, 102 to campaign 5"
Commission Management:
- "List all pending commissions"
- "Approve commission IDs 500, 501, 502"
- "Show commission stats"
Payout Management:
- "What are the payout statistics?"
- "Show me all pending payouts"
- "Get due payout stats"
Referral Management:
- "List all referrals from promoter 123"
- "Get details for referral ID 456"
🔧 Troubleshooting
Server won't start
Check logs in Dokploy or run:
docker logs firstpromoter-mcp
Common issues:
- Missing
FP_API_KEYorFP_ACCOUNT_ID - Port 8000 already in use
API errors
Verify your FirstPromoter credentials:
- Log into FirstPromoter
- Go to Settings → Integrations → Manage API Keys
- Ensure the API key has appropriate permissions
Connection refused
- Check if the container is running
- Verify Dokploy domain configuration
- Check firewall rules
📄 License
MIT License
🤝 Contributing
- Fork the repository
- Create a feature branch
- Submit a pull request