MCP Server
Connect Refgrow to AI assistants like Claude Desktop, Cursor, and Claude Code using the Model Context Protocol (MCP). Manage your affiliate program with natural language.
What is MCP?
The Model Context Protocol (MCP) is an open standard that allows AI assistants to securely connect to external data sources and tools. With the Refgrow MCP server, you can manage your affiliate program directly from your AI assistant — view stats, manage affiliates, process payouts, and more using natural language.
Prerequisites
- A Refgrow account with at least one project (sign up free)
- A Refgrow API key (generated from your project settings)
- Node.js 18 or later installed on your machine
- An MCP-compatible AI client (Claude Desktop, Cursor, or Claude Code)
Installation
The Refgrow MCP server runs via npx — no global install required. It is automatically downloaded and executed when you configure your AI client.
npx @refgrow/mcpGetting your API Key
- Log in to your Refgrow dashboard
- Navigate to your project's Settings tab
- Scroll to the API Keys section
- Click Generate API Key
- Copy the key (it starts with
rgk_). You will not be able to see it again.
Setup for Claude Desktop
Add the following to your Claude Desktop MCP configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"refgrow": {
"command": "npx",
"args": ["-y", "@refgrow/mcp"],
"env": {
"REFGROW_API_KEY": "rgk_your_api_key_here"
}
}
}
}After saving the configuration, restart Claude Desktop. You should see the Refgrow tools available in the tools menu.
Setup for Cursor
Add the MCP server to your Cursor configuration. Create or edit .cursor/mcp.json in your project root:
{
"mcpServers": {
"refgrow": {
"command": "npx",
"args": ["-y", "@refgrow/mcp"],
"env": {
"REFGROW_API_KEY": "rgk_your_api_key_here"
}
}
}
}Restart Cursor after saving. The Refgrow tools will appear in the AI assistant's available tools.
Setup for Claude Code
Add the Refgrow MCP server to your project's .mcp.json file:
{
"mcpServers": {
"refgrow": {
"command": "npx",
"args": ["-y", "@refgrow/mcp"],
"env": {
"REFGROW_API_KEY": "rgk_your_api_key_here"
}
}
}
}Available Tools
The MCP server exposes 18 tools organized in 4 categories. Your AI assistant can call any of these tools based on your natural-language requests.
Affiliates
| Tool | Description |
|---|---|
list_affiliates | List all affiliates with stats (clicks, signups, purchases, earnings) |
get_affiliate_details | Get details for a specific affiliate by email |
create_affiliate | Create a new affiliate with optional custom referral code |
update_affiliate | Update affiliate email, referral code, status, or partner slug |
delete_affiliate | Remove an affiliate from the project |
Referrals
| Tool | Description |
|---|---|
list_referrals | List referred users, filterable by affiliate or status |
get_referral_details | Get details for a specific referred user by email |
create_referral | Manually create a referred user record |
Conversions
| Tool | Description |
|---|---|
list_conversions | List conversions with filters for type, affiliate, date range, paid status |
get_conversion | Get a specific conversion by ID |
create_conversion | Create a conversion (signup/purchase) with auto-commission calculation |
update_conversion | Update conversion details or mark as paid |
delete_conversion | Delete a conversion record |
Coupons
| Tool | Description |
|---|---|
list_coupons | List coupon codes with affiliate info |
get_coupon | Get a specific coupon by ID |
create_coupon | Create a coupon linked to an affiliate (with optional Stripe/LemonSqueezy IDs) |
update_coupon | Update coupon details |
delete_coupon | Delete a coupon (also removes from Stripe if linked) |
Environment Variables
| Variable | Required | Description |
|---|---|---|
REFGROW_API_KEY | Yes | Your Refgrow API key (starts with rgk_) |
REFGROW_API_URL | No | Custom API base URL (defaults to https://refgrow.com/api/v1) |
Example Conversations
Here are some examples of what you can ask your AI assistant once the MCP server is connected:
View program performance
You:
"Show me my affiliate program stats for this month. Who are my top performers?"
Assistant:
The assistant calls get_project_stats and get_top_affiliates, then summarizes your clicks, conversions, revenue, and top-performing affiliates.
Manage affiliates
You:
"Add a new affiliate john@example.com with a 30% commission override and the coupon code JOHN30."
Assistant:
The assistant calls create_affiliate with the email, commission override, and coupon parameters.
Process payouts
You:
"Show me all pending payouts and process them via PayPal."
Assistant:
The assistant calls list_payouts filtered by pending status, then calls create_payout for each affiliate after confirmation.
Analyze conversions
You:
"List all conversions from last week and tell me the total revenue."
Assistant:
The assistant calls list_conversions with a date range filter and calculates the total.
Troubleshooting
"Server not found" or connection errors
- Ensure Node.js 18+ is installed:
node --version - Verify
npxis available:npx --version - Check your internet connection — the package is downloaded on first run
- Try running
npx @refgrow/mcpmanually to see any error output
"Authentication failed" or 401 errors
- Verify your API key starts with
rgk_ - Ensure the API key has not been revoked in your project settings
- Check that the API key belongs to the correct project
- Regenerate the API key if needed
"Tool not available" in AI assistant
- Restart your AI client after saving the configuration
- Verify the JSON configuration is valid (no trailing commas, correct syntax)
- Check the AI client's logs for MCP connection errors
Rate limiting
- The Refgrow API has a rate limit of 60 requests per minute per API key
- If you hit rate limits, wait a minute before retrying
- For high-volume usage, consider batching your requests
Next Steps
- API Reference — full documentation of all API endpoints
- API Overview — understand authentication and rate limits
- Quickstart — set up your first affiliate program
Need help?
If you have questions about the MCP server, contact us at support@refgrow.com.